示例#1
0
def unmount_obj(path, cid, driver):
    """ unmount the given path """

    # If using device mapper, unmount the bind-mount over the directory
    if driver == 'devicemapper':
        Mount.unmount_path(path)

    DockerMount(path).unmount(cid)
示例#2
0
        def close(self):
            try:
                logger.debug("Closing Id %s On %s" % (self.image_id, self.mount_point))
                # If using device mapper, unmount the bind-mount over the directory
                if self.driver == 'devicemapper':
                    Mount.unmount_path(self.mount_point)

                DockerMount(self.mount_point).unmount(self.cid)
            except Exception as e:
                logger.debug("exception while unmounting image or container: %s" % e)
            shutil.rmtree(self.mount_point, ignore_errors=True)
示例#3
0
        def close(self):
            try:
                logger.debug("Closing Id %s On %s" % (self.image_id, self.mount_point))
                # If using device mapper, unmount the bind-mount over the directory
                if self.driver == 'devicemapper':
                    Mount.unmount_path(self.mount_point)

                DockerMount(self.mount_point).unmount(self.cid)
            except Exception as e:
                logger.debug("exception while unmounting image or container: %s" % e)
            shutil.rmtree(self.mount_point, ignore_errors=True)
示例#4
0
def unmount_obj(path, driver):
    """ unmount the given path """

    dev = DockerMount.get_dev_at_mountpoint(path)

    # If there's a bind-mount over the directory, unbind it.
    if dev.rsplit('[', 1)[-1].strip(']') == '/rootfs' \
            and driver == 'devicemapper':
        Mount.unmount_path(path)

    DockerMount(path).unmount()
示例#5
0
def unmount_obj(path, driver):
    """ unmount the given path """

    dev = DockerMount.get_dev_at_mountpoint(path)

    # If there's a bind-mount over the directory, unbind it.
    if dev.rsplit('[', 1)[-1].strip(']') == '/rootfs' \
            and driver == 'devicemapper':
        Mount.unmount_path(path)

    DockerMount(path).unmount()
示例#6
0
def force_clean(cid, client, emu):
    """ force unmounts and removes any block devices
        to prevent memory corruption """

    driver = client.info()['Driver']

    emu.unmount(force=True)

    # unmount path
    Mount.unmount_path(emu.tmp_image_dir,force=True)

    # if device mapper, do second unmount and remove device
    if driver == 'devicemapper':
        Mount.unmount_path(emu.tmp_image_dir,force=True)
        device = client.inspect_container(cid)['GraphDriver']['Data']['DeviceName'] 
        Mount.remove_thin_device(device,force=True)