# 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
# LOG = logging.getLogger(__name__)
# class Image(object):
# class LocalImage(Image):
# class BlockDeviceImage(Image):
# class FakeImage(Image):
# class QCOW2Image(Image):
# class RAWImage(Image):
#     def __init__(self, image_name, image_connections, base_image):
#     def update_instance_status(self):
#     def create_snapshot(self, instance_name, snapshot):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot_dev):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot_connection):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
# 
# 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 time
import os
import sys
import threading
import traceback
from oslo.config import cfg
from virtman.drivers import fcg
from virtman.drivers import volt
from virtman import image
from virtman.utils import exception
from virtman.openstack.common import log as logging
    def get_image_type(openstack_compatible):
        if openstack_compatible:
            return 'BlockDeviceImage'
        else:
            return 'LocalImage'

    def __del__(self):
        self.heartbeat_event.set()

    def heartbeat_clock(self):
        while not self.heartbeat_event.wait(CONF.heartbeat_interval):
            try:
                self.heartbeat()
            except Exception, e:
                LOG.error("Virtman: heartbeat failed due to %s" % e)
                LOG.error("Virtman: traceback is : %s" % traceback.print_exc())
        LOG.debug("Virtman: stop heartbeat timer")

    def heartbeat(self):
        with self.lock:
            self._heartbeat()

    def _heartbeat(self):
        LOG.debug("Virtman: heartbeat start @ %s" % time.asctime())
        for name in self.images.keys():
            if not self.images[name].has_instance:
                if self.images[name].destroy_image():
                    del self.images[name]
        info = volt.heartbeat()
        for name in self.images.keys():

# 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
# LOG = logging.getLogger(__name__)
# class Image(object):
# class LocalImage(Image):
# class BlockDeviceImage(Image):
# class FakeImage(Image):
# class QCOW2Image(Image):
# class RAWImage(Image):
#     def __init__(self, image_name, image_connections, base_image):
#     def update_instance_status(self):
#     def create_snapshot(self, instance_name, snapshot):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot_dev):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot_connection):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
#     def __init__(self, image_name, image_connections,
#                  base_image=BlockDeviceBaseImage):
#     def create_snapshot(self, instance_name, snapshot):
#     def destroy_snapshot(self, instance_name):
#     def deploy_image(self):
#     def destroy_image(self):
#     def adjust_for_heartbeat(self, parents):
# 
# 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: virtman/compute_new.py
import time
import os
import sys
import threading
import traceback
from oslo.config import cfg
from virtman.drivers import fcg
from virtman.drivers import volt
from virtman import image
from virtman.utils import exception
from virtman.openstack.common import log as logging

    def get_image_type(openstack_compatible):
        if openstack_compatible:
            return 'BlockDeviceImage'
        else:
            return 'LocalImage'

    def __del__(self):
        self.heartbeat_event.set()

    def heartbeat_clock(self):
        while not self.heartbeat_event.wait(CONF.heartbeat_interval):
            try:
                self.heartbeat()
            except Exception, e:
                LOG.error("Virtman: heartbeat failed due to %s" % e)
                LOG.error("Virtman: traceback is : %s" % traceback.print_exc())
        LOG.debug("Virtman: stop heartbeat timer")

    def heartbeat(self):
        with self.lock:
            self._heartbeat()

    def _heartbeat(self):
        LOG.debug("Virtman: heartbeat start @ %s" % time.asctime())
        for name in self.images.keys():
            if not self.images[name].has_instance:
                if self.images[name].destroy_image():
                    del self.images[name]
        info = volt.heartbeat()
        for name in self.images.keys():

            for image in info: