Commit c8f25d6f authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix PEP8 issues

parent e73389ce
......@@ -818,15 +818,15 @@ def create_instance(vm, nics, volumes, flavor, image):
kw['disk_template'] = volumes[0].volume_type.template
disks = []
for volume in volumes:
disk = {"name": volume.backend_volume_uuid,
"size": volume.size * 1024}
provider = volume.volume_type.provider
for vol in volumes:
disk = {"name": vol.backend_volume_uuid,
"size": vol.size * 1024}
provider = vol.volume_type.provider
if provider is not None:
disk["provider"] = provider
if provider in settings.GANETI_CLONE_PROVIDERS:
disk["origin"] = volume.origin
disk["origin_size"] = volume.origin_size
disk["origin"] = vol.origin
disk["origin_size"] = vol.origin_size
extra_disk_params = settings.GANETI_DISK_PROVIDER_KWARGS\
.get(provider)
if extra_disk_params is not None:
......
......@@ -179,7 +179,6 @@ class BackendReconciler(object):
self.log.debug("Issued OP_INSTANCE_REMOVE for orphan servers.")
def reconcile_unsynced_servers(self):
#log = self.log
for server_id in self.db_servers_keys & self.gnt_servers_keys:
db_server = self.db_servers[server_id]
gnt_server = self.gnt_servers[server_id]
......@@ -544,7 +543,6 @@ def nics_from_instance(i):
# nics = zip(ips,macs,modes,networks,links)
nics = zip(ips, names, macs, networks, indexes)
nics = map(lambda x: dict(x), nics)
#nics = dict(enumerate(nics))
tags = i["tags"]
for tag in tags:
t = tag.split(":")
......@@ -566,7 +564,6 @@ def disks_from_instance(i):
indexes = zip(itertools.repeat('index'), range(0, len(sizes)))
disks = zip(sizes, names, uuids, indexes)
disks = map(lambda x: dict(x), disks)
#disks = dict(enumerate(disks))
return disks
......
......@@ -653,7 +653,6 @@ class UpdateNetworkTest(TestCase):
"remove_reserved_ips": ["10.0.0.10",
"10.0.0.20"]})
update_network(client, msg)
#self.assertTrue(client.basic_ack.called)
pool = network.get_ip_pools()[0]
self.assertTrue(pool.is_reserved('10.0.0.10'))
self.assertTrue(pool.is_reserved('10.0.0.20'))
......
......@@ -197,8 +197,8 @@ def add_image(request):
with PlanktonBackend(request.user_uniq) as backend:
image = backend.register(name, location, params)
else:
#f = StringIO(request.body)
#image = backend.put(name, f, params)
# f = StringIO(request.body)
# image = backend.put(name, f, params)
return HttpResponse(status=501) # Not Implemented
if not image:
......@@ -255,18 +255,6 @@ def get_image(request, image_id):
* The implementation is very inefficient as it loads the whole image
in memory.
"""
#image = backend.get_image(image_id)
#if not image:
# return HttpResponseNotFound()
#
#response = _create_image_response(image)
#data = backend.get_data(image)
#response.content = data
#response['Content-Length'] = len(data)
#response['Content-Type'] = 'application/octet-stream'
#response['ETag'] = image['checksum']
#return response
return HttpResponse(status=501) # Not Implemented
......
......@@ -45,7 +45,7 @@ else:
sys.path.insert(0, GANETI_PATH)
try:
import ganeti
import ganeti # NOQA
except ImportError:
raise Exception("Cannot import ganeti module. Please check if installed"
" under %s for 2.8 or under %s for 2.10 or later." %
......@@ -207,8 +207,8 @@ class JobFileHandler(pyinotify.ProcessEvent):
self.op_handlers = {"INSTANCE": self.process_instance_op,
"NETWORK": self.process_network_op,
"CLUSTER": self.process_cluster_op,
"TAGS": self.process_tag_op}
# "GROUP": self.process_group_op}
"TAGS": self.process_tag_op}
def process_IN_CLOSE_WRITE(self, event):
self.process_IN_MOVED_TO(event)
......@@ -408,7 +408,7 @@ class JobFileHandler(pyinotify.ProcessEvent):
# NOTE: Check 'dry_run' after 'cluster' because networks and groups
# do not support the 'dry_run' option.
if (op.status == "waiting" and input.tags and
input.kind == "cluster" and input.dry_run):
input.kind == "cluster" and input.dry_run):
# Special where a prefixed cluster tag operation in dry-run
# mode is used in order to trigger eventd to send a
# heartbeat message.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment