Beispiel #1
0
    def stat(self, dbg, sr):
        if not os.path.isdir(sr):
            raise xapi.storage.api.v5.volume.Sr_not_attached(sr)

        # Get the filesystem size
        statvfs = os.statvfs(sr)
        psize = statvfs.f_blocks * statvfs.f_frsize
        fsize = statvfs.f_bfree * statvfs.f_frsize
        log.debug('{}: statvfs says psize = {}'.format(dbg, psize))

        overprovision = COWVolume.get_sr_provisioned_size(
            sr, importlib.import_module('ext4-ng').Callbacks()) / psize

        meta = util.get_sr_metadata(dbg, 'file://' + sr)
        return {
            'sr': sr,
            'name': meta['name'],
            'description': meta['description'],
            'total_space': psize,
            'free_space': fsize,
            'uuid': meta['unique_id'],
            'overprovision': overprovision,
            'datasources': [],
            'clustered': True,
            'health': ['Healthy', '']
        }
Beispiel #2
0
    def stat(self, dbg, sr):
        if not os.path.isdir(sr):
            raise xapi.storage.api.v5.volume.Sr_not_attached(sr)

        devices = util.get_sr_metadata(dbg, 'file://' + sr)['devices']
        total_size = 0
        for device in map(lambda x: os.path.realpath(x), devices):
            total_size += util.get_physical_file_size(device)

        used_size = COWVolume.get_sr_provisioned_size(
            sr,
            importlib.import_module('raw-device').Callbacks())

        meta = util.get_sr_metadata(dbg, 'file://' + sr)
        return {
            'sr': sr,
            'name': meta['name'],
            'description': meta['description'],
            'total_space': total_size,
            'free_space': total_size - used_size,
            'uuid': meta['unique_id'],
            'overprovision': used_size,
            'datasources': [],
            'clustered': True,
            'health': ['Healthy', '']
        }
Beispiel #3
0
 def ls(self, dbg, sr):
     return COWVolume.ls(
         dbg, sr, importlib.import_module('ext4-ng').Callbacks())
Beispiel #4
0
 def ls(self, dbg, sr):
     return COWVolume.ls(dbg, sr, filebased.Callbacks())
Beispiel #5
0
 def ls(self, dbg, sr):
     return COWVolume.ls(dbg, sr,
                         importlib.import_module('raw-device').Callbacks())