diff options
author | Cole Robinson <crobinso@redhat.com> | 2015-05-19 16:44:08 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2015-05-19 18:29:45 -0400 |
commit | e8e2c831bff0079ff680f5a8b3c55a4b71a29d2f (patch) | |
tree | 7beef1807e1fd38105d74f1429dd5da329de83e0 | |
parent | f33b6d27502a2a6e0c6df8220fd4081f241c33b5 (diff) | |
download | virt-manager-e8e2c831bff0079ff680f5a8b3c55a4b71a29d2f.tar.gz |
addhardware: Don't list device 'default' options
This is really only useful for building default XML internally, and
for virt-install stuff like --watchdog default. Instead just select
the 'default' value in the wizard
-rw-r--r-- | virtManager/addhardware.py | 23 | ||||
-rw-r--r-- | virtManager/details.py | 18 | ||||
-rw-r--r-- | virtinst/deviceaudio.py | 2 | ||||
-rw-r--r-- | virtinst/devicememballoon.py | 8 | ||||
-rw-r--r-- | virtinst/deviceredirdev.py | 2 | ||||
-rw-r--r-- | virtinst/devicevideo.py | 2 | ||||
-rw-r--r-- | virtinst/devicewatchdog.py | 7 |
7 files changed, 21 insertions, 41 deletions
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index 9de587b0..46521786 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -490,7 +490,7 @@ class vmmAddHardware(vmmGObjectUI): ##################### @staticmethod - def populate_video_combo(vm, combo, no_default=None): + def populate_video_combo(vm, combo): model = combo.get_model() has_spice = bool([g for g in vm.get_graphics_devices() if g.type == g.TYPE_SPICE]) @@ -505,24 +505,22 @@ class vmmAddHardware(vmmGObjectUI): # Only list QXL video option when VM has SPICE video continue - if m == tmpdev.MODEL_DEFAULT and no_default: - continue model.append([m, tmpdev.pretty_model(m)]) if len(model) > 0: combo.set_active(0) @staticmethod - def build_video_combo(vm, combo, no_default=None): + def build_video_combo(vm, combo): model = Gtk.ListStore(str, str) combo.set_model(model) uiutil.init_combo_text_column(combo, 1) combo.get_model().set_sort_column_id(1, Gtk.SortType.ASCENDING) - vmmAddHardware.populate_video_combo(vm, combo, no_default) + vmmAddHardware.populate_video_combo(vm, combo) @staticmethod - def build_sound_combo(vm, combo, no_default=False): + def build_sound_combo(vm, combo): model = Gtk.ListStore(str) combo.set_model(model) uiutil.init_combo_text_column(combo, 0) @@ -532,9 +530,6 @@ class vmmAddHardware(vmmGObjectUI): stable_soundmodels = ["ich6", "ich9", "ac97"] for m in virtinst.VirtualAudio.MODELS: - if m == virtinst.VirtualAudio.MODEL_DEFAULT and no_default: - continue - if (stable_defaults and m not in stable_soundmodels): continue @@ -543,31 +538,25 @@ class vmmAddHardware(vmmGObjectUI): combo.set_active(0) @staticmethod - def build_watchdogmodel_combo(vm, combo, no_default=False): + def build_watchdogmodel_combo(vm, combo): ignore = vm model = Gtk.ListStore(str) combo.set_model(model) uiutil.init_combo_text_column(combo, 0) - model.set_sort_column_id(0, Gtk.SortType.ASCENDING) for m in virtinst.VirtualWatchdog.MODELS: - if m == virtinst.VirtualAudio.MODEL_DEFAULT and no_default: - continue model.append([m]) if len(model) > 0: combo.set_active(0) @staticmethod - def build_watchdogaction_combo(vm, combo, no_default=False): + def build_watchdogaction_combo(vm, combo): ignore = vm model = Gtk.ListStore(str, str) combo.set_model(model) uiutil.init_combo_text_column(combo, 1) - model.set_sort_column_id(0, Gtk.SortType.ASCENDING) for m in virtinst.VirtualWatchdog.ACTIONS: - if m == virtinst.VirtualWatchdog.ACTION_DEFAULT and no_default: - continue model.append([m, virtinst.VirtualWatchdog.get_action_desc(m)]) if len(model) > 0: combo.set_active(0) diff --git a/virtManager/details.py b/virtManager/details.py index 661232de..1bf18826 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -967,8 +967,6 @@ class vmmDetails(vmmGObjectUI): txtCol.add_attribute(text, 'text', BOOT_LABEL) txtCol.add_attribute(text, 'sensitive', BOOT_ACTIVE) - no_default = not self.is_customize_dialog - try: cpu_names = caps.get_cpu_values(self.vm.get_arch()) except: @@ -1030,23 +1028,19 @@ class vmmDetails(vmmGObjectUI): # Sound model sound_dev = self.widget("sound-model") - vmmAddHardware.build_sound_combo(self.vm, sound_dev, - no_default=no_default) + vmmAddHardware.build_sound_combo(self.vm, sound_dev) # Video model combo video_dev = self.widget("video-model") - vmmAddHardware.build_video_combo(self.vm, video_dev, - no_default=no_default) + vmmAddHardware.build_video_combo(self.vm, video_dev) # Watchdog model combo combo = self.widget("watchdog-model") - vmmAddHardware.build_watchdogmodel_combo(self.vm, combo, - no_default=no_default) + vmmAddHardware.build_watchdogmodel_combo(self.vm, combo) # Watchdog action combo combo = self.widget("watchdog-action") - vmmAddHardware.build_watchdogaction_combo(self.vm, combo, - no_default=no_default) + vmmAddHardware.build_watchdogaction_combo(self.vm, combo) # Smartcard mode sc_mode = self.widget("smartcard-mode") @@ -3071,10 +3065,8 @@ class vmmDetails(vmmGObjectUI): if not vid: return - no_default = not self.is_customize_dialog vmmAddHardware.populate_video_combo(self.vm, - self.widget("video-model"), - no_default=no_default) + self.widget("video-model")) model = vid.model ram = vid.vram diff --git a/virtinst/deviceaudio.py b/virtinst/deviceaudio.py index b6a2b24d..1a95a351 100644 --- a/virtinst/deviceaudio.py +++ b/virtinst/deviceaudio.py @@ -25,7 +25,7 @@ class VirtualAudio(VirtualDevice): virtual_device_type = VirtualDevice.VIRTUAL_DEV_AUDIO MODEL_DEFAULT = "default" - MODELS = ["es1370", "sb16", "pcspk", "ac97", "ich6", "ich9", MODEL_DEFAULT] + MODELS = ["es1370", "sb16", "pcspk", "ac97", "ich6", "ich9"] model = XMLProperty("./@model", default_cb=lambda s: "es1370", diff --git a/virtinst/devicememballoon.py b/virtinst/devicememballoon.py index 78bc5953..e10fbfd8 100644 --- a/virtinst/devicememballoon.py +++ b/virtinst/devicememballoon.py @@ -25,10 +25,12 @@ from .xmlbuilder import XMLProperty class VirtualMemballoon(VirtualDevice): virtual_device_type = VirtualDevice.VIRTUAL_DEV_MEMBALLOON - MODEL_DEFAULT = "virtio" - MODELS = ["xen", "none", MODEL_DEFAULT] + MODEL_DEFAULT = "default" + MODELS = ["virtio", "xen", "none"] - model = XMLProperty("./@model", default_cb=lambda s: s.MODEL_DEFAULT) + model = XMLProperty("./@model", + default_name=MODEL_DEFAULT, + default_cb=lambda s: "virtio") VirtualMemballoon.register_type() diff --git a/virtinst/deviceredirdev.py b/virtinst/deviceredirdev.py index 5dc48e40..7f1b283a 100644 --- a/virtinst/deviceredirdev.py +++ b/virtinst/deviceredirdev.py @@ -30,7 +30,7 @@ class VirtualRedirDevice(VirtualDevice): BUSES = ["usb"] TYPE_DEFAULT = "default" - TYPES = ["tcp", "spicevmc", TYPE_DEFAULT] + TYPES = ["tcp", "spicevmc"] @staticmethod def pretty_type(typ): diff --git a/virtinst/devicevideo.py b/virtinst/devicevideo.py index 1d8ee106..308bc2e8 100644 --- a/virtinst/devicevideo.py +++ b/virtinst/devicevideo.py @@ -27,7 +27,7 @@ class VirtualVideoDevice(VirtualDevice): # Default models list MODEL_DEFAULT = "default" - MODELS = ["cirrus", "vga", "vmvga", "xen", "qxl", MODEL_DEFAULT] + MODELS = ["cirrus", "vga", "vmvga", "xen", "qxl"] @staticmethod def pretty_model(model): diff --git a/virtinst/devicewatchdog.py b/virtinst/devicewatchdog.py index 84cce645..17c3e57b 100644 --- a/virtinst/devicewatchdog.py +++ b/virtinst/devicewatchdog.py @@ -28,7 +28,7 @@ class VirtualWatchdog(VirtualDevice): MODEL_I6300 = "i6300esb" MODEL_IB700 = "ib700" MODEL_DEFAULT = "default" - MODELS = [MODEL_I6300, MODEL_IB700, MODEL_DEFAULT] + MODELS = [MODEL_I6300, MODEL_IB700] ACTION_SHUTDOWN = "shutdown" ACTION_RESET = "reset" @@ -39,8 +39,7 @@ class VirtualWatchdog(VirtualDevice): ACTION_DEFAULT = "default" ACTIONS = [ACTION_RESET, ACTION_SHUTDOWN, ACTION_POWEROFF, ACTION_PAUSE, - ACTION_NONE, ACTION_DUMP, - ACTION_DEFAULT] + ACTION_NONE, ACTION_DUMP] @staticmethod def get_action_desc(action): @@ -54,8 +53,6 @@ class VirtualWatchdog(VirtualDevice): return _("Pause the guest") if action == VirtualWatchdog.ACTION_NONE: return _("No action") - if action == VirtualWatchdog.ACTION_DEFAULT: - return _("Hypervisor default") return action _XML_PROP_ORDER = ["model", "action"] |