Browse Source

Merge pull request #75 from horakmar/master

Allow to enable VNC for provisioned VMs
pull/74/merge
Aleš Komárek 6 years ago
parent
commit
f625f8f1e0
No account linked to committer's email address
3 changed files with 19 additions and 2 deletions
  1. +4
    -2
      README.rst
  2. +3
    -0
      _modules/virtng.py
  3. +12
    -0
      salt/control/virt.sls

+ 4
- 2
README.rst View File

mycluster: mycluster:
domain: neco.virt.domain.com domain: neco.virt.domain.com
engine: virt engine: virt
#Option to set rng globaly
# Cluster global settings
rng: false rng: false
enable_vnc: True
cloud_init: cloud_init:
user_data: user_data:
disable_ec2_metadata: true disable_ec2_metadata: true
image: ubuntu.qcow image: ubuntu.qcow
size: medium size: medium
img_dest: /var/lib/libvirt/ssdimages 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: rng:
backend: /dev/urandom backend: /dev/urandom
model: random model: random

+ 3
- 0
_modules/virtng.py View File

else: else:
context['boot_dev'] = ['hd'] 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: if 'serial_type' in kwargs:
context['serial_type'] = kwargs['serial_type'] context['serial_type'] = kwargs['serial_type']
if 'serial_type' in context and context['serial_type'] == 'tcp': if 'serial_type' in context and context['serial_type'] == 'tcp':

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

{%- set rng = cluster.rng %} {%- set rng = cluster.rng %}
{%- endif %} {%- 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() %} {%- for node_name, node in cluster.node.iteritems() %}


{%- if node.name is defined %} {%- if node.name is defined %}
seed: True seed: True
serial_type: pty serial_type: pty
console: True 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 %} {%- if node.img_dest is defined %}
img_dest: {{ node.img_dest }} img_dest: {{ node.img_dest }}
{%- endif %} {%- endif %}

Loading…
Cancel
Save