def attach_cache_pool(self, cache_lv): lvconvert( "--type", "cache", "--cachepool", "%s/%s" % (cache_lv.vg.name, cache_lv.name), "%s/%s" % (self.vg.name, self.name), )
def create_cache_pool(self, lv_name, mode="writethrough", metadata_lv=None, **kwargs): cache_lv = self.create_volume(lv_name, **kwargs) if mode not in ["writeback", "writethrough"]: raise ValueError("invalid cache mode: %s" % mode) args = ("--type", "cache-pool", "--cachemode", mode) if metadata_lv is not None: md_args = ("--poolmetadata", "%s/%s" % (metadata_lv.vg.name, metadata_lv.name)) args = args + md_args lvconvert(*(args + ("%s/%s" % (self.name, cache_lv.name),))) return cache_lv
def create_cache_pool(self, lv_name, mode='writethrough', metadata_lv=None, **kwargs): cache_lv = self.create_volume(lv_name, **kwargs) if mode not in ['writeback', 'writethrough']: raise ValueError('invalid cache mode: %s' % mode) args = ('--yes', '--type', 'cache-pool', '--cachemode', mode) if metadata_lv is not None: md_args = ('--poolmetadata', '%s/%s' % (metadata_lv.vg.name, metadata_lv.name)) args = args + md_args lvconvert(*(args + ('%s/%s' % (self.name, cache_lv.name), ))) return cache_lv
def create_cache_pool(self, lv_name, mode='writethrough', metadata_lv=None, **kwargs): cache_lv = self.create_volume(lv_name, **kwargs) if mode not in ['writeback', 'writethrough']: raise ValueError('invalid cache mode: %s' % mode) args = ('--type', 'cache-pool', '--cachemode', mode) if metadata_lv is not None: md_args = ('--poolmetadata', '%s/%s' % (metadata_lv.vg.name, metadata_lv.name)) args = args + md_args lvconvert(*(args + ('%s/%s' % (self.name, cache_lv.name),))) return cache_lv
def attach_cache_pool(self, cache_lv): lvconvert('--type', 'cache', '--cachepool', '%s/%s' % (cache_lv.vg.name, cache_lv.name), '%s/%s' % (self.vg.name, self.name))