def __flush__(self): if self.adapter == None: raise exception.InvalidParameterValue() cmd = '%s LIST' % self.adapter ret = self._get_client().command(cmd) self._handle(ret, multi_pd=False)
def __flush__(self): if self.adapter == None or self.id == None: raise exception.InvalidParameterValue() cmd = '%s LIST| grep -w 1000 "IR volume %s"' % (self.adapter, self.id) ret = self._get_client().command(cmd) self._handle(ret, multi_vd=False)
def __flush__(self): if self.adapter == None or self.id == None: raise exception.InvalidParameterValue() cmd = '-LdInfo -L%s -a%s' % (self.id, self.adapter) ret = self._get_client().command(cmd) self._handle(ret, multi_vd=False)
def __flush__(self): if self.id == None: raise exception.InvalidParameterValue() cmd = '%s DISPLAY' % self.id ret = self._get_client().command(cmd) return self._handle(ret, multi_adapter=False)
def __flush__(self): if self.enclosure == None or self.slot == None or self.adapter == None: raise exception.InvalidParameterValue() cmd = '-PdInfo -PhysDrv [%s:%s] -a%s' % (self.enclosure, self.slot, self.adapter) ret = self._get_client().command(cmd) self._handle(ret, multi_pd=True)
def getall_virtual_drivers(self): """ Get all virtual drivers :return: """ if self.adapter == None: raise exception.InvalidParameterValue() cmd = '%s LIST' % self.adapter ret = self._get_client().command(cmd) return self._handle(ret, multi_vd=True)
def validate_raid_schema(raid_config): """Validates the RAID configuration provided. This method validates the RAID configuration provided against a JSON schema. :param raid_config: The RAID configuration to be validated. :raises: InvalidInputError, if validation of the input fails. """ raid_schema_fobj = open(RAID_CONFIG_SCHEMA, 'r') raid_config_schema = json.load(raid_schema_fobj) try: jsonschema.validate(raid_config, raid_config_schema) except json_schema_exc.ValidationError as e: # NOTE: Even though e.message is deprecated in general, it is said # in jsonschema documentation to use this still. msg = "RAID config validation error: %s" % e.message raise exception.InvalidParameterValue(msg) for logical_disk in raid_config['logical_disks']: # If user has provided 'number_of_physical_disks' or # 'physical_disks', validate that they have mentioned at least # minimum number of physical disks required for that RAID level. raid_level = logical_disk['raid_level'] min_disks_reqd = mega.RAID_LEVEL_MIN_DISKS[raid_level] no_of_disks_specified = None if 'number_of_physical_disks' in logical_disk: no_of_disks_specified = logical_disk['number_of_physical_disks'] elif 'physical_disks' in logical_disk: no_of_disks_specified = len(logical_disk['physical_disks']) if (no_of_disks_specified and no_of_disks_specified < min_disks_reqd): msg = ("RAID level %(raid_level)s requires at least %(number)s " "disks." % { 'raid_level': raid_level, 'number': min_disks_reqd }) raise exception.InvalidParameterValue(msg)