def attach(self, context, volmap): mountpoint = mount.get_mountpoint(volmap.volume.uuid) fileutils.ensure_tree(mountpoint) filename = '/'.join([mountpoint, volmap.volume.uuid]) with open(filename, 'wb') as fd: content = utils.decode_file_data(volmap.contents) fd.write(content)
def _remove_local_file(self, volmap): mountpoint = mount.get_mountpoint(volmap.volume.uuid) shutil.rmtree(mountpoint)
def bind_mount(self, context, volmap): mountpoint = mount.get_mountpoint(volmap.volume.uuid) return mountpoint, volmap.container_path
def _unmount_device(self, volmap): if hasattr(volmap, 'connection_info'): mountpoint = mount.get_mountpoint(volmap.volume.uuid) mount.do_unmount(mountpoint) shutil.rmtree(mountpoint)
def _mount_device(self, volmap, devpath): mountpoint = mount.get_mountpoint(volmap.volume.uuid) fileutils.ensure_tree(mountpoint) mount.do_mount(devpath, mountpoint, CONF.volume.fstype)
def bind_mount(self, context, volmap): mountpoint = mount.get_mountpoint(volmap.volume.uuid) filename = '/'.join([mountpoint, volmap.volume.uuid]) return filename, volmap.container_path
def attach(self, context, volume): mountpoint = mount.get_mountpoint(volume.uuid) fileutils.ensure_tree(mountpoint) filename = '/'.join([mountpoint, volume.uuid]) with open(filename, 'wb') as fd: fd.write(volume.contents)
def bind_mount(self, volume): mountpoint = mount.get_mountpoint(volume.volume_id) return mountpoint, volume.container_path
def _unmount_device(self, volume): conn_info = jsonutils.loads(volume.connection_info) devpath = conn_info['data']['device_path'] mountpoint = mount.get_mountpoint(volume.volume_id) mount.do_unmount(devpath, mountpoint)