LGTM, thanks On Wed, 22 Apr 2015 at 11:20 'Hrvoje Ribicic' via ganeti-devel < [email protected]> wrote:
> While we are already moving checks to _VerifyDiskModification, we might > as well do that for the one stray check. > > Signed-off-by: Hrvoje Ribicic <[email protected]> > --- > lib/cmdlib/instance_set_params.py | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/lib/cmdlib/instance_set_params.py > b/lib/cmdlib/instance_set_params.py > index e8c6409..4958a91 100644 > --- a/lib/cmdlib/instance_set_params.py > +++ b/lib/cmdlib/instance_set_params.py > @@ -212,6 +212,12 @@ class LUInstanceSetParams(LogicalUnit): > CheckSpindlesExclusiveStorage(params, excl_stor, True) > CheckDiskExtProvider(params, disk_type) > > + # Make sure we do not add syncing disks to instances with inactive > disks > + if not self.op.wait_for_sync and not self.instance.disks_active: > + raise errors.OpPrereqError("Can't %s a disk to an instance with" > + " deactivated disks and > --no-wait-for-sync" > + " given" % op, errors.ECODE_INVAL) > + > # Check disk access param (only for specific disks) > if disk_type in constants.DTS_HAVE_ACCESS: > access_type = params.get(constants.IDISK_ACCESS, > @@ -778,14 +784,6 @@ class LUInstanceSetParams(LogicalUnit): > > self.diskmod = PrepareContainerMods(self.op.disks, None) > > - if not self.op.wait_for_sync and not self.instance.disks_active: > - for mod in self.diskmod: > - if mod[0] in (constants.DDM_ADD, constants.DDM_ATTACH): > - raise errors.OpPrereqError("Can't %s a disk to an instance with" > - " deactivated disks and" > - " --no-wait-for-sync given" % mod[0], > - errors.ECODE_INVAL) > - > def _PrepareDiskMod(_, disk, params, __): > disk.name = params.get(constants.IDISK_NAME, None) > > -- > 2.2.0.rc0.207.ga3a616c > >
