mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
commit
2890480700
@ -251,6 +251,11 @@ def _gen_xml(name,
|
||||
# TODO: make bus and model parameterized, this works for 64-bit Linux
|
||||
context['controller_model'] = 'lsilogic'
|
||||
|
||||
if kwargs.get('enable_vnc', True):
|
||||
context['enable_vnc'] = True
|
||||
else:
|
||||
context['enable_vnc'] = False
|
||||
|
||||
if 'boot_dev' in kwargs:
|
||||
context['boot_dev'] = []
|
||||
for dev in kwargs['boot_dev'].split():
|
||||
@ -556,6 +561,7 @@ def init(name,
|
||||
pub_key=None,
|
||||
priv_key=None,
|
||||
seed_cmd='seed.apply',
|
||||
enable_vnc=False,
|
||||
**kwargs):
|
||||
'''
|
||||
Initialize a new vm
|
||||
@ -651,6 +657,7 @@ def init(name,
|
||||
define_vol_xml_str(xml)
|
||||
|
||||
log.debug('Generating VM XML')
|
||||
kwargs['enable_vnc'] = enable_vnc
|
||||
xml = _gen_xml(name, cpu, mem, diskp, nicp, hypervisor, **kwargs)
|
||||
try:
|
||||
define_xml_str(xml)
|
||||
@ -901,7 +908,7 @@ def get_graphics(vm_):
|
||||
'keymap': 'None',
|
||||
'listen': 'None',
|
||||
'port': 'None',
|
||||
'type': 'vnc'}
|
||||
'type': 'None'}
|
||||
xml = get_xml(vm_)
|
||||
ssock = _StringIO(xml)
|
||||
doc = minidom.parse(ssock)
|
||||
|
@ -213,7 +213,8 @@ def init(
|
||||
install=True,
|
||||
start=True,
|
||||
disk='default',
|
||||
saltenv='base'):
|
||||
saltenv='base',
|
||||
enable_vnc=False):
|
||||
'''
|
||||
This routine is used to create a new virtual machine. This routines takes
|
||||
a number of options to determine what the newly created virtual machine
|
||||
@ -322,6 +323,7 @@ def init(
|
||||
install,
|
||||
pub_key,
|
||||
priv_key,
|
||||
enable_vnc,
|
||||
],
|
||||
timeout=600)
|
||||
except SaltClientError as client_error:
|
||||
|
@ -33,9 +33,9 @@
|
||||
<model type='{{ nic.model }}'/>
|
||||
</interface>
|
||||
{% endfor %}
|
||||
|
||||
{% if enable_vnc %}
|
||||
<graphics type='vnc' listen='0.0.0.0' autoport='yes' />
|
||||
|
||||
{% endif %}
|
||||
{% if serial_type == 'pty' %}
|
||||
<serial type='pty'>
|
||||
<target port='0'/>
|
||||
|
Loading…
Reference in New Issue
Block a user