Example #1
0
 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),
     )
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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
Example #5
0
 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))
Example #6
0
 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))