mirror of
https://github.com/retspen/webvirtcloud
synced 2025-01-12 08:25:18 +00:00
console password random and empty options modified.
This commit is contained in:
parent
b58277c621
commit
13dc4ff510
2 changed files with 7 additions and 4 deletions
|
@ -139,7 +139,7 @@ def create_instance(request, compute_id):
|
||||||
try:
|
try:
|
||||||
conn.create_instance(data['name'], data['memory'], data['vcpu'], data['host_model'],
|
conn.create_instance(data['name'], data['memory'], data['vcpu'], data['host_model'],
|
||||||
uuid, volumes, data['cache_mode'], data['networks'], data['virtio'],
|
uuid, volumes, data['cache_mode'], data['networks'], data['virtio'],
|
||||||
data["console_pass"], data["listener_addr"], None, data["video"],
|
data["listener_addr"], None, data["video"], data["console_pass"],
|
||||||
data['mac'])
|
data['mac'])
|
||||||
create_instance = Instance(compute_id=compute_id, name=data['name'], uuid=uuid)
|
create_instance = Instance(compute_id=compute_id, name=data['name'], uuid=uuid)
|
||||||
create_instance.save()
|
create_instance.save()
|
||||||
|
|
|
@ -149,7 +149,7 @@ class wvmCreate(wvmConnect):
|
||||||
vol = self.get_volume_by_path(path)
|
vol = self.get_volume_by_path(path)
|
||||||
vol.delete()
|
vol.delete()
|
||||||
|
|
||||||
def create_instance(self, name, memory, vcpu, host_model, uuid, images, cache_mode, networks, virtio, console_pass, listen_addr, nwfilter=None, video="cirrus", mac=None ):
|
def create_instance(self, name, memory, vcpu, host_model, uuid, images, cache_mode, networks, virtio, listen_addr, nwfilter=None, video="cirrus", console_pass="random", mac=None):
|
||||||
"""
|
"""
|
||||||
Create VM function
|
Create VM function
|
||||||
"""
|
"""
|
||||||
|
@ -236,8 +236,11 @@ class wvmCreate(wvmConnect):
|
||||||
xml += """<model type='virtio'/>"""
|
xml += """<model type='virtio'/>"""
|
||||||
xml += """</interface>"""
|
xml += """</interface>"""
|
||||||
|
|
||||||
if console_pass is None: console_pass = "passwd='" + util.randomPasswd() + "'"
|
if console_pass == "random":
|
||||||
else: console_pass = "passwd='" + console_pass + "'"
|
console_pass = "passwd='" + util.randomPasswd() + "'"
|
||||||
|
else:
|
||||||
|
if not console_pass == "":
|
||||||
|
console_pass = "passwd='" + console_pass + "'"
|
||||||
|
|
||||||
xml += """ <input type='mouse' bus='ps2'/>
|
xml += """ <input type='mouse' bus='ps2'/>
|
||||||
<input type='tablet' bus='usb'/>
|
<input type='tablet' bus='usb'/>
|
||||||
|
|
Loading…
Reference in a new issue