domain: Remove internal 'cloning' marker

qemu nowadays should reject the common cases here with its default
image locking. Our impl wasn't very good anyways so let's just leave
it up to the lower layers
This commit is contained in:
Cole Robinson 2019-06-16 17:32:41 -04:00
parent 9c8e879ff0
commit b513388979
2 changed files with 18 additions and 35 deletions

View File

@ -838,35 +838,29 @@ class vmmCloneVM(vmmGObjectUI):
progWin.run() progWin.run()
def _async_clone(self, asyncjob): def _async_clone(self, asyncjob):
try: meter = asyncjob.get_meter()
self.vm.set_cloning(True)
meter = asyncjob.get_meter()
refresh_pools = [] refresh_pools = []
for disk in self.clone_design.clone_disks: for disk in self.clone_design.clone_disks:
if not disk.wants_storage_creation(): if not disk.wants_storage_creation():
continue continue
pool = disk.get_parent_pool() pool = disk.get_parent_pool()
if not pool: if not pool:
continue continue
poolname = pool.name() poolname = pool.name()
if poolname not in refresh_pools: if poolname not in refresh_pools:
refresh_pools.append(poolname) refresh_pools.append(poolname)
self.clone_design.start_duplicate(meter) self.clone_design.start_duplicate(meter)
for poolname in refresh_pools: for poolname in refresh_pools:
try: try:
pool = self.conn.get_pool(poolname) pool = self.conn.get_pool(poolname)
self.idle_add(pool.refresh) self.idle_add(pool.refresh)
except Exception: except Exception:
logging.debug("Error looking up pool=%s for refresh after " logging.debug("Error looking up pool=%s for refresh after "
"VM clone.", poolname, exc_info=True)
finally:
self.vm.set_cloning(False)
def change_storage_browse(self, ignore): def change_storage_browse(self, ignore):
def callback(src_ignore, txt): def callback(src_ignore, txt):

View File

@ -252,11 +252,6 @@ class vmmDomain(vmmLibvirtObject):
self._status_reason = self._backend.state()[1] self._status_reason = self._backend.state()[1]
return self._status_reason return self._status_reason
def get_cloning(self):
return self.cloning
def set_cloning(self, val):
self.cloning = bool(val)
# If manual shutdown or destroy specified, make sure we don't continue # If manual shutdown or destroy specified, make sure we don't continue
# install process # install process
def get_install_abort(self): def get_install_abort(self):
@ -1281,9 +1276,6 @@ class vmmDomain(vmmLibvirtObject):
@vmmLibvirtObject.lifecycle_action @vmmLibvirtObject.lifecycle_action
def startup(self): def startup(self):
if self.get_cloning():
raise RuntimeError(_("Cannot start guest while cloning "
"operation in progress"))
self._backend.create() self._backend.create()
@vmmLibvirtObject.lifecycle_action @vmmLibvirtObject.lifecycle_action
@ -1316,9 +1308,6 @@ class vmmDomain(vmmLibvirtObject):
@vmmLibvirtObject.lifecycle_action @vmmLibvirtObject.lifecycle_action
def resume(self): def resume(self):
if self.get_cloning():
raise RuntimeError(_("Cannot resume guest while cloning "
"operation in progress"))
self._backend.resume() self._backend.resume()
@vmmLibvirtObject.lifecycle_action @vmmLibvirtObject.lifecycle_action