add button to remove cpu feature

We could copy host CPU config by
button 'Copy host CPU configuration'.
If we regret to do this or the host CPU config
caused VM starting failure, we need a button to
help us clear CPU feature.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao
2013-12-03 10:46:47 +08:00
committed by Cole Robinson
parent 0abbb6d122
commit 10d5eb8375
2 changed files with 25 additions and 6 deletions

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Wed Dec 4 18:33:33 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
@ -1384,8 +1385,8 @@
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_security_type_changed" swapped="no"/>
<signal name="activate" handler="on_security_type_changed" swapped="no"/>
<signal name="toggled" handler="on_security_type_changed" swapped="no"/>
</object>
<packing>
<property name="x_options"/>
@ -2085,6 +2086,8 @@
<object class="GtkTable" id="table15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
@ -2105,6 +2108,7 @@
<object class="GtkHBox" id="hbox21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">20</property>
<child>
<object class="GtkAlignment" id="alignment33">
<property name="visible">True</property>
@ -2155,12 +2159,15 @@
<object class="GtkHBox" id="hbox25">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="cpu-copy-host">
<property name="label" translatable="yes">Copy host CPU configuration</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">start</property>
<property name="vexpand">False</property>
<signal name="clicked" handler="on_cpu_copy_host_clicked" swapped="no"/>
</object>
<packing>
@ -2170,12 +2177,12 @@
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment38">
<object class="GtkButton" id="cpu-clear">
<property name="label" translatable="yes">Clear CPU configuration</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_cpu_clear_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
@ -2189,6 +2196,7 @@
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>

View File

@ -455,6 +455,7 @@ class vmmDetails(vmmGObjectUI):
"on_cpu_sockets_changed": lambda *x: self.enable_apply(x, EDIT_TOPOLOGY),
"on_cpu_threads_changed": lambda *x: self.enable_apply(x, EDIT_TOPOLOGY),
"on_cpu_copy_host_clicked": self.config_cpu_copy_host,
"on_cpu_clear_clicked": self.config_cpu_clear,
"on_cpu_topology_enable_toggled": self.config_cpu_topology_enable,
"on_config_memory_changed": self.config_memory_changed,
@ -1713,6 +1714,16 @@ class vmmDetails(vmmGObjectUI):
self.err.show_err(_("Error copying host CPU: %s") % str(e))
return
def config_cpu_clear(self, src_ignore):
try:
CPU = virtinst.CPU(self.vm.conn.get_backend())
CPU.clear()
self._refresh_cpu_config(CPU)
except Exception, e:
self.err.show_err(_("Error clear CPU config: %s") % str(e))
return
def config_cpu_topology_enable(self, src):
do_enable = src.get_active()
self.widget("cpu-topology-table").set_sensitive(do_enable)