Coverage for drivers/ZFSSR : 63%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python # # Copyright (C) 2020 Vates SAS # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>.
'SR_PROBE', 'SR_UPDATE', 'VDI_CREATE', 'VDI_DELETE', 'VDI_ATTACH', 'VDI_DETACH', 'VDI_CLONE', 'VDI_SNAPSHOT', 'VDI_RESIZE', 'VDI_MIRROR', 'VDI_GENERATE_CONFIG', 'ATOMIC_PAUSE', 'VDI_CONFIG_CBT', 'VDI_ACTIVATE', 'VDI_DEACTIVATE', 'THIN_PROVISIONING' ]
['location', 'local ZFS directory path (required)'] ]
'name': 'Local ZFS VHD', 'description': 'SR plugin which represents disks as VHD files stored on a ZFS disk', 'vendor': 'Vates SAS', 'copyright': '(C) 2020 Vates SAS', 'driver_version': '1.0', 'required_api_version': '1.0', 'capabilities': CAPABILITIES, 'configuration': CONFIGURATION }
util.pathexists('/sys/module/zfs/initstate')
cmd = ['findmnt', '-o', 'FSTYPE', '-n', path] fs_type = util.pread2(cmd).split('\n')[0] return fs_type == 'zfs'
def handles(type):
'SRUnavailable', opterr='zfs is not installed or module is not loaded' )
'ZFSSRCreate', opterr='Cannot create SR, path is not a ZFS mountpoint' )
if not self._checkmount(): raise xs_errors.XenError( 'ZFSSRDelete', opterr='ZFS SR is not mounted or uses an invalid FS type' ) return super(ZFSSR, self).delete(sr_uuid)
if not is_zfs_path(self.remotepath): raise xs_errors.XenError( 'SRUnavailable', opterr='Invalid ZFS path' ) return super(ZFSSR, self).attach(sr_uuid)
return super(ZFSSR, self).detach(sr_uuid)
return ZFSFileVDI(self, uuid)
# Ensure _checkmount is overridden to prevent bad behaviors in FileSR. is_zfs_path(self.remotepath)
if not hasattr(self, 'xenstore_data'): self.xenstore_data = {}
self.xenstore_data['storage-type'] = ZFSSR.DRIVER_TYPE
return super(ZFSFileVDI, self).attach(sr_uuid, vdi_uuid)
SRCommand.run(ZFSSR, DRIVER_INFO) else: |