title: Libvirt Provisioning Module

(this page is probably beyond repair and should be recreated - it would probably be best to separate the manually created part from the auto generated part and just directly check in the manually created part as a plain html file instead of a .mdtext file)

Libvirt is an open source toolkit which can interact with KVM, Xen, and several other virtualization architectures.

libvirt.pm

  • libvirt.pm is the main provisioning module
  • Computers should have their provisioningID attributes set to point to this module in order to utilize it
  • Implements the required provisioning module subroutines: load, capture, node_status, power_status, power_on, power_off, power_reset...
  • Implements the functions provided by libvirt: define, start, destroy...
  • Does not contain code specific to any of the hypervisors supported by libvirt (KVM, Xen, etc)
  • File location: lib/VCL/Module/Provisioning/Libvirt.pm
  • Automatically determines which hypervisor driver object to use upon initialization by examining the host

Hypervisor Driver Modules

Libvirt hypervisor drivers allow it to interact with and control various types of hypervisors. The drivers are listed at http://libvirt.org/drivers.html. A hypervisor driver module must be written in order for VCL to support any of the hypervisors supported by libvirt. These driver modules only contain code specific to the driver in order to perform functions not handled by libvirt.pm.

  • Hypervisor driver directory: lib/VCL/Module/Provisioning/libvirt/
  • Example: lib/VCL/Module/Provisioning/libvirt/KVM.pm
    • Contains code which only applies to KVM
    • Calls qemu-img to perform image file operations

!Libvirt UML Diagram.gif!

Virtual Machine Disks

A master disk image is stored in the location specified by the datastore path in the VM host profile. A copy on write virtual disk image is created for each virtual machine when it is loaded. The master disk image is used as a read-only backing file for the copy on write disk images. Each VM writes to its own copy on write disk image. Using copy on write virtual disks allows VMs to be loaded without having to create a complete copy of the master disk image. !Copy on Write.gif|width=367,height=448!

libvirt.pm

<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#object_methods">OBJECT METHODS</a></li>
<ul>

	<li><a href="#initialize">initialize</a></li>
	<li><a href="#load">load</a></li>
	<li><a href="#capture">capture</a></li>
	<li><a href="#node_status">node_status</a></li>
	<li><a href="#does_image_exist">does_image_exist</a></li>
	<li><a href="#get_image_size">get_image_size</a></li>
	<li><a

href=“#get_image_repository_search_paths”>get_image_repository_search_paths power_status power_on power_off power_reset post_maintenance_action

<li><a href="#private_methods">PRIVATE METHODS</a></li>
<ul>

	<li><a href="#driver">driver</a></li>
	<li><a href="#get_driver_name">get_driver_name</a></li>
	<li><a href="#get_domain_name">get_domain_name</a></li>
	<li><a

href=“#get_domain_file_base_name”>get_domain_file_base_name get_domain_xml_directory_path get_domain_xml_file_path get_master_image_directory_path get_master_image_file_path get_copy_on_write_file_path delete_existing_domains delete_domain generate_domain_xml get_domain_info get_domain_xml domain_exists get_snapshot_info create_snapshot delete_snapshot get_image_size_bytes find_repository_image_file_paths

<li><a href="#see_also">SEE ALSO</a></li>
       Attempts to create and initialize an object for each hypervisor
       driver module found in this directory. The first driver module
       object successfully initialized is used. This object is made
       accessible within this module via $self-&gt;driver. This allows
       libvirt support driver modules to be added without having to
       alter the code in libvirt.pm.</pre>

KVM.pm

<li><a href="#name">NAME</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#object_methods">OBJECT METHODS</a></li>
<ul>

	<li><a href="#initialize">initialize</a></li>
	<li><a href="#get_domain_type">get_domain_type</a></li>
	<li><a

href=“#get_disk_driver_name”>get_disk_driver_name get_disk_format get_disk_file_extension pre_define

<li><a href="#private_methods">PRIVATE METHODS</a></li>
<ul>

	<li><a

href=“#get_virtual_disk_file_info”>get_virtual_disk_file_info get_virtual_disk_size_bytes copy_virtual_disk create_copy_on_write_image update_windows_image

<li><a href="#see_also">SEE ALSO</a></li>
       Adds registry keys to disable VMware services. If the image is
       Windows 5.x, registry keys are added to enable the builtin IDE
       drivers. This allows Windows images converted from VMware using a
       SCSI virtual disk to be loaded on KVM.</pre>