mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
fix code conventions for pylint
This commit is contained in:
parent
d283e0e1b3
commit
22cb8f702a
16 changed files with 245 additions and 110 deletions
|
|
@ -128,15 +128,15 @@ def instance(request, compute_id, vname):
|
|||
if size_str == '':
|
||||
return 0
|
||||
size_str = size_str.upper().replace("B", "")
|
||||
if 'K' == size_str[-1]:
|
||||
if size_str[-1] == 'K':
|
||||
return int(float(size_str[:-1])) << 10
|
||||
elif 'M' == size_str[-1]:
|
||||
elif size_str[-1] == 'M':
|
||||
return int(float(size_str[:-1])) << 20
|
||||
elif 'G' == size_str[-1]:
|
||||
elif size_str[-1] == 'G':
|
||||
return int(float(size_str[:-1])) << 30
|
||||
elif 'T' == size_str[-1]:
|
||||
elif size_str[-1] == 'T':
|
||||
return int(float(size_str[:-1])) << 40
|
||||
elif 'P' == size_str[-1]:
|
||||
elif size_str[-1] == 'P':
|
||||
return int(float(size_str[:-1])) << 50
|
||||
else:
|
||||
return int(float(size_str))
|
||||
|
|
@ -585,9 +585,9 @@ def instance(request, compute_id, vname):
|
|||
if new_bus != bus:
|
||||
conn.detach_disk(target_dev)
|
||||
conn.attach_disk(new_target_dev, new_path, target_bus=new_bus,
|
||||
driver_type=format, cache_mode=cache,
|
||||
readonly=readonly, shareable=shareable, serial=serial,
|
||||
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:
|
||||
conn.edit_disk(target_dev, new_path, readonly, shareable, new_bus, serial, format,
|
||||
cache, io, discard, zeroes)
|
||||
|
|
@ -635,7 +635,7 @@ def instance(request, compute_id, vname):
|
|||
if 'add_cdrom' in request.POST and allow_admin_or_not_template:
|
||||
bus = request.POST.get('bus', 'ide' if machine == 'pc' else 'sata')
|
||||
target = get_new_disk_dev(media, disks, bus)
|
||||
conn.attach_disk(target, "", disk_device='cdrom', cache_mode='none', target_bus=bus, readonly=True)
|
||||
conn.attach_disk(target, "", disk_device='cdrom', cache_mode='none', target_bus=bus, readonly=True)
|
||||
msg = _('Add CD-ROM: ' + target)
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#disks')
|
||||
|
|
@ -1433,4 +1433,3 @@ def delete_instance(instance, delete_disk=False):
|
|||
except libvirtError as lib_err:
|
||||
print("Error removing instance {} on compute {}".format(instance_name, compute.hostname))
|
||||
raise lib_err
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue