Revision 294254b1 lib/cmdlib/instance.py

b/lib/cmdlib/instance.py
49 49
  IsExclusiveStorageEnabledNode, CheckHVParams, CheckOSParams, \
50 50
  AnnotateDiskParams, GetUpdatedParams, ExpandInstanceUuidAndName, \
51 51
  ComputeIPolicySpecViolation, CheckInstanceState, ExpandNodeUuidAndName, \
52
  CheckDiskTemplateEnabled
52
  CheckDiskTemplateEnabled, IsValidDiskAccessModeCombination
53 53
from ganeti.cmdlib.instance_storage import CreateDisks, \
54 54
  CheckNodesFreeDiskPerVG, WipeDisks, WipeOrCleanupDisks, WaitForSync, \
55 55
  IsExclusiveStorageEnabledNodeUuid, CreateSingleBlockDev, ComputeDisks, \
......
1168 1168
        dsk[constants.IDISK_SIZE] = \
1169 1169
          int(float(node_disks[dsk[constants.IDISK_ADOPT]]))
1170 1170

  
1171
    # Check disk access param to be compatible with specified hypervisor
1172
    node_info = self.cfg.GetNodeInfo(self.op.pnode_uuid)
1173
    node_group = self.cfg.GetNodeGroup(node_info.group)
1174
    disk_params = self.cfg.GetGroupDiskParams(node_group)
1175
    access_type = disk_params[self.op.disk_template].get(
1176
      constants.RBD_ACCESS, constants.DISK_KERNELSPACE
1177
    )
1178

  
1179
    if not IsValidDiskAccessModeCombination(self.op.hypervisor,
1180
                                            self.op.disk_template,
1181
                                            access_type):
1182
      raise errors.OpPrereqError("Selected hypervisor (%s) cannot be"
1183
                                 " used with %s disk access param" %
1184
                                 (self.op.hypervisor, access_type),
1185
                                  errors.ECODE_STATE)
1186

  
1171 1187
    # Verify instance specs
1172 1188
    spindle_use = self.be_full.get(constants.BE_SPINDLE_USE, None)
1173 1189
    ispec = {

Also available in: Unified diff