salt.modules.kvm_hyper

Provide the hyper module for kvm hypervisors. This is the interface used to interact with kvm on behalf of the salt-virt interface

depends:
  • libvirt Python module
salt.modules.kvm_hyper.freecpu()

Return an int representing the number of unallocated cpus on this hypervisor

CLI Example:

salt '*' hyper.freecpu
salt.modules.kvm_hyper.freemem()

Return an int representing the amount of memory that has not been given to virtual machines on this node

CLI Example:

salt '*' hyper.freemem
salt.modules.kvm_hyper.get_conf(name)

Returns the xml for a given vm

CLI Example:

salt '*' hyper.get_conf <vm name>
salt.modules.kvm_hyper.get_disks(name)

Return the disks of a named virt

CLI Example:

salt '*' hyper.get_disks <vm name>
salt.modules.kvm_hyper.halt(name)

Hard power down a virtual machine

CLI Example:

salt '*' hyper.halt webserver
salt.modules.kvm_hyper.hyper_info()

Return a dict with information about this hypervisor

CLI Example:

salt '*' hyper.hyper_info
salt.modules.kvm_hyper.hyper_type()

Return that type of hypervisor this is

CLI Example:

salt '*' hyper.hyper_type
salt.modules.kvm_hyper.init(name, cpus, mem, image, storage_dir, network=None, desc='', opts=None)

Create a KVM virtual machine based on these passed options, the virtual machine will be started upon creation

CLI Example:

salt '*' hyper.init webserver 2 2048 salt://fedora/f16.img:virt /srv/vm/images
salt.modules.kvm_hyper.list_virts()

Return a list of virtual machine names on the minion

CLI Example:

salt '*' hyper.list_virts
salt.modules.kvm_hyper.pause(name)

Pause the named virtual machine

CLI Example:

salt '*' hyper.pause webserver
salt.modules.kvm_hyper.purge(name)

Hard power down and purge a virtual machine, this will destroy a vm and all associated vm data

CLI Example:

salt '*' hyper.purge webserver
salt.modules.kvm_hyper.resume(name)

Resume the named virtual machine

CLI Example:

salt '*' hyper.resume webserver
salt.modules.kvm_hyper.set_autostart(name, state='on')

Set the named virtual machine to autostart when the hypervisor boots

CLI Example:

salt '*' hyper.set_autostart webserver
salt.modules.kvm_hyper.start(config)

Start an already defined virtual machine that has been shut down

CLI Example:

salt '*' hyper.start webserver
salt.modules.kvm_hyper.virt_info()

Return detailed information about the vms on this hyper in a dict:

{'cpu': <int>,
'maxMem': <int>,
'mem': <int>,
'state': '<state>',
'cputime' <int>}

CLI Example:

salt '*' hyper.virt_info

Parent topic

Previous topic

salt.modules.kmod

Next topic

salt.modules.launchctl