From 418c08f5a4ef5c526fe172dbd3670bfffbf1b11d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 26 Aug 2010 20:46:39 +0000 Subject: [PATCH] -check in some hints on how to do the clonevm stuff in kvm git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7269 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/kvm.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index e45c49481..c8dd4fbe6 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -200,7 +200,22 @@ sub get_filepath_by_url { #at the end of the day, the libvirt storage api gives } } if ($create) { - if ($create =~ /^clone=/) { + if ($create =~ /^clone=(.*)$/) { + my $src = $1; + my $fmt='raw'; + if ($src =~ /\.qcow2$/) { + $fmt='qcow2'; + } + my $vol = $poolobj->create_volume("".$desiredname."100$src"); + #ok, this is simply hinting, not the real deal, so to speak + # 1) sys::virt complains if capacity isn't defined. We say '100', knowing full well it will be promptly ignored down the code. This is aggravating + # and warrants recheck with the RHEL6 stack + # 2) create_volume with backingStore is how we do the clone from master (i.e. a thin clone, a la qemu-img create) + # note how backing store is full path, allowing cross-pool clones + # 3) clone_volume is the way to invoke qemu-img convert (i.e. to 'promote' and flatten a vm image to a standalone duplicate volume + # incidentally, promote to master will be relatively expensive compared to the converse operation, as expected + # will have to verify as it is investigated whether this can successfully cross pools (hope so) + # 4) qemu-img was so much more transparent and easy to figure out than this } else { my $vol = $poolobj->create_volume("".$desiredname."".getUnits($create,"G",1)."0"); if ($vol) { return $vol->get_path(); }