A connection to a hypervisor through libvirt.
Supports KVM, LXC, QEMU, UML, and XEN.
Related Flags
libvirt_type: | Libvirt domain type. Can be kvm, qemu, uml, xen (default: kvm). |
---|---|
libvirt_uri: | Override for the default libvirt URI (depends on libvirt_type). |
libvirt_xml_template: | |
Libvirt XML Template. | |
rescue_image_id: | |
Rescue ami image (None = original image). | |
rescue_kernel_id: | |
Rescue aki image (None = original image). | |
rescue_ramdisk_id: | |
Rescue ari image (None = original image). | |
injected_network_template: | |
Template file for injected network | |
allow_same_net_traffic: | |
Whether to allow in project network traffic |
Bases: object
Bases: nova.virt.driver.ComputeDriver
Note that this function takes an instance name.
Checks the host cpu is compatible to a cpu given by xml.
“xml” must be a part of libvirt.openReadonly().getCapabilities(). return values follows by virCPUCompareResult. if 0 > return value, do live migration. ‘http://libvirt.org/html/libvirt-libvirt.html#virCPUCompareResult‘
Parameters: | cpu_info – json string that shows cpu feature(see get_cpu_info()) |
---|---|
Returns: | None. if given cpu info is not compatible to this server, raise exception. |
Setting up filtering rules and waiting for its completion.
To migrate an instance, filtering rules to hypervisors and firewalls are inevitable on destination host. ( Waiting only for filterling rules to hypervisor, since filtering rules to firewall rules can be set faster).
Concretely, the below method must be called. - setup_basic_filtering (for nova-basic, etc.) - prepare_instance_filter(for nova-instance-instance-xxx, etc.)
to_xml may have to be called since it defines PROJNET, PROJMASK. but libvirt migrates those value through migrateToURI(), so , no need to be called.
Don’t use thread for this method since migration should not be started when setting-up filtering rules operations are not completed.
Params instance_ref: | |
---|---|
nova.db.sqlalchemy.models.Instance object |
Get cpuinfo information.
Obtains cpu feature from virConnect.getCapabilities, and returns as a json string.
Returns: | see above description |
---|
Note that this function takes an instance name.
Returns a list of all block devices for this domain.
See xenapi_conn.py implementation.
Get hypervisor type.
Returns: | hypervisor type (ex. qemu) |
---|
Get hypervisor version.
Returns: | hypervisor version (ex. 12003) |
---|
Retrieve information from libvirt for a specific instance name.
If a libvirt error is encountered during lookup, we might raise a NotFound exception or Error exception depending on how severe the libvirt error is.
Preparation block migration.
Params ctxt: | security context |
---|---|
Params instance_ref: | |
nova.db.sqlalchemy.models.Instance object instance object that is migrated. | |
Returns: |
“[{‘path’:’disk’, ‘type’:’raw’, ‘local_gb’:‘10G’},...]” |
Note that this function takes an instance name.
Returns a list of all network interfaces for this instance.
Get the total hdd size(GB) of physical computer.
Returns: | The total amount of HDD(GB). Note that this value shows a partition where NOVA-INST-DIR/instances mounts. |
---|
Get the free hdd size(GB) of physical computer.
Returns: | The total usage of HDD(GB). Note that this value shows a partition where NOVA-INST-DIR/instances mounts. |
---|
Get the total memory size(MB) of physical computer.
Returns: | the total amount of memory(MB). |
---|
Get the free memory size(MB) of physical computer.
Returns: | the total usage of memory(MB). |
---|
Get vcpu number of physical computer.
Returns: | the number of cpu core. |
---|
Get vcpu usage number of physical computer.
Returns: | The total number of vcpu that currently used. |
---|
Reboots, shuts down or powers up the host.
Note that this function takes an instance name.
Spawning live_migration operation for distributing high-load.
Params ctxt: | security context |
---|---|
Params instance_ref: | |
nova.db.sqlalchemy.models.Instance object instance object that is migrated. | |
Params dest: | destination host |
Params block_migration: | |
destination host | |
Params post_method: | |
post operation method. expected nova.compute.manager.post_live_migration. | |
Params recover_method: | |
recovery method when any exception occurs. expected nova.compute.manager.recover_live_migration. | |
Params block_migration: | |
if true, do block migration. |
Pause VM instance
Plugin VIFs into networks.
Post operation of live migration at destination host.
Params ctxt: | security context |
---|---|
Params instance_ref: | |
nova.db.sqlalchemy.models.Instance object instance object that is migrated. | |
Params network_info: | |
instance network infomation |
:params : block_migration: if true, post operation of block_migraiton.
Preparation block migration.
Params ctxt: | security context |
---|---|
Params instance_ref: | |
nova.db.sqlalchemy.models.Instance object instance object that is migrated. | |
Params disk_info_json: | |
json strings specified in get_instance_disk_info |
Reboot a virtual machine, given an instance reference.
This method actually destroys and re-creates the domain to ensure the reboot happens, as the guest OS cannot ignore this action.
Loads a VM using rescue images.
A rescue is normally performed when something goes wrong with the primary images and data needs to be corrected/recovered. Rescuing should not edit or over-ride the original image, only allow for data recovery.
resume the specified instance
Sets the specified host’s ability to accept new instances.
Create snapshot from a running VM instance.
This command only works with qemu 0.14+
Suspend the specified instance
See comments of same method in firewall_driver.
Unpause paused VM instance
Reboot the VM which is being rescued back into primary images.
Because reboot destroys and re-creates instances, unresue should simply call reboot.
Updates compute manager resource info on ComputeNode table.
This method is called when nova-coompute launches, and whenever admin executes “nova-manage service update_resource”.
Parameters: |
|
---|
See xenapi_conn.py implementation.