[virt-tools-list] [virt-manager PATCH] clone: keep the same image format on a cross-pool clone

Giuseppe Scrivano gscrivan at redhat.com
Tue Mar 31 16:00:41 UTC 2015


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 virtinst/cloner.py  | 6 ++++--
 virtinst/storage.py | 8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/virtinst/cloner.py b/virtinst/cloner.py
index 68a5786..c533e7e 100644
--- a/virtinst/cloner.py
+++ b/virtinst/cloner.py
@@ -1,5 +1,5 @@
 #
-# Copyright 2013 Red Hat, Inc.
+# Copyright 2013, 2015 Red Hat, Inc.
 # Copyright(c) FUJITSU Limited 2007.
 #
 # Cloning a virtual machine module.
@@ -347,9 +347,11 @@ class Cloner(object):
                 vol_install.name = clone_vol_install.name
             else:
                 # Cross pool cloning
-                # Deliberately don't sync input_vol params here
+                # Sync only the format of the image.
                 clone_vol_install.input_vol = orig_disk.get_vol_object()
                 vol_install = clone_vol_install
+                vol_install.input_vol = orig_disk.get_vol_object()
+                vol_install.sync_input_vol(only_format=True)
 
             vol_install.reflink = self.reflink
             clone_disk.set_vol_install(vol_install)
diff --git a/virtinst/storage.py b/virtinst/storage.py
index c07f558..8438896 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -1,5 +1,5 @@
 #
-# Copyright 2008, 2013 Red Hat, Inc.
+# Copyright 2008, 2013, 2015 Red Hat, Inc.
 # Cole Robinson <crobinso at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -610,15 +610,17 @@ class StorageVolume(_StorageObject):
     reflink = property(_get_reflink, _set_reflink,
             doc="flags for VIR_STORAGE_VOL_CREATE_REFLINK")
 
-    def sync_input_vol(self):
+    def sync_input_vol(self, only_format=False):
         # Pull parameters from input vol into this class
         parsevol = StorageVolume(self.conn,
                                  parsexml=self._input_vol.XMLDesc(0))
 
+        self.format = parsevol.format
+        if only_format:
+            return
         self.pool = self._input_vol.storagePoolLookupByVolume()
         self.capacity = parsevol.capacity
         self.allocation = parsevol.allocation
-        self.format = parsevol.format
 
 
     ##########################
-- 
2.1.0




More information about the virt-tools-list mailing list