# Path: virtman/utils/commands.py
# def execute(*cmd, **kwargs):
# def unlink(path):
# def link(src, dst):
# 
# Path: virtman/drivers/dmsetup.py
# class DmExecutor(dmsetup.Dmsetup):
#     def __init__(self):
# def remove_table(name):
# def reload_table(name, table):
# def multipath(name, disks):
# def reload_multipath(name, disks):
# def origin(origin_name, origin_dev):
# def snapshot(origin_path, snapshot_name, snapshot_dev):
# 
# Path: virtman/blockservice.py
# LOG = logging.getLogger(__name__)
# def findloop():
# def try_linkloop(loop_dev):
# def is_looped(loop_dev):
# def linkloop(loop_dev, path):
# def unlinkloop(loop_dev):
# 
# Path: virtman/drivers/connector.py
# class ISCSIExecutor(ISCSIConnector):
#     def __init__(self):
# def connect_volume(connection):
# def disconnect_volume(connection, device_info):
# 
# Path: virtman/drivers/fcg.py
# CONF = cfg.CONF
# class FcgExecutor(FCG):
#     def __init__(self):
# def is_valid():
# def create_group():
# def add_disk(disk):
# def rm_disk(disk):


import os
from oslo.config import cfg
from virtman.utils import commands
from virtman.drivers import dmsetup
from virtman import blockservice
from virtman.drivers import connector
from virtman.drivers import fcg
from virtman.openstack.common import log as logging
        raise NotImplementedError()

    def destroy(self):
        raise NotImplementedError()

    @staticmethod
    def _create_cache(snapshot_dev):
        cached_path = fcg.add_disk(snapshot_dev)
        return cached_path

    @staticmethod
    def _delete_cache(snapshot_dev):
        fcg.rm_disk(snapshot_dev)
        return True


class LocalSnapshot(Snapshot):
    def __init__(self, origin_path, instance_name, snapshot_dev=None):
        super(LocalSnapshot, self).__init__()
        self.instance_path = None
        self.instance_name = instance_name
        self.origin_path = origin_path
        self.snapshot_with_cache = CONF.snapshot_with_cache
        self.snapshot_dev = snapshot_dev
        self.snapshot_dev_name = "snapshot_" + instance_name

    def create(self):
        LOG.debug("Virtman: start VM instance %s according origin_path %s" %
                  (self.instance_name, self.origin_path))
        snapshot_path = self._create_snap_dev()

# Path: virtman/utils/commands.py
# def execute(*cmd, **kwargs):
# def unlink(path):
# def link(src, dst):
# 
# Path: virtman/drivers/dmsetup.py
# class DmExecutor(dmsetup.Dmsetup):
#     def __init__(self):
# def remove_table(name):
# def reload_table(name, table):
# def multipath(name, disks):
# def reload_multipath(name, disks):
# def origin(origin_name, origin_dev):
# def snapshot(origin_path, snapshot_name, snapshot_dev):
# 
# Path: virtman/blockservice.py
# LOG = logging.getLogger(__name__)
# def findloop():
# def try_linkloop(loop_dev):
# def is_looped(loop_dev):
# def linkloop(loop_dev, path):
# def unlinkloop(loop_dev):
# 
# Path: virtman/drivers/connector.py
# class ISCSIExecutor(ISCSIConnector):
#     def __init__(self):
# def connect_volume(connection):
# def disconnect_volume(connection, device_info):
# 
# Path: virtman/drivers/fcg.py
# CONF = cfg.CONF
# class FcgExecutor(FCG):
#     def __init__(self):
# def is_valid():
# def create_group():
# def add_disk(disk):
# def rm_disk(disk):


# Path: virtman/snapshot.py
import os
from oslo.config import cfg
from virtman.utils import commands
from virtman.drivers import dmsetup
from virtman import blockservice
from virtman.drivers import connector
from virtman.drivers import fcg
from virtman.openstack.common import log as logging

        raise NotImplementedError()

    def destroy(self):
        raise NotImplementedError()

    @staticmethod
    def _create_cache(snapshot_dev):
        cached_path = fcg.add_disk(snapshot_dev)
        return cached_path

    @staticmethod
    def _delete_cache(snapshot_dev):
        fcg.rm_disk(snapshot_dev)
        return True


class LocalSnapshot(Snapshot):
    def __init__(self, origin_path, instance_name, snapshot_dev=None):
        super(LocalSnapshot, self).__init__()
        self.instance_path = None
        self.instance_name = instance_name
        self.origin_path = origin_path
        self.snapshot_with_cache = CONF.snapshot_with_cache
        self.snapshot_dev = snapshot_dev
        self.snapshot_dev_name = "snapshot_" + instance_name

    def create(self):
        LOG.debug("Virtman: start VM instance %s according origin_path %s" %
                  (self.instance_name, self.origin_path))
        snapshot_path = self._create_snap_dev()

        self.instance_path = dmsetup.snapshot(self.origin_path,