1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

Merge pull request #332 from Real-Gecko/master

https://github.com/retspen/webvirtcloud/issues/323#issuecomment-64998
This commit is contained in:
Anatoliy Guskov 2020-06-26 15:26:37 +03:00 committed by GitHub
commit ed7cffd073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 139 deletions

View file

@ -63,7 +63,6 @@
</div> </div>
{% include 'errors_block.html' %} {% include 'errors_block.html' %}
{% include 'messages_block.html' %}
<div class="row" id="max-width-page"> <div class="row" id="max-width-page">
<div class="container"> <div class="container">

View file

@ -113,7 +113,7 @@ def instance(request, compute_id, vname):
publickeys = UserSSHKey.objects.filter(user_id=request.user.id) publickeys = UserSSHKey.objects.filter(user_id=request.user.id)
appsettings = AppSettings.objects.all() appsettings = AppSettings.objects.all()
keymaps = settings.QEMU_KEYMAPS keymaps = settings.QEMU_KEYMAPS
console_types = appsettings.get(key="QEMU_CONSOLE_DEFAULT_TYPE").choices_as_list console_types = appsettings.get(key="QEMU_CONSOLE_DEFAULT_TYPE").choices_as_list()
console_listen_addresses = settings.QEMU_CONSOLE_LISTEN_ADDRESSES console_listen_addresses = settings.QEMU_CONSOLE_LISTEN_ADDRESSES
bottom_bar = appsettings.get(key="VIEW_INSTANCE_DETAIL_BOTTOM_BAR").value bottom_bar = appsettings.get(key="VIEW_INSTANCE_DETAIL_BOTTOM_BAR").value
try: try:
@ -166,13 +166,9 @@ def instance(request, compute_id, vname):
user_instances = UserInstance.objects.filter(user_id=request.user.id, instance__is_template=False) user_instances = UserInstance.objects.filter(user_id=request.user.id, instance__is_template=False)
instance += user_instances.count() instance += user_instances.count()
for usr_inst in user_instances: for usr_inst in user_instances:
if connection_manager.host_is_up(usr_inst.instance.compute.type, if connection_manager.host_is_up(usr_inst.instance.compute.type, usr_inst.instance.compute.hostname):
usr_inst.instance.compute.hostname): conn = wvmInstance(usr_inst.instance.compute.hostname, usr_inst.instance.compute.login,
conn = wvmInstance(usr_inst.instance.compute.hostname, usr_inst.instance.compute.password, usr_inst.instance.compute.type, usr_inst.instance.name)
usr_inst.instance.compute.login,
usr_inst.instance.compute.password,
usr_inst.instance.compute.type,
usr_inst.instance.name)
cpu += int(conn.get_vcpu()) cpu += int(conn.get_vcpu())
memory += int(conn.get_memory()) memory += int(conn.get_memory())
for disk in conn.get_disk_devices(): for disk in conn.get_disk_devices():
@ -230,17 +226,22 @@ def instance(request, compute_id, vname):
else: else:
return network_source_pack[0], 'net' return network_source_pack[0], 'net'
def migrate_instance(new_compute, instance, live=False, unsafe=False, xml_del=False, offline=False, autoconverge=False, compress=False, postcopy=False): def migrate_instance(new_compute,
instance,
live=False,
unsafe=False,
xml_del=False,
offline=False,
autoconverge=False,
compress=False,
postcopy=False):
status = connection_manager.host_is_up(new_compute.type, new_compute.hostname) status = connection_manager.host_is_up(new_compute.type, new_compute.hostname)
if not status: if not status:
return return
if new_compute == instance.compute: if new_compute == instance.compute:
return return
try: try:
conn_migrate = wvmInstances(new_compute.hostname, conn_migrate = wvmInstances(new_compute.hostname, new_compute.login, new_compute.password, new_compute.type)
new_compute.login,
new_compute.password,
new_compute.type)
conn_migrate.moveto(conn, instance.name, live, unsafe, xml_del, offline, autoconverge, compress, postcopy) conn_migrate.moveto(conn, instance.name, live, unsafe, xml_del, offline, autoconverge, compress, postcopy)
finally: finally:
@ -249,11 +250,7 @@ def instance(request, compute_id, vname):
instance.compute = new_compute instance.compute = new_compute
instance.save() instance.save()
conn_new = wvmInstance(new_compute.hostname, conn_new = wvmInstance(new_compute.hostname, new_compute.login, new_compute.password, new_compute.type, instance.name)
new_compute.login,
new_compute.password,
new_compute.type,
instance.name)
if autostart: if autostart:
conn_new.set_autostart(1) conn_new.set_autostart(1)
conn_new.close() conn_new.close()
@ -261,11 +258,7 @@ def instance(request, compute_id, vname):
addlogmsg(request.user.username, instance.name, msg) addlogmsg(request.user.username, instance.name, msg)
try: try:
conn = wvmInstance(compute.hostname, conn = wvmInstance(compute.hostname, compute.login, compute.password, compute.type, vname)
compute.login,
compute.password,
compute.type,
vname)
status = conn.get_status() status = conn.get_status()
autostart = conn.get_autostart() autostart = conn.get_autostart()
@ -331,7 +324,6 @@ def instance(request, compute_id, vname):
show_access_ssh_keys = appsettings.get(key="SHOW_ACCESS_SSH_KEYS").value show_access_ssh_keys = appsettings.get(key="SHOW_ACCESS_SSH_KEYS").value
clone_instance_auto_name = appsettings.get(key="CLONE_INSTANCE_AUTO_NAME").value clone_instance_auto_name = appsettings.get(key="CLONE_INSTANCE_AUTO_NAME").value
try: try:
instance = Instance.objects.get(compute_id=compute_id, name=vname) instance = Instance.objects.get(compute_id=compute_id, name=vname)
if instance.uuid != uuid: if instance.uuid != uuid:
@ -412,8 +404,7 @@ def instance(request, compute_id, vname):
instance.delete() instance.delete()
try: try:
del_userinstance = UserInstance.objects.filter(instance__compute_id=compute_id, del_userinstance = UserInstance.objects.filter(instance__compute_id=compute_id, instance__name=vname)
instance__name=vname)
del_userinstance.delete() del_userinstance.delete()
except UserInstance.DoesNotExist: except UserInstance.DoesNotExist:
pass pass
@ -467,8 +458,8 @@ def instance(request, compute_id, vname):
msg = _("Please shutdown down your instance and then try again") msg = _("Please shutdown down your instance and then try again")
error_messages.append(msg) error_messages.append(msg)
if 'resizevm_cpu' in request.POST and ( if 'resizevm_cpu' in request.POST and (request.user.is_superuser or request.user.is_staff
request.user.is_superuser or request.user.is_staff or userinstance.is_change): or userinstance.is_change):
new_vcpu = request.POST.get('vcpu', '') new_vcpu = request.POST.get('vcpu', '')
new_cur_vcpu = request.POST.get('cur_vcpu', '') new_cur_vcpu = request.POST.get('cur_vcpu', '')
@ -485,9 +476,8 @@ def instance(request, compute_id, vname):
messages.success(request, msg) messages.success(request, msg)
return HttpResponseRedirect(request.get_full_path() + '#resize') return HttpResponseRedirect(request.get_full_path() + '#resize')
if 'resizevm_mem' in request.POST and (request.user.is_superuser or if 'resizevm_mem' in request.POST and (request.user.is_superuser or request.user.is_staff
request.user.is_staff or or userinstance.is_change):
userinstance.is_change):
new_memory = request.POST.get('memory', '') new_memory = request.POST.get('memory', '')
new_memory_custom = request.POST.get('memory_custom', '') new_memory_custom = request.POST.get('memory_custom', '')
if new_memory_custom: if new_memory_custom:
@ -509,8 +499,8 @@ def instance(request, compute_id, vname):
messages.success(request, msg) messages.success(request, msg)
return HttpResponseRedirect(request.get_full_path() + '#resize') return HttpResponseRedirect(request.get_full_path() + '#resize')
if 'resizevm_disk' in request.POST and ( if 'resizevm_disk' in request.POST and (request.user.is_superuser or request.user.is_staff
request.user.is_superuser or request.user.is_staff or userinstance.is_change): or userinstance.is_change):
disks_new = list() disks_new = list()
for disk in disks: for disk in disks:
input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], '')) input_disk_size = filesizefstr(request.POST.get('disk_size_' + disk['dev'], ''))
@ -531,10 +521,7 @@ def instance(request, compute_id, vname):
return HttpResponseRedirect(request.get_full_path() + '#resize') return HttpResponseRedirect(request.get_full_path() + '#resize')
if 'add_new_vol' in request.POST and allow_admin_or_not_template: if 'add_new_vol' in request.POST and allow_admin_or_not_template:
conn_create = wvmCreate(compute.hostname, conn_create = wvmCreate(compute.hostname, compute.login, compute.password, compute.type)
compute.login,
compute.password,
compute.type)
storage = request.POST.get('storage', '') storage = request.POST.get('storage', '')
name = request.POST.get('name', '') name = request.POST.get('name', '')
format = request.POST.get('format', default_format) format = request.POST.get('format', default_format)
@ -544,7 +531,8 @@ def instance(request, compute_id, vname):
cache = request.POST.get('cache', default_cache) cache = request.POST.get('cache', default_cache)
target_dev = get_new_disk_dev(media, disks, bus) target_dev = get_new_disk_dev(media, disks, bus)
source = conn_create.create_volume(storage, name, size, format, meta_prealloc, default_disk_owner_uid, default_disk_owner_gid) source = conn_create.create_volume(storage, name, size, format, meta_prealloc, default_disk_owner_uid,
default_disk_owner_gid)
conn.attach_disk(target_dev, source, target_bus=bus, driver_type=format, cache_mode=cache) conn.attach_disk(target_dev, source, target_bus=bus, driver_type=format, cache_mode=cache)
msg = _(f"Attach new disk {name} ({format})") msg = _(f"Attach new disk {name} ({format})")
addlogmsg(request.user.username, instance.name, msg) addlogmsg(request.user.username, instance.name, msg)
@ -556,11 +544,7 @@ def instance(request, compute_id, vname):
bus = request.POST.get('bus', default_bus) bus = request.POST.get('bus', default_bus)
cache = request.POST.get('cache', default_cache) cache = request.POST.get('cache', default_cache)
conn_create = wvmStorage(compute.hostname, conn_create = wvmStorage(compute.hostname, compute.login, compute.password, compute.type, storage)
compute.login,
compute.password,
compute.type,
storage)
driver_type = conn_create.get_volume_type(name) driver_type = conn_create.get_volume_type(name)
path = conn_create.get_target_path() path = conn_create.get_target_path()
@ -591,17 +575,23 @@ def instance(request, compute_id, vname):
if new_bus != bus: if new_bus != bus:
conn.detach_disk(target_dev) conn.detach_disk(target_dev)
conn.attach_disk(new_target_dev, new_path, target_bus=new_bus, conn.attach_disk(new_target_dev,
driver_type=format, cache_mode=cache, new_path,
readonly=readonly, shareable=shareable, serial=serial, target_bus=new_bus,
io_mode=io, discard_mode=discard, detect_zeroes_mode=zeroes) driver_type=format,
cache_mode=cache,
readonly=readonly,
shareable=shareable,
serial=serial,
io_mode=io,
discard_mode=discard,
detect_zeroes_mode=zeroes)
else: else:
conn.edit_disk(target_dev, new_path, readonly, shareable, new_bus, serial, format, conn.edit_disk(target_dev, new_path, readonly, shareable, new_bus, serial, format, cache, io, discard,
cache, io, discard, zeroes) zeroes)
if not conn.get_status() == 5: if not conn.get_status() == 5:
messages.success(request, _("Volume changes are applied. " + messages.success(request, _("Volume changes are applied. " + "But it will be activated after shutdown"))
"But it will be activated after shutdown"))
else: else:
messages.success(request, _("Volume is changed successfully.")) messages.success(request, _("Volume is changed successfully."))
msg = _(f"Edit disk: {target_dev}") msg = _(f"Edit disk: {target_dev}")
@ -611,11 +601,7 @@ def instance(request, compute_id, vname):
if 'delete_vol' in request.POST and allow_admin_or_not_template: if 'delete_vol' in request.POST and allow_admin_or_not_template:
storage = request.POST.get('storage', '') storage = request.POST.get('storage', '')
conn_delete = wvmStorage(compute.hostname, conn_delete = wvmStorage(compute.hostname, compute.login, compute.password, compute.type, storage)
compute.login,
compute.password,
compute.type,
storage)
dev = request.POST.get('dev', '') dev = request.POST.get('dev', '')
path = request.POST.get('path', '') path = request.POST.get('path', '')
name = request.POST.get('name', '') name = request.POST.get('name', '')
@ -764,8 +750,8 @@ def instance(request, compute_id, vname):
msg = _("Set boot order") msg = _("Set boot order")
if not conn.get_status() == 5: if not conn.get_status() == 5:
messages.success(request, _("Boot menu changes applied. " + messages.success(request,
"But it will be activated after shutdown")) _("Boot menu changes applied. " + "But it will be activated after shutdown"))
else: else:
messages.success(request, _("Boot order changed successfully.")) messages.success(request, _("Boot order changed successfully."))
addlogmsg(request.user.username, instance.name, msg) addlogmsg(request.user.username, instance.name, msg)
@ -927,7 +913,8 @@ def instance(request, compute_id, vname):
if conn.get_status() == 5: if conn.get_status() == 5:
messages.success(request, _(f"{qos_dir.capitalize()} QoS is set")) messages.success(request, _(f"{qos_dir.capitalize()} QoS is set"))
else: else:
messages.success(request, messages.success(
request,
_(f"{qos_dir.capitalize()} QoS is set. Network XML is changed.") + _(f"{qos_dir.capitalize()} QoS is set. Network XML is changed.") +
_("Stop and start network to activate new config")) _("Stop and start network to activate new config"))
@ -942,7 +929,8 @@ def instance(request, compute_id, vname):
if conn.get_status() == 5: if conn.get_status() == 5:
messages.success(request, _(f"{qos_dir.capitalize()} QoS is deleted")) messages.success(request, _(f"{qos_dir.capitalize()} QoS is deleted"))
else: else:
messages.success(request, messages.success(
request,
_(f"{qos_dir.capitalize()} QoS is deleted. Network XML is changed. ") + _(f"{qos_dir.capitalize()} QoS is deleted. Network XML is changed. ") +
_("Stop and start network to activate new config.")) _("Stop and start network to activate new config."))
return HttpResponseRedirect(request.get_full_path() + '#network') return HttpResponseRedirect(request.get_full_path() + '#network')
@ -1006,8 +994,7 @@ def instance(request, compute_id, vname):
elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']): elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']):
msg = _(f"Instance name '{clone_data['name']}' contains invalid characters!") msg = _(f"Instance name '{clone_data['name']}' contains invalid characters!")
error_messages.append(msg) error_messages.append(msg)
elif not re.match(r'^([0-9A-F]{2})(:?[0-9A-F]{2}){5}$', clone_data['clone-net-mac-0'], elif not re.match(r'^([0-9A-F]{2})(:?[0-9A-F]{2}){5}$', clone_data['clone-net-mac-0'], re.IGNORECASE):
re.IGNORECASE):
msg = _(f"Instance MAC '{clone_data['clone-net-mac-0']}' invalid format!") msg = _(f"Instance MAC '{clone_data['clone-net-mac-0']}' invalid format!")
error_messages.append(msg) error_messages.append(msg)
else: else:
@ -1033,7 +1020,8 @@ def instance(request, compute_id, vname):
return HttpResponseRedirect( return HttpResponseRedirect(
reverse('instances:instance', args=[new_instance.compute.id, new_instance.name])) reverse('instances:instance', args=[new_instance.compute.id, new_instance.name]))
if 'change_options' in request.POST and (request.user.is_superuser or request.user.is_staff or userinstance.is_change): if 'change_options' in request.POST and (request.user.is_superuser or request.user.is_staff
or userinstance.is_change):
instance.is_template = request.POST.get('is_template', False) instance.is_template = request.POST.get('is_template', False)
instance.save() instance.save()
@ -1068,11 +1056,7 @@ def inst_status(request, compute_id, vname):
response['Content-Type'] = "text/javascript" response['Content-Type'] = "text/javascript"
try: try:
conn = wvmInstance(compute.hostname, conn = wvmInstance(compute.hostname, compute.login, compute.password, compute.type, vname)
compute.login,
compute.password,
compute.type,
vname)
data = json.dumps({'status': conn.get_status()}) data = json.dumps({'status': conn.get_status()})
conn.close() conn.close()
except libvirtError: except libvirtError:
@ -1082,7 +1066,6 @@ def inst_status(request, compute_id, vname):
def get_host_instances(request, comp): def get_host_instances(request, comp):
def refresh_instance_database(comp, inst_name, info): def refresh_instance_database(comp, inst_name, info):
def get_userinstances_info(instance): def get_userinstances_info(instance):
info = {} info = {}
@ -1116,17 +1099,9 @@ def get_host_instances(request, comp):
if inst_on_db.uuid != info['uuid']: if inst_on_db.uuid != info['uuid']:
inst_on_db.save() inst_on_db.save()
all_host_vms[comp["id"], all_host_vms[comp["id"], comp["name"], comp["status"], comp["cpu"], comp["mem_size"],
comp["name"],
comp["status"],
comp["cpu"],
comp["mem_size"],
comp["mem_perc"]][inst_name]['is_template'] = inst_on_db.is_template comp["mem_perc"]][inst_name]['is_template'] = inst_on_db.is_template
all_host_vms[comp["id"], all_host_vms[comp["id"], comp["name"], comp["status"], comp["cpu"], comp["mem_size"],
comp["name"],
comp["status"],
comp["cpu"],
comp["mem_size"],
comp["mem_perc"]][inst_name]['userinstances'] = get_userinstances_info(inst_on_db) comp["mem_perc"]][inst_name]['userinstances'] = get_userinstances_info(inst_on_db)
except Instance.DoesNotExist: except Instance.DoesNotExist:
inst_on_db = Instance(compute_id=comp["id"], name=inst_name, uuid=info['uuid']) inst_on_db = Instance(compute_id=comp["id"], name=inst_name, uuid=info['uuid'])
@ -1150,8 +1125,8 @@ def get_host_instances(request, comp):
"mem_size": comp_node_info[2], "mem_size": comp_node_info[2],
"mem_perc": comp_mem['percent'] "mem_perc": comp_mem['percent']
} }
all_host_vms[comp_info["id"], comp_info["name"], comp_info["status"], comp_info["cpu"], all_host_vms[comp_info["id"], comp_info["name"], comp_info["status"], comp_info["cpu"], comp_info["mem_size"],
comp_info["mem_size"], comp_info["mem_perc"]] = comp_instances comp_info["mem_perc"]] = comp_instances
for vm, info in comp_instances.items(): for vm, info in comp_instances.items():
refresh_instance_database(comp_info, vm, info) refresh_instance_database(comp_info, vm, info)
@ -1165,12 +1140,9 @@ def get_user_instances(request):
all_user_vms = {} all_user_vms = {}
user_instances = UserInstance.objects.filter(user_id=request.user.id) user_instances = UserInstance.objects.filter(user_id=request.user.id)
for usr_inst in user_instances: for usr_inst in user_instances:
if connection_manager.host_is_up(usr_inst.instance.compute.type, if connection_manager.host_is_up(usr_inst.instance.compute.type, usr_inst.instance.compute.hostname):
usr_inst.instance.compute.hostname): conn = wvmHostDetails(usr_inst.instance.compute.hostname, usr_inst.instance.compute.login,
conn = wvmHostDetails(usr_inst.instance.compute.hostname, usr_inst.instance.compute.password, usr_inst.instance.compute.type)
usr_inst.instance.compute.login,
usr_inst.instance.compute.password,
usr_inst.instance.compute.type)
all_user_vms[usr_inst] = conn.get_user_instances(usr_inst.instance.name) all_user_vms[usr_inst] = conn.get_user_instances(usr_inst.instance.name)
all_user_vms[usr_inst].update({'compute_id': usr_inst.instance.compute.id}) all_user_vms[usr_inst].update({'compute_id': usr_inst.instance.compute.id})
return all_user_vms return all_user_vms
@ -1181,10 +1153,7 @@ def instances_actions(request):
compute_id = request.POST.get('compute_id', '') compute_id = request.POST.get('compute_id', '')
instance = Instance.objects.get(compute_id=compute_id, name=name) instance = Instance.objects.get(compute_id=compute_id, name=name)
conn = wvmInstances(instance.compute.hostname, conn = wvmInstances(instance.compute.hostname, instance.compute.login, instance.compute.password, instance.compute.type)
instance.compute.login,
instance.compute.password,
instance.compute.type)
if 'poweron' in request.POST: if 'poweron' in request.POST:
if instance.is_template: if instance.is_template:
msg = _("Templates cannot be started.") msg = _("Templates cannot be started.")
@ -1217,8 +1186,7 @@ def instances_actions(request):
if 'getvvfile' in request.POST: if 'getvvfile' in request.POST:
msg = _("Send console.vv file") msg = _("Send console.vv file")
addlogmsg(request.user.username, instance.name, msg) addlogmsg(request.user.username, instance.name, msg)
response = HttpResponse(content='', content_type='application/x-virt-viewer', status=200, reason=None, response = HttpResponse(content='', content_type='application/x-virt-viewer', status=200, reason=None, charset='utf-8')
charset='utf-8')
response.writelines('[virt-viewer]\n') response.writelines('[virt-viewer]\n')
response.writelines('type=' + conn.graphics_type(name) + '\n') response.writelines('type=' + conn.graphics_type(name) + '\n')
response.writelines('host=' + conn.graphics_listen(name) + '\n') response.writelines('host=' + conn.graphics_listen(name) + '\n')
@ -1264,11 +1232,7 @@ def inst_graph(request, compute_id, vname):
response['Content-Type'] = "text/javascript" response['Content-Type'] = "text/javascript"
try: try:
conn = wvmInstance(compute.hostname, conn = wvmInstance(compute.hostname, compute.login, compute.password, compute.type, vname)
compute.login,
compute.password,
compute.type,
vname)
cpu_usage = conn.cpu_usage() cpu_usage = conn.cpu_usage()
mem_usage = conn.mem_usage() mem_usage = conn.mem_usage()
blk_usage = conn.disk_usage() blk_usage = conn.disk_usage()
@ -1282,11 +1246,13 @@ def inst_graph(request, compute_id, vname):
for net in net_usage: for net in net_usage:
json_net.append({'dev': net['dev'], 'data': [int(net['rx']) / 1048576, int(net['tx']) / 1048576]}) json_net.append({'dev': net['dev'], 'data': [int(net['rx']) / 1048576, int(net['tx']) / 1048576]})
data = json.dumps({'cpudata': int(cpu_usage['cpu']), data = json.dumps({
'cpudata': int(cpu_usage['cpu']),
'memdata': mem_usage, 'memdata': mem_usage,
'blkdata': json_blk, 'blkdata': json_blk,
'netdata': json_net, 'netdata': json_net,
'timeline': current_time}) 'timeline': current_time
})
except libvirtError: except libvirtError:
data = json.dumps({'error': 'Error 500'}) data = json.dumps({'error': 'Error 500'})
@ -1321,11 +1287,7 @@ def guess_mac_address(request, vname):
def _get_random_mac_address(): def _get_random_mac_address():
mac = '52:54:00:%02x:%02x:%02x' % ( mac = '52:54:00:%02x:%02x:%02x' % (random.randint(0x00, 0xff), random.randint(0x00, 0xff), random.randint(0x00, 0xff))
random.randint(0x00, 0xff),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff)
)
return mac return mac
@ -1379,12 +1341,7 @@ def _get_clone_disks(disks, vname=''):
new_image = get_clone_disk_name(disk, vname) new_image = get_clone_disk_name(disk, vname)
if not new_image: if not new_image:
continue continue
new_disk = { new_disk = {'dev': disk['dev'], 'storage': disk['storage'], 'image': new_image, 'format': disk['format']}
'dev': disk['dev'],
'storage': disk['storage'],
'image': new_image,
'format': disk['format']
}
clone_disks.append(new_disk) clone_disks.append(new_disk)
return clone_disks return clone_disks
@ -1417,7 +1374,8 @@ def get_hosts_status(computes):
""" """
compute_data = [] compute_data = []
for compute in computes: for compute in computes:
compute_data.append({'id': compute.id, compute_data.append({
'id': compute.id,
'name': compute.name, 'name': compute.name,
'hostname': compute.hostname, 'hostname': compute.hostname,
'status': connection_manager.host_is_up(compute.type, compute.hostname), 'status': connection_manager.host_is_up(compute.type, compute.hostname),
@ -1433,11 +1391,7 @@ def delete_instance(instance, delete_disk=False):
compute = instance.compute compute = instance.compute
instance_name = instance.name instance_name = instance.name
try: try:
conn = wvmInstance(compute.hostname, conn = wvmInstance(compute.hostname, compute.login, compute.password, compute.type, instance.name)
compute.login,
compute.password,
compute.type,
instance.name)
del_userinstance = UserInstance.objects.filter(instance=instance) del_userinstance = UserInstance.objects.filter(instance=instance)
if del_userinstance: if del_userinstance: