details: Properly limit machine type list by guests arch/type

This commit is contained in:
Cole Robinson 2013-09-01 19:21:21 -04:00
parent 4c2f7377af
commit ae7ebc220b
2 changed files with 28 additions and 20 deletions

View File

@ -1372,7 +1372,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label81"> <object class="GtkLabel" id="overview-machine-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property> <property name="xalign">1</property>
@ -1388,7 +1388,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="hbox30"> <object class="GtkHBox" id="overview-machine-box">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">6</property> <property name="spacing">6</property>

View File

@ -789,29 +789,37 @@ class vmmDetails(vmmGObjectUI):
arch = self.vm.get_arch() arch = self.vm.get_arch()
caps = self.vm.conn.caps caps = self.vm.conn.caps
machines = []
if len(caps.guests) > 0: # Machine type
for guest in caps.guests: machtype_combo = self.widget("machine-type-combo")
if len(guest.domains) > 0: machtype_model = Gtk.ListStore(str)
for domain in guest.domains: machtype_combo.set_model(machtype_model)
machines = list(set(machines + domain.machines)) text = Gtk.CellRendererText()
machtype_combo.pack_start(text, True)
machtype_combo.add_attribute(text, 'text', 0)
machtype_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
if arch in ["i686", "x86_64"]: if arch in ["i686", "x86_64"]:
self.widget("label81").hide() self.widget("overview-machine-label").hide()
self.widget("hbox30").hide() self.widget("overview-machine-box").hide()
else: else:
machtype_combo = self.widget("machine-type-combo") machines = []
machtype_model = Gtk.ListStore(str)
machtype_combo.set_model(machtype_model)
text = Gtk.CellRendererText()
machtype_combo.pack_start(text, True)
machtype_combo.add_attribute(text, 'text', 0)
machtype_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
if len(machines) > 0: try:
for machine in machines: ignore, domain = caps.guest_lookup(
machtype_model.append([machine]) os_type=self.vm.get_abi_type(),
arch=self.vm.get_arch(),
typ=self.vm.get_hv_type(),
machine=self.vm.get_machtype())
machines = domain.machines[:]
except:
logging.exception("Error determining machine list")
for machine in machines:
if machine == "none":
continue
machtype_model.append([machine])
# Security info tooltips # Security info tooltips
self.widget("security-static-info").set_tooltip_text( self.widget("security-static-info").set_tooltip_text(