[et-mgmt-tools] [PATCH][RFC][virtinst] Adding Cloning Feature (changing from libvirtML)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've been planing to adding cloning feature.
First, I tried to make the patch for libirt/virsh.

As a result of having disscussed in libirtML, it followed that it is better to implement it in a higher module by suggestion of Daniel Veillard and Dan Berrange with the following reasons.
https://www.redhat.com/archives/libvir-list/2007-April/msg00151.html

I also agree. So I made patches again based on the opinion of two.
There are two new files.

1)CloneManager.py (The same directory as DistroManager.py in virtinst)
This module is Cloning a virtual machine. This has One class named "CloneDesign".
The CloneDesign class is the design paper for cloning VM.
 ・clone_name
 ・clone_devices
 ・clone_mac
 ・guest_xml etc...
CloneManager takes the CloneDesign Object and edits the XML acquired form source VM according to the object. The outline processing that CloneDesign does is the following. a)Check existing source VM used lookupByName() when source VM name is setted.
 b)Get the XML of source VM used XMLDesc() when source VM name is setted.
c)Get source devices size used Python API(getsize or "fdisk -s") for displaying cloning progress when source VM name is setted.
 d)Check Shutoff status used dom.info()[0] when source VM name is setted.
 e)Check NOT existing VM used lookupByName() when clone VM name is setted

The outline processing that CloneManager does is the following. a)Edit source VM XML according to taked CloneDesign object
 b)Copying devices used Python API(Now read() and write())
 c)Define the XML used conn.defineXML()

2)virt-clone
 This is user I/F script file handling CloneManager module in virtinst.
 I also think it is simpler to have a separate tool for this purpose.

This revision is not able to supported for diffrerent "disk type".
(e.g. From "file" to "block" or From "block" to "file".)
Now, I investigate sparse files copying.

Attached patches shows outline below.
---------------------------------------------------------
# ./virt-clone --help
Usage: virt-clone [options]

Options:
 -h, --help            show this help message and exit
 -n NAME, --name=NAME  Name of the source guest instance; The status must be
                       shutoff
 -w CLONE_NAME, --new=CLONE_NAME
                       Name of the clone guest instance; if none, adding
                       fixed string _CLONE to source guest name
 -m CLONE_MAC, --mac=CLONE_MAC
                       Fixed MAC address for the clone guest; if none or
                       RANDOM is given a random address will be used
 -f CLONE_DISKFILE, --file=CLONE_DISKFILE
                       File to use as the disk image for the clone guest
                       instance

# ./virt-clone -f /dev/sda13 -n PV_RH5 -w PV_RH5_CLONE
Cloning from /dev/sda5 to /dev/sda13
Cloning domain...          19% |====                     | 988 MB    05:11 ETA

Has Many block devices
# ./virt-clone -f /dev/sda12 -n PV_RH5_2
ERROR:  Missing destination device for /dev/sda5
# ./virt-clone -f /dev/sda12 -f /dev/sda13 -n PV_RH5_2
Cloning from /dev/sda10 to /dev/sda12
Cloning domain...         100% |=========================| 5.0 GB    06:06
Cloning from /dev/sda5 to /dev/sda13
Cloning domain...          98% |======================== | 4.9 GB    00:07 ETA

Turn interactive mode when "name" option is not setted
# ./virt-clone -f /dev/sda12 -f /dev/sda13
What is the name of the source virtual machine? PV_RH
ERROR:  Domain PV_RH is not found
What is the name of the source virtual machine?

Report an Error
・Domain already exists
# ./virt-clone -f /dev/sda13 -n PV_RH5_2 -w PV_RH5_2
ERROR:  Domain PV_RH5_2 already exists
・Except Shutoff status
# ./virt-clone -f /dev/sda13 -n Domain-0
ERROR:  Domain status must be shutoff
・Missing destination devices
# ./virt-clone -f /dev/sda12 -n PV_RH5_2
ERROR:  Missing destination device for /dev/sda5
・etc ...

Attachment: virt-clone.patch
Description: Binary data

Attachment: CloneManager.py.patch
Description: Binary data


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux