1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

console password random and empty options modified.

This commit is contained in:
catborise 2018-09-14 23:02:07 +03:00
parent b58277c621
commit 13dc4ff510
2 changed files with 7 additions and 4 deletions

View file

@ -139,7 +139,7 @@ def create_instance(request, compute_id):
try:
conn.create_instance(data['name'], data['memory'], data['vcpu'], data['host_model'],
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'])
create_instance = Instance(compute_id=compute_id, name=data['name'], uuid=uuid)
create_instance.save()

View file

@ -149,7 +149,7 @@ class wvmCreate(wvmConnect):
vol = self.get_volume_by_path(path)
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
"""
@ -236,8 +236,11 @@ class wvmCreate(wvmConnect):
xml += """<model type='virtio'/>"""
xml += """</interface>"""
if console_pass is None: console_pass = "passwd='" + util.randomPasswd() + "'"
else: console_pass = "passwd='" + console_pass + "'"
if console_pass == "random":
console_pass = "passwd='" + util.randomPasswd() + "'"
else:
if not console_pass == "":
console_pass = "passwd='" + console_pass + "'"
xml += """ <input type='mouse' bus='ps2'/>
<input type='tablet' bus='usb'/>