From b8925b86403f3a4ed22ef4011e02e06077ef6db7 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 10 Feb 2012 17:59:40 +0100 Subject: [PATCH] LUInstanceSetParams: Assertion on disk template/disk changes Disk changes aren't allowed at the same time as a disk template change. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/cmdlib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 2b341c439..51518102b 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -11932,6 +11932,7 @@ class LUInstanceSetParams(LogicalUnit): self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE def DeclareLocks(self, level): + # TODO: Acquire group lock in shared mode (disk parameters) if level == locking.LEVEL_NODE: self._LockInstancesNodes() if self.op.disk_template and self.op.remote_node: @@ -12030,6 +12031,9 @@ class LUInstanceSetParams(LogicalUnit): else: instance_os = instance.os + assert not (self.op.disk_template and self.op.disks), \ + "Can't modify disk template and apply disk changes at the same time" + if self.op.disk_template: if instance.disk_template == self.op.disk_template: raise errors.OpPrereqError("Instance already has disk template %s" % -- GitLab