mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
details: cpuset: Add option to auto-configure cpuset based on host NUMA
We use the recently exported --cpuset=auto logic from virt-install.
This commit is contained in:
parent
e8c8c06c32
commit
f33020b3f7
@ -248,6 +248,8 @@ class vmmDetails(gobject.GObject):
|
||||
"on_security_model_changed": self.security_model_changed,
|
||||
|
||||
"on_config_vcpus_changed": self.config_vcpus_changed,
|
||||
"on_config_vcpupin_changed": self.config_vcpus_changed,
|
||||
"on_config_vcpupin_generate_clicked": self.config_vcpupin_generate,
|
||||
|
||||
"on_config_memory_changed": self.config_memory_changed,
|
||||
"on_config_maxmem_changed": self.config_maxmem_changed,
|
||||
@ -502,6 +504,15 @@ class vmmDetails(gobject.GObject):
|
||||
_("The dynamic SELinux security type tells libvirt to automatically pick a unique label for the guest process and guest image, ensuring total isolation of the guest. (Default)"))
|
||||
|
||||
# VCPU Pinning list
|
||||
generate_cpuset = self.window.get_widget("config-vcpupin-generate")
|
||||
generate_warn = self.window.get_widget("config-vcpupin-generate-err")
|
||||
if not self.conn.get_capabilities().host.topology:
|
||||
generate_cpuset.set_sensitive(False)
|
||||
generate_warn.show()
|
||||
util.tooltip_wrapper(generate_warn,
|
||||
_("Libvirt did not detect NUMA capabilities."))
|
||||
|
||||
|
||||
# [ VCPU #, Currently running on Phys CPU #, CPU Pinning list ]
|
||||
vcpu_list = self.window.get_widget("config-vcpu-list")
|
||||
vcpu_model = gtk.ListStore(str, str, str)
|
||||
@ -733,7 +744,7 @@ class vmmDetails(gobject.GObject):
|
||||
|
||||
self.window.get_widget("config-remove").set_sensitive(True)
|
||||
self.window.get_widget("hw-panel").set_sensitive(True)
|
||||
self.window.get_widget("hw-panel").show_all()
|
||||
self.window.get_widget("hw-panel").show()
|
||||
|
||||
try:
|
||||
if pagetype == HW_LIST_TYPE_GENERAL:
|
||||
@ -1119,7 +1130,21 @@ class vmmDetails(gobject.GObject):
|
||||
maxadj.value = mem
|
||||
maxadj.lower = mem
|
||||
|
||||
def generate_cpuset(self):
|
||||
mem = int(self.vm.get_memory()) / 1024 / 1024
|
||||
return virtinst.Guest.generate_cpuset(self.conn.vmm, mem)
|
||||
|
||||
# VCPUS
|
||||
def config_vcpupin_generate(self, ignore):
|
||||
try:
|
||||
pinstr = self.generate_cpuset()
|
||||
except Exception, e:
|
||||
return self.err.val_err(
|
||||
_("Error generating CPU configuration: %s") % str(e))
|
||||
|
||||
self.window.get_widget("config-vcpupin").set_text("")
|
||||
self.window.get_widget("config-vcpupin").set_text(pinstr)
|
||||
|
||||
def config_vcpus_changed(self, ignore):
|
||||
conn = self.vm.get_connection()
|
||||
host_active_count = conn.host_active_processor_count()
|
||||
|
@ -2059,11 +2059,14 @@ I/O:</property>
|
||||
<widget class="GtkVBox" id="vbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox9">
|
||||
<widget class="GtkTable" id="table9">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label336">
|
||||
<property name="visible">True</property>
|
||||
@ -2073,34 +2076,99 @@ I/O:</property>
|
||||
<property name="mnemonic_widget">config-vcpupin</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="config-vcpupin">
|
||||
<widget class="GtkAlignment" id="alignment24">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<accessibility>
|
||||
<atkproperty name="AtkObject::accessible-name" translatable="yes">Virtual CPU Affinity Select</atkproperty>
|
||||
</accessibility>
|
||||
<signal name="changed" handler="on_config_vcpus_changed"/>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label23">
|
||||
<widget class="GtkHBox" id="hbox16">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"><span size='small'>(ex: 0,1,3-5,7)</span></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="config-vcpupin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<accessibility>
|
||||
<atkproperty name="AtkObject::accessible-name" translatable="yes">Virtual CPU Affinity Select</atkproperty>
|
||||
</accessibility>
|
||||
<signal name="changed" handler="on_config_vcpupin_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label23">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"><span size='small'>(ex: 0,1,3-5,7)</span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox9">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="config-vcpupin-generate">
|
||||
<property name="label" translatable="yes">Generate from host _NUMA configuration</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_config_vcpupin_generate_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment25">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="config-vcpupin-generate-err">
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<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>
|
||||
</widget>
|
||||
@ -2110,17 +2178,40 @@ I/O:</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<widget class="GtkVBox" id="vbox11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="config-vcpu-list">
|
||||
<widget class="GtkLabel" id="label29">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">R_untime pinning:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">config-vcpu-list</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="config-vcpu-list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
Loading…
Reference in New Issue
Block a user