Merge "minion.conf: Accept tcp_keepalive* properties"
diff --git a/README.rst b/README.rst
index e305eae..1b04a2c 100644
--- a/README.rst
+++ b/README.rst
@@ -464,8 +464,9 @@
mycluster:
domain: neco.virt.domain.com
engine: virt
- #Option to set rng globaly
+ # Cluster global settings
rng: false
+ enable_vnc: True
cloud_init:
user_data:
disable_ec2_metadata: true
@@ -490,7 +491,8 @@
image: ubuntu.qcow
size: medium
img_dest: /var/lib/libvirt/ssdimages
- #Rng defined on node will have higher priority then global one
+ # Node settings override cluster global ones
+ enable_vnc: False
rng:
backend: /dev/urandom
model: random
@@ -504,6 +506,7 @@
path: /usr/share/AAVMF/AAVMF_CODE.fd
machine: virt-2.11 # Custom per-node virt machine type
cpu_mode: host-passthrough
+ cpuset: '1-4'
mac:
nic01: AC:DE:48:AA:AA:AA
nic02: AC:DE:48:AA:AA:BB
diff --git a/_modules/virtng.py b/_modules/virtng.py
index b405d59..2c6bc9d 100644
--- a/_modules/virtng.py
+++ b/_modules/virtng.py
@@ -236,6 +236,9 @@
else:
context['boot_dev'] = ['hd']
+ if 'enable_vnc' in kwargs:
+ context['enable_vnc'] = kwargs['enable_vnc']
+ log.info('VNC enabled: {0}.'.format(kwargs['enable_vnc']))
if 'serial_type' in kwargs:
context['serial_type'] = kwargs['serial_type']
if 'serial_type' in context and context['serial_type'] == 'tcp':
@@ -534,6 +537,7 @@
loader=None,
machine=None,
cpu_mode=None,
+ cpuset=None,
**kwargs):
'''
Initialize a new vm
@@ -703,6 +707,12 @@
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
if cpu_mode:
xml_doc = minidom.parseString(xml)
cpu_xml = xml_doc.createElement("cpu")
diff --git a/salt/control/virt.sls b/salt/control/virt.sls
index 731efeb..d84199f 100644
--- a/salt/control/virt.sls
+++ b/salt/control/virt.sls
@@ -33,6 +33,13 @@
{%- set rng = cluster.rng %}
{%- endif %}
+{%- if cluster.enable_vnc is defined and cluster.enable_vnc %}
+{%- set enable_vnc = True %}
+{%- else %}
+{%- set enable_vnc = False %}
+{%- endif %}
+
+
{%- for node_name, node in cluster.node.iteritems() %}
{%- if node.name is defined %}
@@ -67,6 +74,9 @@
{%- if node.machine is defined %}
- machine: {{ node.machine }}
{%- endif %}
+ {%- if node.cpuset is defined %}
+ - cpuset: {{ node.cpuset }}
+ {%- endif %}
{%- if node.cpu_mode is defined %}
- cpu_mode: {{ node.cpu_mode }}
{%- endif %}
@@ -77,6 +87,11 @@
seed: True
serial_type: pty
console: True
+ {%- if node.enable_vnc is defined %}
+ enable_vnc: {{ node.enable_vnc }}
+ {%- else %}
+ enable_vnc: {{ enable_vnc }}
+ {%- endif %}
{%- if node.img_dest is defined %}
img_dest: {{ node.img_dest }}
{%- endif %}
diff --git a/tests/pillar/control_virt_custom.sls b/tests/pillar/control_virt_custom.sls
index 833b5a2..265d484 100644
--- a/tests/pillar/control_virt_custom.sls
+++ b/tests/pillar/control_virt_custom.sls
@@ -98,6 +98,7 @@
img_dest: /var/lib/libvirt/ssdimages
machine: virt-2.11
cpu_mode: host-passthrough
+ cpuset: '1-2'
ubuntu2:
provider: node02.domain.com
image: bubuntu.qcomw