Skip to content
Snippets Groups Projects
Commit b8925b86 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

LUInstanceSetParams: Assertion on disk template/disk changes


Disk changes aren't allowed at the same time as a disk template change.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent a2aadb34
No related branches found
No related tags found
No related merge requests found
......@@ -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" %
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment