mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
Drop support for non-managed save/restore
All major drivers either support it, or don't support save at all, so I think we can safely drop it. If people still need it they can get by with virsh.
This commit is contained in:
parent
3d2afbaf6f
commit
839ce682b1
@ -111,8 +111,6 @@ class vmmConfig(object):
|
||||
CONFIG_DIR_IMAGE = "image"
|
||||
CONFIG_DIR_ISO_MEDIA = "isomedia"
|
||||
CONFIG_DIR_FLOPPY_MEDIA = "floppymedia"
|
||||
CONFIG_DIR_SAVE = "save"
|
||||
CONFIG_DIR_RESTORE = "restore"
|
||||
CONFIG_DIR_SCREENSHOT = "screenshot"
|
||||
CONFIG_DIR_FS = "fs"
|
||||
|
||||
@ -152,10 +150,8 @@ class vmmConfig(object):
|
||||
CONSOLE_SCALE_ALWAYS = 2
|
||||
|
||||
DEFAULT_XEN_IMAGE_DIR = "/var/lib/xen/images"
|
||||
DEFAULT_XEN_SAVE_DIR = "/var/lib/xen/dump"
|
||||
|
||||
DEFAULT_VIRT_IMAGE_DIR = "/var/lib/libvirt/images"
|
||||
DEFAULT_VIRT_SAVE_DIR = "/var/lib/libvirt"
|
||||
|
||||
def __init__(self, appname, CLIConfig, test_first_run=False):
|
||||
self.appname = appname
|
||||
@ -661,9 +657,6 @@ class vmmConfig(object):
|
||||
_type == self.CONFIG_DIR_ISO_MEDIA or
|
||||
_type == self.CONFIG_DIR_FLOPPY_MEDIA):
|
||||
path = self.get_default_image_dir(conn)
|
||||
if (_type == self.CONFIG_DIR_SAVE or
|
||||
_type == self.CONFIG_DIR_RESTORE):
|
||||
path = self.get_default_save_dir(conn)
|
||||
|
||||
logging.debug("directory for type=%s returning=%s", _type, path)
|
||||
return path
|
||||
@ -688,14 +681,6 @@ class vmmConfig(object):
|
||||
# is a managed pool and the user will be able to install to it.
|
||||
return self.DEFAULT_VIRT_IMAGE_DIR
|
||||
|
||||
def get_default_save_dir(self, conn):
|
||||
if conn.is_xen():
|
||||
return self.DEFAULT_XEN_SAVE_DIR
|
||||
elif os.access(self.DEFAULT_VIRT_SAVE_DIR, os.W_OK):
|
||||
return self.DEFAULT_VIRT_SAVE_DIR
|
||||
else:
|
||||
return os.getcwd()
|
||||
|
||||
|
||||
# Keyring / VNC password dealings
|
||||
def get_secret_name(self, vm):
|
||||
|
@ -652,13 +652,6 @@ class vmmConnection(vmmGObject):
|
||||
# Libvirt object creation methods #
|
||||
###################################
|
||||
|
||||
def restore(self, frm):
|
||||
self._backend.restore(frm)
|
||||
try:
|
||||
os.remove(frm)
|
||||
except:
|
||||
logging.debug("Couldn't remove save file '%s' for restore", frm)
|
||||
|
||||
def define_domain(self, xml):
|
||||
return self._backend.defineXML(xml)
|
||||
def define_network(self, xml):
|
||||
|
@ -1463,16 +1463,13 @@ class vmmDomain(vmmLibvirtObject):
|
||||
self._backend.resume()
|
||||
|
||||
@vmmLibvirtObject.lifecycle_action
|
||||
def save(self, filename=None, meter=None):
|
||||
def save(self, meter=None):
|
||||
self._install_abort = True
|
||||
|
||||
if meter:
|
||||
start_job_progress_thread(self, meter, _("Saving domain to disk"))
|
||||
|
||||
if not self.managedsave_supported:
|
||||
self._backend.save(filename)
|
||||
else:
|
||||
self._backend.managedSave(0)
|
||||
self._backend.managedSave(0)
|
||||
|
||||
def has_managed_save(self):
|
||||
if not self.managedsave_supported:
|
||||
|
@ -676,7 +676,6 @@ class vmmEngine(vmmGObject):
|
||||
|
||||
obj.connect("action-exit-app", self.exit_app)
|
||||
obj.connect("action-view-manager", self._do_show_manager)
|
||||
obj.connect("action-restore-domain", self._do_restore_domain)
|
||||
obj.connect("host-opened", self.increment_window_counter)
|
||||
obj.connect("host-closed", self.decrement_window_counter)
|
||||
|
||||
@ -930,34 +929,18 @@ class vmmEngine(vmmGObject):
|
||||
def _do_save_domain(self, src, uri, connkey):
|
||||
conn = self._lookup_conn(uri)
|
||||
vm = conn.get_vm(connkey)
|
||||
managed = bool(vm.managedsave_supported)
|
||||
|
||||
if not managed and conn.is_remote():
|
||||
src.err.val_err(_("Saving virtual machines over remote "
|
||||
"connections is not supported with this "
|
||||
"libvirt version or hypervisor."))
|
||||
return
|
||||
|
||||
if not src.err.chkbox_helper(self.config.get_confirm_poweroff,
|
||||
self.config.set_confirm_poweroff,
|
||||
text1=_("Are you sure you want to save '%s'?" % vm.get_name())):
|
||||
return
|
||||
|
||||
path = None
|
||||
if not managed:
|
||||
path = src.err.browse_local(
|
||||
conn, _("Save Virtual Machine"),
|
||||
dialog_type=Gtk.FileChooserAction.SAVE,
|
||||
browse_reason=self.config.CONFIG_DIR_SAVE)
|
||||
if not path:
|
||||
return
|
||||
|
||||
_cancel_cb = None
|
||||
if vm.getjobinfo_supported:
|
||||
_cancel_cb = (self._save_cancel, vm)
|
||||
|
||||
def cb(asyncjob):
|
||||
vm.save(path, meter=asyncjob.get_meter())
|
||||
vm.save(meter=asyncjob.get_meter())
|
||||
def finish_cb(error, details):
|
||||
if error is not None:
|
||||
error = _("Error saving domain: %s") % error
|
||||
@ -985,23 +968,6 @@ class vmmEngine(vmmGObject):
|
||||
asyncjob.job_canceled = True
|
||||
return
|
||||
|
||||
def _do_restore_domain(self, src, uri):
|
||||
conn = self._lookup_conn(uri)
|
||||
if conn.is_remote():
|
||||
src.err.val_err(_("Restoring virtual machines over remote "
|
||||
"connections is not yet supported"))
|
||||
return
|
||||
|
||||
path = src.err.browse_local(
|
||||
conn, _("Restore Virtual Machine"),
|
||||
browse_reason=self.config.CONFIG_DIR_RESTORE)
|
||||
|
||||
if not path:
|
||||
return
|
||||
|
||||
vmmAsyncJob.simple_async_noshow(conn.restore, [path], src,
|
||||
_("Error restoring domain"))
|
||||
|
||||
def _do_destroy_domain(self, src, uri, connkey):
|
||||
conn = self._lookup_conn(uri)
|
||||
vm = conn.get_vm(connkey)
|
||||
|
Loading…
Reference in New Issue
Block a user