def __init__(self, parent, image_id, image_config): """ Create a disk entry under the Disks subtree :param parent: parent object (instance of the Disks class) :param image_id: key used in the config object for this rbd image (pool.image_name) - str :param image_config: meta data for this image :return: """ self.pool, self.rbd_image = image_id.split('.', 1) UINode.__init__(self, image_id, parent) self.image_id = image_id self.logger = self.parent.logger self.size = 0 self.size_h = '' self.features = 0 self.feature_list = [] self.ceph_cluster = self.parent.parent.ceph.local_ceph.name disk_map = self.parent.disk_info if image_id not in disk_map: disk_map[image_id] = {} if image_id not in self.parent.disk_lookup: self.parent.disk_lookup[image_id] = self # set the remaining attributes based on the fields in the dict for k, v in image_config.iteritems(): disk_map[image_id][k] = v self.__setattr__(k, v) # Size/features are not stored in the config, since it can be changed # outside of this tool-chain, so we get them dynamically self.get_meta_data_tcmu()
def __init__(self, parent, gateway_name, gateway_config): """ Create the LIO element :param parent: parent object the gateway group object :param gateway_config: dict holding the fields that define the gateway :return: """ UINode.__init__(self, gateway_name, parent) for k, v in gateway_config.iteritems(): self.__setattr__(k, v) self.state = "DOWN" self.service_state = { "iscsi": { "state": "DOWN", "port": Gateway.TCP_PORT }, "api": { "state": "DOWN", "port": settings.config.api_port } } self.refresh()
def __init__(self, parent, image_id, image_config): """ Create a disk entry under the Disks subtree :param parent: parent object (instance of the Disks class) :param image_id: key used in the config object for this rbd image (pool.image_name) - str :param image_config: meta data for this image :return: """ self.pool, self.rbd_image = image_id.split('.', 1) UINode.__init__(self, image_id, parent) self.image_id = image_id self.logger = self.parent.logger self.size = 0 self.size_h = '' disk_map = self.parent.disk_info if image_id not in disk_map: disk_map[image_id] = {} # set the remaining attributes based on the fields in the dict for k, v in image_config.iteritems(): disk_map[image_id][k] = v self.__setattr__(k, v) # Size/features are not stored in the config, since it can be changed by a number # of different means, so we get them dynamically on the CLI host self.get_meta_data()
def __init__(self, parent, client_iqn, client_settings): UINode.__init__(self, client_iqn, parent) self.client_iqn = client_iqn self.parent.client_map[client_iqn] = self self.group_name = '' self.ip_address = '' self.alias = '' for k, v in client_settings.items(): self.__setattr__(k, v) # decode the chap password if necessary if 'username' in self.auth and 'password' in self.auth: self.chap = CHAP(self.auth['username'], self.auth['password'], self.auth['password_encryption_enabled']) self.auth['username'] = self.chap.user self.auth['password'] = self.chap.password else: self.auth['username'] = '' self.auth['password'] = '' # decode the chap_mutual password if necessary if 'mutual_username' in self.auth and 'mutual_password' in self.auth: self.chap_mutual = CHAP( self.auth['mutual_username'], self.auth['mutual_password'], self.auth['mutual_password_encryption_enabled']) self.auth['mutual_username'] = self.chap_mutual.user self.auth['mutual_password'] = self.chap_mutual.password else: self.auth['mutual_username'] = '' self.auth['mutual_password'] = '' self.refresh_luns()
def __init__(self, parent, client_iqn, client_settings): UINode.__init__(self, client_iqn, parent) self.client_iqn = client_iqn self.parent.client_map[client_iqn] = self self.group_name = '' self.ip_address = '' self.alias = '' for k, v in client_settings.items(): self.__setattr__(k, v) # decode the chap password if necessary if 'chap' in self.auth: self.chap = CHAP(self.auth['chap']) if self.chap.chap_str != '': self.auth['chap'] = self.chap.chap_str else: self.auth['chap'] = "None" else: self.auth['chap'] = "None" # decode the chap_mutual password if necessary if 'chap_mutual' in self.auth: self.chap_mutual = CHAP(self.auth['chap_mutual']) if self.chap_mutual.chap_str != '': self.auth['chap_mutual'] = self.chap_mutual.chap_str else: self.auth['chap_mutual'] = "None" else: self.auth['chap_mutual'] = "None" self.refresh_luns()
def __init__(self, parent, image_id, image_config, size=None, features=None, snapshots=None): """ Create a disk entry under the Disks subtree :param parent: parent object (instance of the Disks class) :param image_id: key used in the config object for this rbd image (pool/image_name) - str :param image_config: meta data for this image :return: """ self.pool, self.rbd_image = image_id.split('/', 1) UINode.__init__(self, self.rbd_image, parent) self.image_id = image_id self.size = 0 self.size_h = '' self.features = 0 self.feature_list = [] self.snapshots = [] self.backstore = image_config['backstore'] self.backstore_object_name = image_config['backstore_object_name'] self.controls = {} self.control_values = {} self.ceph_cluster = self.parent.parent.parent.ceph.cluster.name disk_map = self.parent.parent.disk_info if image_id not in disk_map: disk_map[image_id] = {} if image_id not in self.parent.parent.disk_lookup: self.parent.parent.disk_lookup[image_id] = self self._apply_config(image_config) if not size: # Size/features are not stored in the config, since it can be changed # outside of this tool-chain, so we get them dynamically self._refresh_config() else: # size and features have been passed in from the Disks.refresh # method self.exists = True self.size = size self.size_h = human_size(self.size) self.features = features self.feature_list = self._get_features() self._parse_snapshots(snapshots) # update the parent's disk info map disk_map = self.parent.parent.disk_info disk_map[self.image_id]['size'] = self.size disk_map[self.image_id]['size_h'] = self.size_h
def __init__(self, parent, image_id, image_config, size=None, features=None): """ Create a disk entry under the Disks subtree :param parent: parent object (instance of the Disks class) :param image_id: key used in the config object for this rbd image (pool.image_name) - str :param image_config: meta data for this image :return: """ self.pool, self.rbd_image = image_id.split('.', 1) UINode.__init__(self, image_id, parent) self.image_id = image_id self.size = 0 self.size_h = '' self.features = 0 self.feature_list = [] self.ceph_cluster = self.parent.parent.ceph.local_ceph.name disk_map = self.parent.disk_info if image_id not in disk_map: disk_map[image_id] = {} if image_id not in self.parent.disk_lookup: self.parent.disk_lookup[image_id] = self # set the remaining attributes based on the fields in the dict for k, v in image_config.iteritems(): disk_map[image_id][k] = v self.__setattr__(k, v) if not size: # Size/features are not stored in the config, since it can be changed # outside of this tool-chain, so we get them dynamically self.get_meta_data_tcmu() else: # size and features have been passed in from the Disks.refresh # method self.size = size self.features = features self.size_h = human_size(self.size) self.feature_list = self._get_features() # update the parent's disk info map disk_map = self.parent.disk_info disk_map[self.image_id]['size'] = self.size disk_map[self.image_id]['size_h'] = self.size_h
def __init__(self, parent, gateway_name, gateway_config): """ Create the LIO element :param parent: parent object the gateway group object :param gateway_config: dict holding the fields that define the gateway :return: """ UINode.__init__(self, gateway_name, parent) for k, v in gateway_config.iteritems(): self.__setattr__(k, v)
def __init__(self, parent, name, lun_id): self.rbd_name = name UINode.__init__(self, 'lun {}'.format(lun_id), parent) disk_group = self.parent.parent.parent.parent.parent.disks.disk_info self.owner = disk_group[name]['owner'] self.size = 0 self.lun_id = lun_id disk_map = self.parent.parent.parent.parent.parent.disks.disk_info self.size = disk_map[self.rbd_name]['size'] self.size_h = disk_map[self.rbd_name]['size_h']
def __init__(self, parent, client_iqn, client_settings): UINode.__init__(self, client_iqn, parent) self.client_iqn = client_iqn self.logger = self.parent.logger for k, v in client_settings.iteritems(): self.__setattr__(k, v) for rbd_path in self.luns.keys(): lun_id = self.luns[rbd_path]['lun_id'] MappedLun(self, rbd_path, lun_id)
def __init__(self, parent, name, lun_id): self.rbd_name = name UINode.__init__(self, 'lun {}'.format(lun_id), parent) # navigate back through the object model to pick up the disks ui_root = self.get_ui_root() disk_lookup = ui_root.disks.disk_lookup self.disk = disk_lookup[name] self.owner = self.disk.owner self.size = self.disk.size self.size_h = self.disk.size_h self.lun_id = lun_id
def __init__(self, parent, client_iqn, client_settings): UINode.__init__(self, client_iqn, parent) self.client_iqn = client_iqn self.parent.client_map[client_iqn] = self self.group_name = '' for k, v in client_settings.iteritems(): self.__setattr__(k, v) # decode the password if necessary if 'chap' in self.auth: self.chap = CHAP(self.auth['chap']) self.auth['chap'] = self.chap.chap_str self.refresh_luns()
def __init__(self, parent, client_iqn, client_settings): UINode.__init__(self, client_iqn, parent) self.client_iqn = client_iqn self.logger = self.parent.logger for k, v in client_settings.iteritems(): self.__setattr__(k, v) # decode the password if necessary if 'chap' in self.auth: self.chap = CHAP(self.auth['chap']) self.auth['chap'] = self.chap.chap_str for rbd_path in self.luns.keys(): lun_id = self.luns[rbd_path]['lun_id'] self.parent.update_lun_map('add', rbd_path, self.client_iqn) MappedLun(self, rbd_path, lun_id)
def __init__(self, parent, member_type, name): UINode.__init__(self, name, parent) self.member_type = member_type
def __init__(self, parent, name): UINode.__init__(self, name, parent) ui_root = self.get_ui_root() disk = ui_root.disks.disk_lookup[name] self.owner = disk.owner