示例#1
0
    def __init__(self):
        self.db = Db_Connector()
        # Using boto ec2 library to get info about running vms in an EC2 compatible environment
        region = boto.ec2.regioninfo.RegionInfo(
            name=cluster_config.INFRA,
            endpoint=cluster_config.IP_CLOUD_CONTROLLER)
        self.connection = boto.connect_ec2(
            aws_access_key_id=cluster_config.AWS_ACCESS_KEY_ID,
            aws_secret_access_key=cluster_config.AWS_SECRET_ACCESS_KEY,
            is_secure=False,
            region=region,
            port=cluster_config.EC2_INTERFACE_PORT_ON_CLOUD_CONTROLLER,
            path=cluster_config.PATH_TO_EC2_SERVICE)
        self.nodes = self.grepNodes()
        #Set up logging
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
            datefmt='%m-%d %H:%M',
            filename=cluster_config.PATH_TO_LOG_FILE)

        while True:
            vms = self.get_running_vms()
            #self.mark_terminated_vms(vms)
            self.store_vms_info(vms)
            self.mark_terminated_vms(vms)
            # Checks if any running vm has missing information (node placement, for example)
            self.update_vms_info()
            time.sleep(60)
示例#2
0
文件: vms.py 项目: pedrovitti/pcmons
class VM(object):
    attributes = {
        'node_ip': None,
        'node_hostname': None,
        'reservation': None,
        'user': None,
        'instance_id': None,
        'dns_name': None,
        'private_dns_name': None,
        'public_dns_name': None,
        'state': None,
        'instance_type': None,
        'launch_time': None,
        'availability_zone': None,
        'kernel': None,
        'ramdisk': None,
        'last_check': None,
    }

    def __init__(self):
        self.db = Db_Connector()

    def save(self):
        self.db.update_vm_info(self.attributes)
示例#3
0
文件: vms.py 项目: pedrovitti/pcmons
class VM(object):
    attributes = {
        'node_ip':None,
        'node_hostname':None,
        'reservation':None,
        'user':None,
        'instance_id':None,
        'dns_name':None,
        'private_dns_name':None,
        'public_dns_name':None,
        'state': None,
        'instance_type':None,
        'launch_time':None,
        'availability_zone':None,
        'kernel':None,
        'ramdisk':None,
        'last_check':None,
    }
    
    def __init__(self):
        self.db = Db_Connector()

    def save(self):
        self.db.update_vm_info(self.attributes)
示例#4
0
文件: vms.py 项目: pedrovitti/pcmons
 def __init__(self):
     self.db = Db_Connector()
示例#5
0
文件: vms.py 项目: pedrovitti/pcmons
 def __init__(self):
     self.db = Db_Connector()