def __init__(self, sr_uuid, sr_type='local_gpfs', name_label='local_gpfs', name_description='Traditional Local Storage Repo', other_config={'location':'/local_gpfs', 'auto-scan':'False'}, content_type='vhd', shared=False, sm_config={}): XendGpfsStorageRepo.__init__(self, sr_uuid, sr_type, name_label, name_description) #log.debug(self.lock) #log.debug(self.uuid) self.type = sr_type self.name_label = name_label self.name_description = name_description self.other_config = other_config self.content_type = content_type self.shared = shared self.sm_config = sm_config self.location = other_config.get('location') encode_passwd = other_config.get('password') self.passwd = encoding.ansi_decode(encode_passwd) auto = other_config.get('auto-scan', False) self.gpfs_name = self._get_gpfs_location(self.location) self.state = XendStateStore(xendoptions().get_xend_state_path() + '/local_sr/%s' % self.uuid) stored_images = self.state.load_state('vdi') images_path = {} if stored_images: for image_uuid, image in stored_images.items(): images_path[image['location'].replace(VDI_TYPE, '')] = image_uuid self.images[image_uuid] = XendGpfsVDI(image)
def __init__(self, sr_uuid, sr_type, name_label, name_description, physical_size, other_config, content_type, shared, sm_config): """ @ivar images: mapping of all the images. @type images: dictionary by image uuid. @ivar lock: lock to provide thread safety. """ XendStorageRepository.__init__(self, sr_uuid, sr_type, name_label, name_description) #log.debug(self.lock) #log.debug(self.uuid) self.type = sr_type self.name_label = name_label self.name_description = name_description self.other_config = other_config self.content_type = content_type self.shared = shared self.sm_config = sm_config # location = other_config.get('location') encode_passwd = other_config.get('password') self.passwd = encoding.ansi_decode(encode_passwd) auto = other_config.get('auto-scan', True) # local = location.split(':')[1] # if cmp(int(storage_max())*KB, physical_size) > 0: # self.physical_size = physical_size # else: location = self.other_config.get('location') self.local_sr_dir = location self.location = location self.mount_point = self._get_mount_point(self.location) # s_max = storage_max(self.local_sr_dir) # if s_max: # self.physical_size = int(s_max)*KB # else: # self.physical_size = 0 # s_util = storage_util(self.local_sr_dir) # if s_util: # self.physical_utilisation = int(s_util)*KB # else: # self.physical_utilisation = 0 # d_util = dir_util(self.local_sr_dir) # if d_util: # self.virtual_allocation = int(d_util)*KB # else: # self.virtual_allocation = 0 self.state = XendStateStore(xendoptions().get_xend_state_path() + '/gpfs_iso_sr/%s' % self.uuid) stored_images = self.state.load_state('vdi') images_path = {} if stored_images: for image_uuid, image in stored_images.items(): images_path[image['location'].replace(VDI_TYPE, '')] = image_uuid self.images[image_uuid] = XendLocalVDI(image)