1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Migrate source code to python 3.7 and refine code style

This commit is contained in:
Gao Jiangmiao 2019-08-16 12:59:37 +08:00
parent 0e231a930d
commit a4d74a09a6
55 changed files with 192 additions and 306 deletions

View file

@ -1,4 +1,3 @@
import time
import json
from django.utils import timezone
from django.http import HttpResponse, HttpResponseRedirect
@ -44,7 +43,7 @@ def computes(request):
error_messages = []
computes = Compute.objects.filter().order_by('name')
computes_info = get_hosts_status(computes)
if request.method == 'POST':
if 'host_del' in request.POST:
compute_id = request.POST.get('host_id', '')
@ -213,13 +212,12 @@ def get_compute_disk_buses(request, compute_id, disk):
if disk == 'disk':
data['bus'] = sorted(disk_device_types)
elif disk == 'cdrom':
data['bus'] = ['ide', 'sata', 'scsi',]
data['bus'] = ['ide', 'sata', 'scsi']
elif disk == 'floppy':
data['bus'] = ['fdc',]
data['bus'] = ['fdc']
elif disk == 'lun':
data['bus'] = ['scsi',]
data['bus'] = ['scsi']
except libvirtError:
pass
return HttpResponse(json.dumps(data))