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(); }