LGTM with a small nit.

On 11/26/2015 01:36 PM, 'Lisa Velden' via ganeti-devel wrote:
As only DRBD disks can be associated to more nodes than the instance
where we want to attach the disk to, we have to check for that, too.

The commit message as is introduces one more check in addition to the existing check set.
But the patch fixes the existing check instead.

Signed-off-by: Lisa Velden <[email protected]>
---
  lib/cmdlib/instance_set_params.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cmdlib/instance_set_params.py 
b/lib/cmdlib/instance_set_params.py
index 4958a91..911203e 100644
--- a/lib/cmdlib/instance_set_params.py
+++ b/lib/cmdlib/instance_set_params.py
@@ -391,15 +391,15 @@ class LUInstanceSetParams(LogicalUnit):
disk = self.GenericGetDiskInfo(uuid, name)
      instance_template = self.cfg.GetInstanceDiskTemplate(self.instance.uuid)
-    if (disk.dev_type != instance_template or
-        instance_template == constants.DT_DISKLESS):
+    if (disk.dev_type != instance_template and
+        instance_template != constants.DT_DISKLESS):
        raise errors.OpPrereqError("Instance has '%s' template while disk has"
                                   " '%s' template" %
                                   (instance_template, disk.dev_type),
                                   errors.ECODE_INVAL)
instance_nodes = self.cfg.GetInstanceNodes(self.instance.uuid)
-    if not set(disk.nodes).issubset(set(instance_nodes)):
+    if not set(instance_nodes).issubset(set(disk.nodes)):
        raise errors.OpPrereqError("Disk nodes are %s while the instance's 
nodes"
                                   " are %s" %
                                   (disk.nodes, instance_nodes),

Reply via email to