# Path: tests/base.py
# LOG = oslo_logging.getLogger(__name__)
# class TestCase(base.BaseTestCase):
#     def setUp(self):
#     def _common_cleanup(self):
#     def log_level(self, level):
#     def mock_object(self, obj, attr_name, new_attr=None, **kwargs):
#     def assertDictMatch(self, d1, d2, approx_equal=False, tolerance=0.001):
#         def raise_assertion(msg):
# 
# Path: virtman/compute_new.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class Compute(object):
# class Virtman(Compute):
#     def __init__(self):
#     def create(self, instance_name, image_name, image_connections, snapshot):
#     def destroy(self, instance_name):
#     def list(self):
#     def __init__(self, openstack_compatible=True):
#     def get_image_type(openstack_compatible):
#     def __del__(self):
#     def heartbeat_clock(self):
#     def heartbeat(self):
#     def _heartbeat(self):
#     def create(self, instance_name, image_name, image_connections,
#                snapshot=None):
#     def _create(self, instance_name, image_name, image_connections, snapshot):
#     def destroy(self, instance_name):
#     def _destroy(self, instance_name):
#     def list(self):
# 
# 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/drivers/volt.py
# CONF = cfg.CONF
# def singleton(cls):
#     def _singleton(*args, **kwargs):
#     def __init__(self):
# def login(session_name, peer_id, host, port, iqn, lun):
# def logout(session_name, peer_id):
# def get(session_name, host):
# def heartbeat():
# class VoltClient(client.Client):
# 
# Path: virtman/image.py
# class FakeImage(Image):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#         super(FakeImage, self).__init__(image_name, image_connections,
#                                         base_image)
# 
#     def create_snapshot(self, instance_name, snapshot):
#         self.snapshots[instance_name] = instance_name
#         self.update_instance_status()
#         return '/dev/mapper/snapshot_' + instance_name
# 
#     def destroy_snapshot(self, instance_name):
#         del self.snapshots[instance_name]
#         self.update_instance_status()
#         return True
# 
#     def deploy_image(self):
#         if self.origin_path is None:
#             self.origin_path = '/dev/mapper/origin_' + self.image_name
# 
#     def destroy_image(self):
#         self.origin_path = None
#         return True
# 
#     def adjust_for_heartbeat(self, parents):
#         pass
# 
# Path: virtman/utils/exception.py
# LOG = logging.getLogger(__name__)
# class VirtmanException(Exception):
# class CreateBaseImageFailed(VirtmanException):
# class CreateSnapshotFailed(VirtmanException):
# class TestException(VirtmanException):
#     def __init__(self, message=None, **kwargs):
#     def __unicode__(self):


import mock
import logging
from tests import base
from virtman import compute_new
from virtman.drivers import fcg
from virtman.drivers import volt
from virtman.image import FakeImage
from virtman.utils import exception
# -*- coding: utf-8 -*-


test_image_connections = [{
    'target_portal': '10.0.0.3:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-image',
    'target_lun': '1'}
]

test_snapshot_connection1 = {
    'target_portal': '10.0.0.1:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-shanpshot1',
    'target_lun': '1'}

test_snapshot_connection2 = {
    'target_portal': '10.0.0.1:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-shanpshot2',
    'target_lun': '1'}

def baseimage_exception_for_test(*args):
    raise exception.CreateBaseImageFailed(baseimage='test_baseimage')
def exception_for_test(*args):
    raise exception.TestException

class TestComputer(base.TestCase):
    def setUp(self):
        super(TestComputer, self).setUp()
        compute_new.LOG.logger.setLevel(logging.DEBUG)

# Path: tests/base.py
# LOG = oslo_logging.getLogger(__name__)
# class TestCase(base.BaseTestCase):
#     def setUp(self):
#     def _common_cleanup(self):
#     def log_level(self, level):
#     def mock_object(self, obj, attr_name, new_attr=None, **kwargs):
#     def assertDictMatch(self, d1, d2, approx_equal=False, tolerance=0.001):
#         def raise_assertion(msg):
# 
# Path: virtman/compute_new.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class Compute(object):
# class Virtman(Compute):
#     def __init__(self):
#     def create(self, instance_name, image_name, image_connections, snapshot):
#     def destroy(self, instance_name):
#     def list(self):
#     def __init__(self, openstack_compatible=True):
#     def get_image_type(openstack_compatible):
#     def __del__(self):
#     def heartbeat_clock(self):
#     def heartbeat(self):
#     def _heartbeat(self):
#     def create(self, instance_name, image_name, image_connections,
#                snapshot=None):
#     def _create(self, instance_name, image_name, image_connections, snapshot):
#     def destroy(self, instance_name):
#     def _destroy(self, instance_name):
#     def list(self):
# 
# 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/drivers/volt.py
# CONF = cfg.CONF
# def singleton(cls):
#     def _singleton(*args, **kwargs):
#     def __init__(self):
# def login(session_name, peer_id, host, port, iqn, lun):
# def logout(session_name, peer_id):
# def get(session_name, host):
# def heartbeat():
# class VoltClient(client.Client):
# 
# Path: virtman/image.py
# class FakeImage(Image):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#         super(FakeImage, self).__init__(image_name, image_connections,
#                                         base_image)
# 
#     def create_snapshot(self, instance_name, snapshot):
#         self.snapshots[instance_name] = instance_name
#         self.update_instance_status()
#         return '/dev/mapper/snapshot_' + instance_name
# 
#     def destroy_snapshot(self, instance_name):
#         del self.snapshots[instance_name]
#         self.update_instance_status()
#         return True
# 
#     def deploy_image(self):
#         if self.origin_path is None:
#             self.origin_path = '/dev/mapper/origin_' + self.image_name
# 
#     def destroy_image(self):
#         self.origin_path = None
#         return True
# 
#     def adjust_for_heartbeat(self, parents):
#         pass
# 
# Path: virtman/utils/exception.py
# LOG = logging.getLogger(__name__)
# class VirtmanException(Exception):
# class CreateBaseImageFailed(VirtmanException):
# class CreateSnapshotFailed(VirtmanException):
# class TestException(VirtmanException):
#     def __init__(self, message=None, **kwargs):
#     def __unicode__(self):


# Path: tests/test_computer.py
import mock
import logging
from tests import base
from virtman import compute_new
from virtman.drivers import fcg
from virtman.drivers import volt
from virtman.image import FakeImage
from virtman.utils import exception

# -*- coding: utf-8 -*-


test_image_connections = [{
    'target_portal': '10.0.0.3:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-image',
    'target_lun': '1'}
]

test_snapshot_connection1 = {
    'target_portal': '10.0.0.1:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-shanpshot1',
    'target_lun': '1'}

test_snapshot_connection2 = {
    'target_portal': '10.0.0.1:3260',
    'target_iqn': 'iqn.2010-10.org.openstack:volume-shanpshot2',
    'target_lun': '1'}

def baseimage_exception_for_test(*args):
    raise exception.CreateBaseImageFailed(baseimage='test_baseimage')
def exception_for_test(*args):
    raise exception.TestException

class TestComputer(base.TestCase):
    def setUp(self):
        super(TestComputer, self).setUp()
        compute_new.LOG.logger.setLevel(logging.DEBUG)

        self.mock_object(fcg, 'create_group',