diff --git a/daemons/ganeti-confd b/daemons/ganeti-confd index 273976920cc707d4ef8f59c1db72013b9df48b37..8cf896a0c1b6e9db252bcc981b48506f81561792 100755 --- a/daemons/ganeti-confd +++ b/daemons/ganeti-confd @@ -350,7 +350,8 @@ def ExecConfd(options, args): try: processor.Enable() except errors.ConfigurationError: - # If enabling the processor has failed, we can still go on, but confd will be disabled + # If enabling the processor has failed, we can still go on, but confd will + # be disabled logging.warning("Confd is starting in disabled mode") pass server = ConfdAsyncUDPServer(options.bind_address, options.port, processor) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 347ad21acd1fd2d4298d89f398cfe54ee7c200bb..ccf2bd7ab9683ee44115e56e1805f362eeb69e78 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2004,7 +2004,8 @@ def _WaitForSync(lu, instance, oneshot=False, unlock=False): else: rem_time = "no time estimate" lu.proc.LogInfo("- device %s: %5.2f%% done, %s" % - (instance.disks[i].iv_name, mstat.sync_percent, rem_time)) + (instance.disks[i].iv_name, mstat.sync_percent, + rem_time)) # if we're done but degraded, let's do a few small retries, to # make sure we see a stable and not transient situation; therefore @@ -6463,7 +6464,8 @@ class TLReplaceDisks(Tasklet): for dev, old_lvs, new_lvs in iv_names.itervalues(): self.lu.LogInfo("Detaching %s drbd from local storage" % dev.iv_name) - result = self.rpc.call_blockdev_removechildren(self.target_node, dev, old_lvs) + result = self.rpc.call_blockdev_removechildren(self.target_node, dev, + old_lvs) result.Raise("Can't detach drbd from local storage on node" " %s for device %s" % (self.target_node, dev.iv_name)) #dev.children = [] @@ -6489,14 +6491,16 @@ class TLReplaceDisks(Tasklet): rename_old_to_new.append((to_ren, ren_fn(to_ren, temp_suffix))) self.lu.LogInfo("Renaming the old LVs on the target node") - result = self.rpc.call_blockdev_rename(self.target_node, rename_old_to_new) + result = self.rpc.call_blockdev_rename(self.target_node, + rename_old_to_new) result.Raise("Can't rename old LVs on node %s" % self.target_node) # Now we rename the new LVs to the old LVs self.lu.LogInfo("Renaming the new LVs on the target node") rename_new_to_old = [(new, old.physical_id) for old, new in zip(old_lvs, new_lvs)] - result = self.rpc.call_blockdev_rename(self.target_node, rename_new_to_old) + result = self.rpc.call_blockdev_rename(self.target_node, + rename_new_to_old) result.Raise("Can't rename new LVs on node %s" % self.target_node) for old, new in zip(old_lvs, new_lvs): @@ -6509,11 +6513,13 @@ class TLReplaceDisks(Tasklet): # Now that the new lvs have the old name, we can add them to the device self.lu.LogInfo("Adding new mirror component on %s" % self.target_node) - result = self.rpc.call_blockdev_addchildren(self.target_node, dev, new_lvs) + result = self.rpc.call_blockdev_addchildren(self.target_node, dev, + new_lvs) msg = result.fail_msg if msg: for new_lv in new_lvs: - msg2 = self.rpc.call_blockdev_remove(self.target_node, new_lv).fail_msg + msg2 = self.rpc.call_blockdev_remove(self.target_node, + new_lv).fail_msg if msg2: self.lu.LogWarning("Can't rollback device %s: %s", dev, msg2, hint=("cleanup manually the unused logical" @@ -6581,13 +6587,15 @@ class TLReplaceDisks(Tasklet): # after this, we must manually remove the drbd minors on both the # error and the success paths self.lu.LogStep(4, steps_total, "Changing drbd configuration") - minors = self.cfg.AllocateDRBDMinor([self.new_node for dev in self.instance.disks], + minors = self.cfg.AllocateDRBDMinor([self.new_node + for dev in self.instance.disks], self.instance.name) logging.debug("Allocated minors %r" % (minors,)) iv_names = {} for idx, (dev, new_minor) in enumerate(zip(self.instance.disks, minors)): - self.lu.LogInfo("activating a new drbd on %s for disk/%d" % (self.new_node, idx)) + self.lu.LogInfo("activating a new drbd on %s for disk/%d" % + (self.new_node, idx)) # create new devices on new_node; note that we create two IDs: # one without port, so the drbd will be activated without # networking information on the new node at this stage, and one @@ -6598,8 +6606,10 @@ class TLReplaceDisks(Tasklet): else: p_minor = o_minor2 - new_alone_id = (self.instance.primary_node, self.new_node, None, p_minor, new_minor, o_secret) - new_net_id = (self.instance.primary_node, self.new_node, o_port, p_minor, new_minor, o_secret) + new_alone_id = (self.instance.primary_node, self.new_node, None, + p_minor, new_minor, o_secret) + new_net_id = (self.instance.primary_node, self.new_node, o_port, + p_minor, new_minor, o_secret) iv_names[idx] = (dev, dev.children, new_net_id) logging.debug("Allocated new_minor: %s, new_logical_id: %s", new_minor, @@ -6627,8 +6637,10 @@ class TLReplaceDisks(Tasklet): " soon as possible")) self.lu.LogInfo("Detaching primary drbds from the network (=> standalone)") - result = self.rpc.call_drbd_disconnect_net([self.instance.primary_node], self.node_secondary_ip, - self.instance.disks)[self.instance.primary_node] + result = self.rpc.call_drbd_disconnect_net([self.instance.primary_node], + self.node_secondary_ip, + self.instance.disks)\ + [self.instance.primary_node] msg = result.fail_msg if msg: @@ -6649,13 +6661,17 @@ class TLReplaceDisks(Tasklet): # and now perform the drbd attach self.lu.LogInfo("Attaching primary drbds to new secondary" " (standalone => connected)") - result = self.rpc.call_drbd_attach_net([self.instance.primary_node, self.new_node], self.node_secondary_ip, - self.instance.disks, self.instance.name, + result = self.rpc.call_drbd_attach_net([self.instance.primary_node, + self.new_node], + self.node_secondary_ip, + self.instance.disks, + self.instance.name, False) for to_node, to_result in result.items(): msg = to_result.fail_msg if msg: - self.lu.LogWarning("Can't attach drbd disks on node %s: %s", to_node, msg, + self.lu.LogWarning("Can't attach drbd disks on node %s: %s", + to_node, msg, hint=("please do a gnt-instance info to see the" " status of disks")) diff --git a/lib/confd/querylib.py b/lib/confd/querylib.py index 6975e870efaaf32aa46910fa83cf306eb9789f4f..0aaf04cd065f808ec533e7f0e3a7bdf39f7f3d4d 100644 --- a/lib/confd/querylib.py +++ b/lib/confd/querylib.py @@ -68,7 +68,8 @@ class ConfdQuery(object): class PingQuery(ConfdQuery): """An empty confd query. - It will return success on an empty argument, and an error on any other argument. + It will return success on an empty argument, and an error on any other + argument. """ def Exec(self, query): diff --git a/lib/jstore.py b/lib/jstore.py index 5c5996807e7881d8f1ead4a4bb551a6a653f6188..f12f704f642f179b0f20e9bd07fed3298b65cf61 100644 --- a/lib/jstore.py +++ b/lib/jstore.py @@ -133,8 +133,8 @@ def InitAndVerifyQueue(must_lock): raise errors.JobQueueError("Can't read/parse the job queue serial file") if not must_lock: - # There's no need for more error handling. Closing the lock file below in - # case of an error will unlock it anyway. + # There's no need for more error handling. Closing the lock file below + # in case of an error will unlock it anyway. queue_lock.Unlock() except: diff --git a/lib/ssconf.py b/lib/ssconf.py index e6b0c35b66af936ef1b17bd8c5a17d52b9540c88..56e89ec33d48367aaaf364eb2edd4607691bf59c 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -65,8 +65,8 @@ class SimpleConfigReader(object): @type force: boolean @param force: whether to force the reload without checking the mtime @rtype: boolean - @return: boolean values that says whether we reloaded the configuration or not - (because we decided it was already up-to-date) + @return: boolean value that says whether we reloaded the configuration or + not (because we decided it was already up-to-date) """ try: diff --git a/lib/storage.py b/lib/storage.py index e589dd8dbb5ea646837df67b23eb96fec51eda32..d442108fc3c69c160075f7ab9932d925ee292aa1 100644 --- a/lib/storage.py +++ b/lib/storage.py @@ -189,7 +189,8 @@ class _LvmBase(_Base): """ field_to_idx = dict([(field_name, idx) - for (idx, (field_name, _, _)) in enumerate(fields_def)]) + for (idx, (field_name, _, _)) in + enumerate(fields_def)]) lvm_fields = [] @@ -222,7 +223,8 @@ class _LvmBase(_Base): lvm_name_to_idx = dict([(lvm_name, idx) for (idx, lvm_name) in enumerate(lvm_fields)]) field_to_idx = dict([(field_name, idx) - for (idx, (field_name, _, _)) in enumerate(fields_def)]) + for (idx, (field_name, _, _)) in + enumerate(fields_def)]) data = [] for raw_data in cmd_result: diff --git a/test/ganeti.utils_unittest.py b/test/ganeti.utils_unittest.py index 5abe8a2b612cab17b2ec1be8d1acb2a4a5c41ad1..2893b8a31a5c2c9a8cc468d180fe2e8be7c0dbc0 100755 --- a/test/ganeti.utils_unittest.py +++ b/test/ganeti.utils_unittest.py @@ -879,7 +879,8 @@ class TestTimeFunctions(unittest.TestCase): self.assertEqual(utils.MergeTime((1, 500000)), 1.5) self.assertEqual(utils.MergeTime((1218448917, 500000)), 1218448917.5) - self.assertEqual(round(utils.MergeTime((1218448917, 481000)), 3), 1218448917.481) + self.assertEqual(round(utils.MergeTime((1218448917, 481000)), 3), + 1218448917.481) self.assertEqual(round(utils.MergeTime((1, 801000)), 3), 1.801) self.assertRaises(AssertionError, utils.MergeTime, (0, -1))