def __init__(self, parent=None, json_content=None, equipment_compute_conn_policy=None): UcsSystemConfigObject.__init__(self, parent=parent) self.name = None self.descr = None self.server_sioc_connectivity = None if self._config.load_from == "live": if equipment_compute_conn_policy is not None: self.name = equipment_compute_conn_policy.name self.descr = equipment_compute_conn_policy.descr self.server_sioc_connectivity = equipment_compute_conn_policy.server_sioc_connectivity elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) self.clean_object()
def __init__(self, parent=None, json_content=None, ls_storage_sas_expander_config_policy=None): UcsSystemConfigObject.__init__(self, parent=parent) self.descr = None self.name = None self.mixed_mode = None if self._config.load_from == "live": if ls_storage_sas_expander_config_policy is not None: self.name = ls_storage_sas_expander_config_policy.name self.descr = ls_storage_sas_expander_config_policy.descr self.mixed_mode = ls_storage_sas_expander_config_policy.connection_management elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) self.clean_object()
def __init__(self, parent=None, json_content=None, firmware_chassis_pack=None): UcsSystemConfigObject.__init__(self, parent=parent) self.descr = None self.name = None self.chassis_package = None self.service_pack = None self.excluded_components = [] if self._config.load_from == "live": if firmware_chassis_pack is not None: self.name = firmware_chassis_pack.name self.descr = firmware_chassis_pack.descr self.chassis_package = firmware_chassis_pack.chassis_bundle_version self.service_pack = firmware_chassis_pack.service_pack_bundle_version if "firmwareExcludeChassisComponent" in self._parent._config.sdk_objects: for excluded in self._config.sdk_objects[ "firmwareExcludeChassisComponent"]: if self._parent._dn: if self._parent._dn + "/fw-chassis-pack-" + self.name + "/" in excluded.dn: self.excluded_components.append( excluded.chassis_component) elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) self.clean_object()
def __init__(self, parent=None, json_content=None, cpmaint_maint_policy=None): UcsSystemConfigObject.__init__(self, parent=parent) self.name = None self.descr = None if self._config.load_from == "live": if cpmaint_maint_policy is not None: self.name = cpmaint_maint_policy.name self.descr = cpmaint_maint_policy.descr elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) self.clean_object()
def __init__(self, parent=None, json_content=None, lstorage_disk_group_config_policy=None): UcsSystemConfigObject.__init__(self, parent=parent) self.name = None self.descr = None self.raid_level = None self.strip_size = None self.access_policy = None self.read_policy = None self.write_cache_policy = None self.io_policy = None self.drive_cache = None self.security = None self.manual_disk_group_configuration = [] self.number_of_drives = None self.drive_type = None self.number_of_dedicated_hot_spares = None self.number_of_global_hot_spares = None self.min_drive_size = None self.use_remaining_disks = None self.use_jbod_disks = None if self._config.load_from == "live": if lstorage_disk_group_config_policy is not None: self.name = lstorage_disk_group_config_policy.name self.descr = lstorage_disk_group_config_policy.descr self.raid_level = lstorage_disk_group_config_policy.raid_level if "lstorageVirtualDriveDef" in self._parent._config.sdk_objects: for lstorage_virtual_drive_def in self._config.sdk_objects["lstorageVirtualDriveDef"]: if self._parent._dn: if self._parent._dn + "/disk-group-config-" + self.name \ in lstorage_disk_group_config_policy.dn: self.write_cache_policy = lstorage_virtual_drive_def.write_cache_policy self.io_policy = lstorage_virtual_drive_def.io_policy self.security = lstorage_virtual_drive_def.security self.read_policy = lstorage_virtual_drive_def.read_policy self.strip_size = lstorage_virtual_drive_def.strip_size self.access_policy = lstorage_virtual_drive_def.access_policy self.drive_cache = lstorage_virtual_drive_def.drive_cache if "lstorageDiskGroupQualifier" in self._parent._config.sdk_objects: for lstorage_virtual_drive_def in self._config.sdk_objects["lstorageDiskGroupQualifier"]: if self._parent._dn: if self._parent._dn + "/disk-group-config-" + self.name in lstorage_virtual_drive_def.dn: self.drive_type = lstorage_virtual_drive_def.drive_type self.number_of_global_hot_spares = lstorage_virtual_drive_def.num_glob_hot_spares self.number_of_dedicated_hot_spares = lstorage_virtual_drive_def.num_ded_hot_spares self.use_remaining_disks = lstorage_virtual_drive_def.use_remaining_disks self.use_jbod_disks = lstorage_virtual_drive_def.use_jbod_disks self.min_drive_size = lstorage_virtual_drive_def.min_drive_size self.number_of_drives = lstorage_virtual_drive_def.num_drives elif "lstorageLocalDiskConfigRef" in self._parent._config.sdk_objects: for lstorage_virtual_drive_def in self._config.sdk_objects["lstorageLocalDiskConfigRef"]: if self._parent._dn: if self._parent._dn + "/disk-group-config-" + self.name in lstorage_virtual_drive_def.dn: drive = {} drive.update({"slot_number": lstorage_virtual_drive_def.slot_num}) drive.update({"role": lstorage_virtual_drive_def.role}) drive.update({"span_id": lstorage_virtual_drive_def.span_id}) self.manual_disk_group_configuration.append(drive) elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json(json_content=json_content): self.logger(level="error", message="Unable to get attributes from JSON content for " + self._CONFIG_NAME) # We need to set all values that are not present in the config file to None for element in self.manual_disk_group_configuration: for value in ["slot_number", "role", "span_id"]: if value not in element: element[value] = None self.clean_object()
def __init__(self, parent=None, json_content=None, lstorage_profile=None): UcsSystemConfigObject.__init__(self, parent=parent) self.name = None self.descr = None self.security_policy = [] self.local_luns = [] self.lun_sets = [] self.controller_definitions = [] if self._config.load_from == "live": if lstorage_profile is not None: self.name = lstorage_profile.name self.descr = lstorage_profile.descr if "lstorageRemote" in self._parent._config.sdk_objects: for remote_policy in self._config.sdk_objects["lstorageRemote"]: if self._parent._dn: if self._parent._dn + "/profile-" + self.name + "/" in remote_policy.dn: policy = {} policy.update({"type": "remote_policy"}) policy.update({"primary_ip_address": remote_policy.primary_server}) policy.update({"secondary_ip_address": remote_policy.secondary_server}) policy.update({"port": remote_policy.port}) policy.update({"kmip_server_public_certificate": remote_policy.server_cert}) policy.update({"deployed_key": remote_policy.deployed_security_key}) if "lstorageLogin" in self._parent._config.sdk_objects: for login in self._config.sdk_objects["lstorageLogin"]: if self._parent._dn + "/profile-" + self.name + "/" in login.dn: policy.update({"username": login.user_name}) policy.update({"password": login.password}) self.security_policy.append(policy) if "lstorageLocal" in self._parent._config.sdk_objects and not self.security_policy: for remote_policy in self._config.sdk_objects["lstorageLocal"]: if self._parent._dn: if self._parent._dn + "/profile-" + self.name + "/" in remote_policy.dn: policy = {} policy.update({"type": "local_policy"}) policy.update({"key": remote_policy.security_key}) # policy.update({"deployed_key": remote_policy.deployed_security_key}) self.security_policy.append(policy) if "lstorageDasScsiLun" in self._parent._config.sdk_objects: for lstorage_das_scsi_lun in self._config.sdk_objects["lstorageDasScsiLun"]: if self._parent._dn: if self._parent._dn + "/profile-" + self.name + "/" in lstorage_das_scsi_lun.dn: lun = {} # No difference between "name" in "Create Local LUN" and "Prepare Claim Local LUN" lun.update({"name": lstorage_das_scsi_lun.name}) lun.update({"size": lstorage_das_scsi_lun.size}) lun.update({"fractional_size": lstorage_das_scsi_lun.fractional_size}) lun.update({"auto_deploy": lstorage_das_scsi_lun.auto_deploy}) lun.update({"expand_to_available": lstorage_das_scsi_lun.expand_to_avail}) lun.update({"disk_group_policy": lstorage_das_scsi_lun.local_disk_policy_name}) self.local_luns.append(lun) if "lstorageControllerDef" in self._parent._config.sdk_objects: for lstorage_controller_def in self._config.sdk_objects["lstorageControllerDef"]: if self._parent._dn: if self._parent._dn + "/profile-" + self.name + "/" in lstorage_controller_def.dn: controller_def = {} controller_def.update({"name": lstorage_controller_def.name}) if "lstorageControllerModeConfig" in self._parent._config.sdk_objects: for lsstorage in self._config.sdk_objects["lstorageControllerModeConfig"]: if self._parent._dn + "/profile-" + self.name + "/" in lsstorage.dn: controller_def.update({"protected_configuration": lsstorage.protect_config}) controller_def.update({"raid_level": lsstorage.raid_mode}) self.controller_definitions.append(controller_def) if "lstorageLunSetConfig" in self._parent._config.sdk_objects: for lun_set_config in self._config.sdk_objects["lstorageLunSetConfig"]: if self._parent._dn: if self._parent._dn + "/profile-" + self.name + "/" in lun_set_config.dn: lun_set = {} lun_set.update({"name": lun_set_config.name}) lun_set.update({"raid_level": lun_set_config.raid_level}) lun_set.update({"disk_slot_range": lun_set_config.disk_slot_range}) if "lstorageVirtualDriveDef" in self._parent._config.sdk_objects: for lsstorage in self._config.sdk_objects["lstorageVirtualDriveDef"]: if lun_set_config.dn in lsstorage.dn: lun_set.update({"strip_size": lsstorage.strip_size}) lun_set.update({"access_policy": lsstorage.access_policy}) lun_set.update({"read_policy": lsstorage.read_policy}) lun_set.update({"write_cache_policy": lsstorage.write_cache_policy}) lun_set.update({"io_policy": lsstorage.io_policy}) lun_set.update({"drive_cache": lsstorage.drive_cache}) lun_set.update({"security": lsstorage.security}) self.lun_sets.append(lun_set) elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json(json_content=json_content): self.logger(level="error", message="Unable to get attributes from JSON content for " + self._CONFIG_NAME) # We need to set all values that are not present in the config file to None for element in self.security_policy: for value in ["primary_ip_address", "secondary_ip_address", "port", "kmip_server_public_certificate", "username", "password", "deployed_key", "type", "key"]: if value not in element: element[value] = None for element in self.local_luns: for value in ["name", "size", "fractional_size", "auto_deploy", "expand_to_available", "disk_group_policy"]: if value not in element: element[value] = None for element in self.controller_definitions: for value in ["name", "protected_configuration", "raid_level"]: if value not in element: element[value] = None for element in self.controller_definitions: for value in ["name", "disk_slot_range", "raid_level", "strip_size", "access_policy", "read_policy", "write_cache_policy", "io_policy", "drive_cache", "security"]: if value not in element: element[value] = None self.clean_object()
def __init__(self, parent=None, json_content=None, equipment_chassis_profile=None): UcsSystemConfigObject.__init__(self, parent=parent) self.descr = None self.name = None self.type = None self.disk_zoning_policy = None self.chassis_firmware_policy = None self.compute_connection_policy = None self.chassis_maintenance_policy = None self.sas_expander_configuration_policy = None self.chassis_assignment_id = None self.restrict_migration = None self.chassis_profile_template = None self.suffix_start_number = None self.number_of_instances = None if self._config.load_from == "live": if equipment_chassis_profile is not None: self.name = equipment_chassis_profile.name self.descr = equipment_chassis_profile.descr self.type = equipment_chassis_profile.type self.chassis_profile_template = equipment_chassis_profile.src_templ_name parent_template_type = None if self.chassis_profile_template: # We first try to get the CP Template object by using the operSrcTemplName attribute value if equipment_chassis_profile.oper_src_templ_name: mo_template_cp = self._device.query( mode="dn", target=equipment_chassis_profile. oper_src_templ_name) if mo_template_cp: parent_template_type = mo_template_cp.type else: # If the operSrcTemplName attribute is not set (e.g. with UCS Central), we try to find the CP # Template using a query for its name. In case it is the only object with this name, we use it filter_str = '(name, "' + self.chassis_profile_template + '", type="eq")' mo_template_cp = self._device.query( mode="classid", target="equipmentChassisProfile", filter_str=filter_str) if len(mo_template_cp) == 1: parent_template_type = mo_template_cp[0].type if parent_template_type != "updating-template": self.disk_zoning_policy = equipment_chassis_profile.disk_zoning_policy_name self.chassis_firmware_policy = equipment_chassis_profile.chassis_fw_policy_name self.compute_connection_policy = equipment_chassis_profile.compute_conn_policy_name self.chassis_maintenance_policy = equipment_chassis_profile.maint_policy_name self.sas_expander_configuration_policy = equipment_chassis_profile.sas_expander_config_policy_name if self.type == "instance": if "equipmentBinding" in self._parent._config.sdk_objects: for binding in self._config.sdk_objects[ "equipmentBinding"]: if self._parent._dn: if self._parent._dn + "/cp-" + self.name + "/" in binding.dn: if binding.chassis_dn: self.chassis_assignment_id = binding.chassis_dn.split( "-")[1] self.restrict_migration = binding.restrict_migration elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) self.clean_object()
def __init__(self, parent=None, json_content=None, lstorage_disk_zoning_policy=None): UcsSystemConfigObject.__init__(self, parent=parent) self.descr = None self.name = None self.preserve_config = None self.disks_zoned = [] if self._config.load_from == "live": if lstorage_disk_zoning_policy is not None: self.name = lstorage_disk_zoning_policy.name self.descr = lstorage_disk_zoning_policy.descr self.preserve_config = lstorage_disk_zoning_policy.preserve_config if "lstorageDiskSlot" in self._parent._config.sdk_objects: for disk_slot in self._config.sdk_objects[ "lstorageDiskSlot"]: if self._parent._dn: if self._parent._dn + "/disk-zoning-policy-" + self.name + "/" in disk_slot.dn: disk = {} disk.update({"ownership": disk_slot.ownership}) disk.update({ "drive_path": disk_slot.drive_path.lower() }) disk.update({"disk_slot": disk_slot.id}) # disk.update({"disk_slot_range_start": disk_slot.id.split("-")[0]}) # disk.update({"disk_slot_range_stop": disk_slot.id.split("-")[1]}) if "lstorageControllerRef" in self._parent._config.sdk_objects: for controller_ref in self._config.sdk_objects[ "lstorageControllerRef"]: if self._parent._dn + "/disk-zoning-policy-" + self.name + "/disk-slot-" + \ disk_slot.id + "/" in controller_ref.dn: disk.update({ "controller": controller_ref.controller_id }) disk.update({ "server": controller_ref.server_id }) self.disks_zoned.append(disk) elif self._config.load_from == "file": if json_content is not None: if not self.get_attributes_from_json( json_content=json_content): self.logger( level="error", message= "Unable to get attributes from JSON content for " + self._CONFIG_NAME) # We need to set all values that are not present in the config file to None for element in self.disks_zoned: for value in [ "server", "controller", "slot_range", "ownership", "disk_slot_range_start", "disk_slot_range_stop", "drive_path" ]: if value not in element: element[value] = None self.clean_object()