Browse Source

add support for cpuset

Related PROD-23040 (PROD:23040)

Change-Id: I6cf2cb5ff66dcffb1532343a58416fb242703322
pull/75/head
Pavel Cizinsky 6 years ago
parent
commit
f03c4e8227
4 changed files with 12 additions and 0 deletions
  1. +1
    -0
      README.rst
  2. +7
    -0
      _modules/virtng.py
  3. +3
    -0
      salt/control/virt.sls
  4. +1
    -0
      tests/pillar/control_virt_custom.sls

+ 1
- 0
README.rst View File

path: /usr/share/AAVMF/AAVMF_CODE.fd path: /usr/share/AAVMF/AAVMF_CODE.fd
machine: virt-2.11 # Custom per-node virt machine type machine: virt-2.11 # Custom per-node virt machine type
cpu_mode: host-passthrough cpu_mode: host-passthrough
cpuset: '1-4'
mac: mac:
nic01: AC:DE:48:AA:AA:AA nic01: AC:DE:48:AA:AA:AA
nic02: AC:DE:48:AA:AA:BB nic02: AC:DE:48:AA:AA:BB

+ 7
- 0
_modules/virtng.py View File

loader=None, loader=None,
machine=None, machine=None,
cpu_mode=None, cpu_mode=None,
cpuset=None,
**kwargs): **kwargs):
''' '''
Initialize a new vm Initialize a new vm
xml_doc.getElementsByTagName("domain")[0].getElementsByTagName("devices")[0].appendChild(iso_xml) xml_doc.getElementsByTagName("domain")[0].getElementsByTagName("devices")[0].appendChild(iso_xml)
xml = xml_doc.toxml() xml = xml_doc.toxml()


# TODO: Remove this code and refactor module, when salt-common would have updated libvirt_domain.jinja template
if cpuset:
xml_doc = minidom.parseString(xml)
xml_doc.getElementsByTagName("vcpu")[0].setAttribute('cpuset', cpuset)
xml = xml_doc.toxml()

# TODO: Remove this code and refactor module, when salt-common would have updated libvirt_domain.jinja template # TODO: Remove this code and refactor module, when salt-common would have updated libvirt_domain.jinja template
if cpu_mode: if cpu_mode:
xml_doc = minidom.parseString(xml) xml_doc = minidom.parseString(xml)

+ 3
- 0
salt/control/virt.sls View File

{%- if node.machine is defined %} {%- if node.machine is defined %}
- machine: {{ node.machine }} - machine: {{ node.machine }}
{%- endif %} {%- endif %}
{%- if node.cpuset is defined %}
- cpuset: {{ node.cpuset }}
{%- endif %}
{%- if node.cpu_mode is defined %} {%- if node.cpu_mode is defined %}
- cpu_mode: {{ node.cpu_mode }} - cpu_mode: {{ node.cpu_mode }}
{%- endif %} {%- endif %}

+ 1
- 0
tests/pillar/control_virt_custom.sls View File

img_dest: /var/lib/libvirt/ssdimages img_dest: /var/lib/libvirt/ssdimages
machine: virt-2.11 machine: virt-2.11
cpu_mode: host-passthrough cpu_mode: host-passthrough
cpuset: '1-2'
ubuntu2: ubuntu2:
provider: node02.domain.com provider: node02.domain.com
image: bubuntu.qcomw image: bubuntu.qcomw

Loading…
Cancel
Save