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.
This commit is contained in:
Cole Robinson 2013-10-02 17:30:09 -04:00
parent a2cbb9f500
commit 2218a03154
2 changed files with 2 additions and 54 deletions

View File

@ -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)

View File

@ -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