...
- 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
![](/confluence/download/attachments/27832925/Libvirt%20UML%20Diagram.gif?version=1&modificationDate=1323781578000&api=v2)
HTML |
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>VCL::Provisioning::libvirt - VCL provisioning module to support the libvirt toolkit</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
NAME
VCL::Provisioning::libvirt - VCL provisioning module to support the libvirt toolkit
SYNOPSIS
No Format |
---|
use VCL::Module::Provisioning::libvirt;
my $provisioner = (VCL::Module::Provisioning::libvirt)->new({data_structure => $self->data});
|
DESCRIPTION
No Format |
---|
Provides support allowing VCL to provisioning resources supported by the
libvirt toolkit.
http://libvirt.org
|
OBJECT METHODS
initialize
No Format |
---|
Parameters : none
Returns : boolean
Description : Enumerates the libvirt driver modules directory:
|
...
lib/VCL/Module/Provisioning/libvirt/
|
...
...
...
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 |
...
...
within this module via $self->driver. This allows
|
...
...
libvirt support driver modules to be added without having to
|
...
...
alter the code in libvirt.pm.
|
load
...
: none
Returns : boolean
Description : Loads the requested image on |
...
- Destroy and delete any domains have already been defined for the computer assigned to this reservation.
- Construct the default libvirt XML definition for the domain.
- Call the libvirt driver module's 'extend_domain_xml' subroutine if it is implemented. Pass the default domain XML definition hash reference as an argument. The 'extend_domain_xml' subroutine may add or modify XML values. This allows the driver module to customize the XML specific to that driver.
- Call the driver module's 'pre_define' subroutine if it is implemented. This subroutine completes any necessary tasks which are specific to the driver being used prior to defining the domain.
- Create a text file on the node containing the domain XML definition.
- Define the domain on the node by calling 'virsh define <XML file>'.
- Power on the domain.
- Call the domain guest OS module's 'post_load' subroutine if implemented.
capture
No Format |
---|
Parameters : none
Returns : |
...
...
...
...
...
...
...
...
...
node_status
...
$computer_id (optional)
Returns : string
Description : Checks the status of the computer in order to determine if the
computer is ready to be reserved or needs to be |
...
...
...
...
...
...
...
...
...
...
...
string is returned depending on the status of the |
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
* OS module's post-load tasks have run
'POST_LOAD':
* Computer is loaded with the correct image
|
...
...
* OS module's post-load tasks have |
...
...
...
* Computer is not accessible |
...
or not loaded with the correct
|
...
does_image_exist
No Format |
---|
Parameters : $image_name (optional)
Returns : array (boolean)
Description : Checks if the requested image exists on the node or in the
repository. |
...
If the image exists, an array containing the image
|
...
file paths is returned. A boolean evaluation can |
...
...
...
simply determine if an image exists.
|
get_image_size
No Format |
---|
Parameters : $image_name (optional)
Returns : integer
Description : Returns the size of the image |
...
get_image_repository_search_paths
No Format |
---|
Parameters : $management_node_identifier (optional)
Returns : array
Description : |
...
Returns an array containing paths on the management node where an
|
...
...
image may reside. The paths may contain wildcards. This |
...
...
to attempt to locate an image on another managment node in order
|
...
...
...
power_status
No Format |
---|
Parameters : $domain_name (optional)
Returns : string
Description : Determines the power state of the domain. A string is returned
containing one of the following values:
* 'on'
* 'off'
|
...
...
...
...
...
...
...
...
power_on
...
$domain_name (optional)
Returns : |
...
boolean
Description : Powers |
...
...
...
...
...
...
...
or was already powered on.
|
power_off
No Format |
---|
Parameters : $domain_name
Returns : boolean
Description : Powers off the domain. Returns true if the domain was
successfully powered off or was already powered off.
|
power_reset
No Format |
---|
Parameters : $domain_name (optional)
Returns : boolean
Description : Resets the power of the domain by powering it off and then back
on.
|
post_maintenance_action
No Format |
---|
Parameters : none
Returns : |
...
...
Performs tasks to the computer after it has been put into
maintenance mode.
|
PRIVATE METHODS
driver
No Format |
---|
Parameters : none
Returns : Libvirt driver object
Description |
...
...
Returns a reference to the libvirt driver object which is created
|
...
...
when this libvirt.pm module is initialized.
|
get_driver_name
No Format |
---|
Parameters : none
Returns |
...
: string
Description : Returns the name of the libvirt driver being used to control the
|
...
...
get_domain_name
No Format |
---|
Parameters : none
Returns : string
Description : Returns the name |
...
of the domain. This name is passed to various
|
...
...
...
...
...
...
...
...
...
...
...
...
virt-manager.
Example: 'vclv99-197:vmwarewin7-Windows764bit1846-v3'
|
get_domain_file_base_name
No Format |
---|
Parameters : none
Returns : string
Description |
...
...
Returns the base name for files created for the current
|
...
...
reservation. A file extension is not included. This file |
...
...
used for the domain's XML definition file and it's copy on write
image |
...
file. Example: 'vclv99-37_234-v23'
|
get_domain_xml_directory_path
No Format |
---|
Parameters : none
Returns : string
Description : Returns |
...
the directory path on the node where domain definition
XML |
...
files reside. The directory used is: '/tmp/vcl'
|
get_domain_xml_file_path
No Format |
---|
Parameters : none
Returns : string
Description : Returns the domain XML definition file path on the node.
Example: '/tmp/vcl/vclv99-37_234-v23.xml'
|
get_master_image_directory_path
No Format |
---|
Parameters : none
Returns : string
Description : Returns the directory path on the node |
...
...
...
...
...
reside. Example: '/var/lib/libvirt/images'
|
get_master_image_file_path
No Format |
---|
Parameters : $image_name (optional)
Returns : string
Description : Returns the path on the node where the master image file resides.
Example:
|
...
...
'/var/lib/libvirt/images/vmwarelinux-RHEL54Small2251-v1.qcow2'
|
get_copy_on_write_file_path
No Format |
---|
Parameters : none
Returns : |
...
...
Returns the path on the node where the copy on write file for the
|
...
...
...
...
...
...
...
...
...
'/var/lib/libvirt/images/ |
...
...
...
delete_existing_domains
No Format |
---|
Parameters : none
Returns : boolean
Description : Deletes existing domains |
...
which were previously created for the
computer assigned |
...
to the current reservation.
|
delete_domain
No Format |
---|
Parameters : $domain_name
Returns : boolean
Description : Deletes a domain from |
...
generate_domain_xml
No Format |
---|
Parameters : none
Returns : string
Description : Generates a string containing the XML definition |
...
get_domain_info
No Format |
---|
Parameters : none
Returns : hash reference
Description : Retrieves information about all of the |
...
domains defined on the
node and constructs |
...
a hash containing the information. Example:
|
...
"vclv99-197:vmwarewin7-Windows764bit1846-v3" => {
"id" => 135,
|
...
...
...
...
...
...
...
...
"vclv99-37:vmwarewinxp-base234-v23" => {
|
...
get_domain_xml
...
...
hash reference
Description : |
...
Retrieves the XML definition of a domain already defined on the
|
...
...
using XML::Simple::XMLin.
|
domain_exists
No Format |
---|
Parameters : $domain_name
Returns : boolean
Description : Determines if the domain is |
...
get_snapshot_info
...
...
...
hash reference
Description : |
...
Retrieves snapshot information for the domain specified by the
argument and constructs a hash. The hash keys are the snapshot
names. Example:
|
...
...
...
...
...
...
...
...
...
...
...
...
...
...
creation_time" => "2011-12-07 16:05:50 -0500",
|
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
create_snapshot
No Format |
---|
Parameters : $domain_name, $description
Returns : boolean
Description : Creates a snapshot of the domain specified by the argument.
|
delete_snapshot
No Format |
---|
Parameters : $domain_name, $snapshot
Returns : boolean
Description : Deletes a snapshot created of the domain specified by the
argument.
|
get_image_size_bytes
No Format |
---|
Parameters : $image_name (optional)
Returns : integer
Description : Returns the size of the image in bytes.
|
find_repository_image_file_paths
...
$image_name (optional)
Returns : array
Description : Locates valid image files stored in the image repository.
Searches for all files beginning with the image name and then
checks the results to remove any files which should not be
included. File extensions which are excluded: vmx, |
...
...
...
...
...
...
...
...
...
...
one of the split vmdk formats and the <image name>.vmdk contains
|
...
the descriptor information. This |
...
...
...
...
...
...
SEE ALSO
be loaded on KVM.</pre>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="http://cwiki.apache.org/VCL/">http://cwiki.apache.org/VCL/</a>
</p>
</body>
</html>
Image Added