Hi,

we tried adding new disks to running instances with the wait_for_sync
option set
to False and the job failed with OpPrereqError("Can't add a disk to an
instance with activated disks and  --no-wait-for-sync given.").

Commit 3c26084 deactivates disks which are added to instances with
instance.disks_active=False. However, it also forbids using
wait_for_sync=False
when adding new disks to instances with activated disks (e.g. running
instances).

This doesn't seem consistent with the corresponding 'gnt-instance add
--no-wait-for-sync' command. Is this the intended behavior?

If not, is the following fix ok?

diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index 480198d..3cf674d 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -2819,14 +2819,6 @@ class LUInstanceSetParams(LogicalUnit):
                                       constants.DT_EXT),
                                      errors.ECODE_INVAL)
 
-    if not self.op.wait_for_sync and self.instance.disks_active:
-      for mod in self.diskmod:
-        if mod[0] == constants.DDM_ADD:
-          raise errors.OpPrereqError("Can't add a disk to an instance with"
-                                     " activated disks and"
-                                     " --no-wait-for-sync given.",
-                                     errors.ECODE_INVAL)
-
     if self.op.disks and self.instance.disk_template ==
constants.DT_DISKLESS:
       raise errors.OpPrereqError("Disk operations not supported for"
                                  " diskless instances", errors.ECODE_INVAL)

Thanks,
Stratos

-- 
Stratos Psomadakis
<[email protected]>


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to