mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Fix typos. Code Inspection for pep8 conventions
This commit is contained in:
parent
568ff92449
commit
f3f4f0afe8
6 changed files with 37 additions and 30 deletions
|
@ -73,6 +73,7 @@ def allinstances(request):
|
|||
def instances(request, compute_id):
|
||||
"""
|
||||
:param request:
|
||||
:param compute_id
|
||||
:return:
|
||||
"""
|
||||
all_host_vms = {}
|
||||
|
@ -224,9 +225,9 @@ def instance(request, compute_id, vname):
|
|||
def get_network_tuple(network_source_str):
|
||||
network_source_pack = network_source_str.split(":", 1)
|
||||
if len(network_source_pack) > 1:
|
||||
return (network_source_pack[1], network_source_pack[0])
|
||||
return network_source_pack[1], network_source_pack[0]
|
||||
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):
|
||||
status = connection_manager.host_is_up(new_compute.type, new_compute.hostname)
|
||||
|
@ -1104,10 +1105,13 @@ def instances_actions(request):
|
|||
return HttpResponseRedirect(request.get_full_path())
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
|
||||
|
||||
@login_required
|
||||
def inst_graph(request, compute_id, vname):
|
||||
"""
|
||||
:param request:
|
||||
:param compute_id:
|
||||
:param vname:
|
||||
:return:
|
||||
"""
|
||||
json_blk = []
|
||||
|
@ -1298,7 +1302,7 @@ def delete_instance(instance, delete_disk=False):
|
|||
conn.delete()
|
||||
instance.delete()
|
||||
|
||||
print("Instance {} on compute {} sucessfully deleted".format(instance_name, compute.hostname))
|
||||
print("Instance {} on compute {} successfully deleted".format(instance_name, compute.hostname))
|
||||
|
||||
except libvirtError as lib_err:
|
||||
print("Error removing instance {} on compute {}".format(instance_name, compute.hostname))
|
||||
|
|
|
@ -61,6 +61,7 @@ def interfaces(request, compute_id):
|
|||
def interface(request, compute_id, iface):
|
||||
"""
|
||||
:param request:
|
||||
:param compute_id:
|
||||
:param iface:
|
||||
:return:
|
||||
"""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
@ -19,6 +18,7 @@ from logs.views import addlogmsg
|
|||
def nwfilters(request, compute_id):
|
||||
"""
|
||||
:param request:
|
||||
:param compute_id:
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
@ -71,7 +71,6 @@ def nwfilters(request, compute_id):
|
|||
is_conn = wvmInstances(compute.hostname, compute.login, compute.password, compute.type)
|
||||
instances = is_conn.get_instances()
|
||||
for inst in instances:
|
||||
# if in_use: break
|
||||
i_conn = wvmInstance(compute.hostname, compute.login, compute.password, compute.type, inst)
|
||||
dom_filterrefs = i_conn.get_filterrefs()
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ from libvirt import libvirtError
|
|||
def secrets(request, compute_id):
|
||||
"""
|
||||
:param request:
|
||||
:param compute_id:
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
|
|
@ -318,9 +318,9 @@ class IPint(object):
|
|||
(self._ipversion == 6 and self._prefixlen == 128):
|
||||
if self.NoPrefixForSingleIp:
|
||||
want = 0
|
||||
if want == None:
|
||||
if want is None:
|
||||
want = self.WantPrefixLen
|
||||
if want == None:
|
||||
if want is None:
|
||||
want = 1
|
||||
if want:
|
||||
if want == 2:
|
||||
|
@ -354,7 +354,7 @@ class IPint(object):
|
|||
"""
|
||||
|
||||
bits = _ipVersionToLen(self._ipversion)
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 0
|
||||
ret = _intToBin(self.ip)
|
||||
return '0' * (bits - len(ret)) + ret + self._printPrefix(wantprefixlen)
|
||||
|
@ -370,7 +370,7 @@ class IPint(object):
|
|||
'ffff:ffff:ffff:ffff:ffff:f:f:fffc/127'
|
||||
"""
|
||||
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 1
|
||||
|
||||
if self._ipversion == 4:
|
||||
|
@ -413,7 +413,7 @@ class IPint(object):
|
|||
2001:658:22a:cafe:200:0:0:1
|
||||
"""
|
||||
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 1
|
||||
|
||||
if self._ipversion == 4:
|
||||
|
@ -434,7 +434,7 @@ class IPint(object):
|
|||
2001:0658:022a:cafe:0200:0000:0000:0001
|
||||
"""
|
||||
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 1
|
||||
|
||||
return intToIp(self.ip, self._ipversion) + self._printPrefix(wantprefixlen)
|
||||
|
@ -448,7 +448,7 @@ class IPint(object):
|
|||
0x20010658022acafe0200000000000001
|
||||
"""
|
||||
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 0
|
||||
|
||||
x = '0x%x' % self.ip
|
||||
|
@ -463,7 +463,7 @@ class IPint(object):
|
|||
42540616829182469433547762482097946625
|
||||
"""
|
||||
|
||||
if self.WantPrefixLen == None and wantprefixlen == None:
|
||||
if self.WantPrefixLen is None and wantprefixlen is None:
|
||||
wantprefixlen = 0
|
||||
|
||||
x = '%d' % self.ip
|
||||
|
|
|
@ -247,7 +247,7 @@ class wvmInstance(wvmConnect):
|
|||
def get_disk_devices(self):
|
||||
def disks(doc):
|
||||
result = []
|
||||
dev = volume = storage = src_file = None
|
||||
dev = volume = storage = src_file = bus = None
|
||||
disk_format = used_size = disk_size = disk_cache = None
|
||||
|
||||
for disk in doc.xpath('/domain/devices/disk'):
|
||||
|
@ -288,7 +288,7 @@ class wvmInstance(wvmConnect):
|
|||
def get_media_devices(self):
|
||||
def disks(doc):
|
||||
result = []
|
||||
dev = volume = storage = None
|
||||
dev = volume = storage = bus = None
|
||||
src_file = None
|
||||
for media in doc.xpath('/domain/devices/disk'):
|
||||
device = media.xpath('@device')[0]
|
||||
|
@ -341,6 +341,7 @@ class wvmInstance(wvmConnect):
|
|||
|
||||
def get_bootorder(self):
|
||||
boot_order = {}
|
||||
type = target = None
|
||||
tree = ElementTree.fromstring(self._XMLDesc(0))
|
||||
os = tree.find('os')
|
||||
boot = os.findall('boot')
|
||||
|
@ -363,7 +364,7 @@ class wvmInstance(wvmConnect):
|
|||
|
||||
devices = tree.find('devices')
|
||||
for dev in devices:
|
||||
dev_target = dev_type = dev_device = dev_alias = None
|
||||
dev_target = None
|
||||
boot_dev = dev.find('boot')
|
||||
if boot_dev is not None:
|
||||
idx = boot_dev.get('order')
|
||||
|
@ -439,6 +440,7 @@ class wvmInstance(wvmConnect):
|
|||
disk.insert(2, src_media)
|
||||
return True
|
||||
|
||||
vol = None
|
||||
storages = self.get_storages(only_actives=True)
|
||||
for storage in storages:
|
||||
stg = self.get_storage(storage)
|
||||
|
|
Loading…
Reference in a new issue