From 2218a03154ea5abefffbdb70e22c708b3f4e485d Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 2 Oct 2013 17:30:09 -0400 Subject: [PATCH] details: Rip out 'would you like to add/remove spicevmc' bit This was originally there for when we weren't defaulting to spice. We basically do that now, so people shouldn't have much need to switch spice on/off for an existing guest. Plus if we wanted to be far about it we would want to add/remove qxl as well but there it's just getting rediculous. --- virtManager/details.py | 33 +-------------------------------- virtManager/domain.py | 23 +---------------------- 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/virtManager/details.py b/virtManager/details.py index 1b3f6fd52..11a14513a 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -2261,35 +2261,6 @@ class vmmDetails(vmmGObjectUI): return self._change_config_helper(df, da, hf, ha) # Graphics options - def _do_change_spicevmc(self, gdev, newgtype): - has_multi_spice = (len([d for d in self.vm.get_graphics_devices() if - d.type == d.TYPE_SPICE]) > 1) - has_spicevmc = bool([d for d in self.vm.get_char_devices() if - (d.virtual_device_type == "channel" and - d.type == "spicevmc")]) - fromspice = (gdev.type == "spice") - tospice = (newgtype == "spice") - - if fromspice and tospice: - return False - if not fromspice and not tospice: - return False - - if tospice and has_spicevmc: - return False - if fromspice and not has_spicevmc: - return False - - if fromspice and has_multi_spice: - # Don't offer to remove if there are other spice displays - return False - - msg = (_("You are switching graphics type to %(gtype)s, " - "would you like to %(action)s Spice agent channels?") % - {"gtype": newgtype, - "action": fromspice and "remove" or "add"}) - return self.err.yes_no(msg) - def config_graphics_apply(self, dev_id_info): df, da, add_define, hf, ha, add_hotplug = self.make_apply_data() @@ -2310,9 +2281,7 @@ class vmmDetails(vmmGObjectUI): # Do this last since it can change graphics unique ID if self.edited(EDIT_GFX_TYPE): gtype = self.get_combo_entry("gfx-type") - change_spicevmc = self._do_change_spicevmc(dev_id_info, gtype) - add_define(self.vm.define_graphics_type, dev_id_info, - gtype, change_spicevmc) + add_define(self.vm.define_graphics_type, dev_id_info, gtype) return self._change_config_helper(df, da, hf, ha) diff --git a/virtManager/domain.py b/virtManager/domain.py index 9752a9a61..f11d6038e 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -32,7 +32,6 @@ import libvirt from virtinst import DomainSnapshot from virtinst import Guest from virtinst import util -from virtinst import VirtualChannelDevice from virtinst import VirtualController from virtManager import uihelpers @@ -761,29 +760,9 @@ class vmmDomain(vmmLibvirtObject): def change(editdev): editdev.keymap = newval return self._redefine_device(change, devobj) - def define_graphics_type(self, devobj, newval, apply_spice_defaults): - def handle_spice(): - if not apply_spice_defaults: - return - - guest = self._get_xmlobj_to_define() - is_spice = (newval == "spice") - - if is_spice: - dev = VirtualChannelDevice(guest.conn) - dev.type = dev.TYPE_SPICEVMC - guest.add_device(dev) - else: - channels = guest.get_devices("channel") - channels = [x for x in guest.get_devices("channel") - if x.type == "spicevmc"] - for dev in channels: - guest.remove_device(dev) - + def define_graphics_type(self, devobj, newval): def change(editdev): editdev.type = newval - handle_spice() - return self._redefine_device(change, devobj) # Sound define methods