예제 #1
0
 def __init__(self):
     """ load configuration options for this node and connect to libvirt """
     super(Node, self).__init__()
     self._instances = {}
     self._conn = self._get_connection()
     self._pool = process.ProcessPool()
     self.instdir = model.InstanceDirectory()
예제 #2
0
파일: node.py 프로젝트: bopopescu/cc-1
    def fromName(cls, conn, pool, name):
        """ use the saved data for reloading the instance """
        # if FLAGS.fake_libvirt:
        #     raise Exception('this is a bit useless, eh?')

        instdir = model.InstanceDirectory()
        instance = instdir.get(name)
        return cls(conn=conn, pool=pool, name=name, data=instance)
예제 #3
0
 def create_instance(self):
     instdir = model.InstanceDirectory()
     inst = instdir.new()
     # TODO(ja): add ami, ari, aki, user_data
     inst['reservation_id'] = 'r-fakeres'
     inst['launch_time'] = '10'
     inst['user_id'] = 'fake'
     inst['project_id'] = 'fake'
     inst['instance_type'] = 'm1.tiny'
     inst['node_name'] = FLAGS.node_name
     inst['mac_address'] = utils.generate_mac()
     inst['ami_launch_index'] = 0
     inst.save()
     return inst['instance_id']
예제 #4
0
 def fromName(cls, conn, pool, name):
     """ use the saved data for reloading the instance """
     instdir = model.InstanceDirectory()
     instance = instdir.get(name)
     return cls(conn=conn, pool=pool, name=name, data=instance)
예제 #5
0
 def __init__(self):
     self.instdir = model.InstanceDirectory()
     self.network = network.PublicNetworkController()
     self.setup()