Ejemplo n.º 1
0
    def __init__(self, node, config=None, vm_info=None):
        if not config and vm_info is None:
            raise Exception("config and vm_info both can not be None")
        self.vm_config = ""
        if config:
            for name, value in config.options.iteritems():
                self.vm_config += "%s = %s\n" % (name, repr(value))

        self.node = node
        self._config = config
        self._vm_info = vm_info

        self.id = None
        self.name = None
        self._is_resident = False
        self.pid = None  #to keep track of the dom once it is started
        # Now call the init method that would initialized the above
        # state variables
        self.init()
        self.id = getHexID(
            self.name,
            [constants.DOMAIN])  # id is name, need to resolve this with guid
        self.current_state = AvailState(self.id, self.NOT_STARTED, \
                                        AvailState.NOT_MONITORING, \
                                        description = u'New VM')
Ejemplo n.º 2
0
    def __init__(self,
                 id,
                 type,
                 name,
                 description,
                 is_deleted,
                 scope,
                 bridge_info=dynamic_map(),
                 vlan_info=dynamic_map(),
                 bond_info=dynamic_map(),
                 ipv4_info=dynamic_map(),
                 dhcp_info=dynamic_map(),
                 nat_info=dynamic_map(),
                 status=None):

        self.id = id
        if self.id is None:
            self.id = getHexID()

        self.type = type
        self.name = name
        self.description = description

        self.is_deleted = is_deleted

        self.bridge_info = bridge_info
        self.vlan_info = vlan_info
        self.bond_info = bond_info
        self.ipv4_info = ipv4_info
        self.dhcp_info = dhcp_info
        self.nat_info = nat_info
        self.status = status  #definition status to be displayed in the grid - IN_SYNC/ OUT_OF_SYNC
        self.scope = scope  #To identify definition scope of definition since we are showing all the  definitions (server and pool level) at server level.
Ejemplo n.º 3
0
    def __init__(self,id, type, name, description, is_deleted, scope,
                 bridge_info=dynamic_map(),
                 vlan_info=dynamic_map(), 
                 bond_info=dynamic_map(),
                 ipv4_info=dynamic_map(),
                 dhcp_info=dynamic_map(),
                 nat_info=dynamic_map(),
                 status=None):
                 
        self.id = id
        if self.id is None:
            self.id = getHexID()
        
        self.type = type
        self.name = name
        self.description = description

        self.is_deleted = is_deleted

        self.bridge_info = bridge_info
        self.vlan_info   = vlan_info
        self.bond_info   = bond_info
        self.ipv4_info   = ipv4_info
        self.dhcp_info   = dhcp_info
        self.nat_info    = nat_info
        self.status = status           #definition status to be displayed in the grid - IN_SYNC/ OUT_OF_SYNC
        self.scope = scope              #To identify definition scope of definition since we are showing all the  definitions (server and pool level) at server level.
Ejemplo n.º 4
0
 def __init__(self,mail_server,desc, port, use_secure, site_id, useremail, password):
     self.id = getHexID()
     self.mail_server = to_unicode(mail_server)
     self.description=desc
     self.port = port
     self.use_secure = use_secure
     self.site_id = site_id
     self.credential=Credential(self.id,u"",user_email = useremail, password = password)
Ejemplo n.º 5
0
 def __init__(self, entity_id, state, monit_state, timestamp, description,endtime=None,period=None):
     self.id = getHexID()
     self.entity_id = entity_id
     self.state = state
     self.timestamp = timestamp
     self.description = description
     self.monit_state=monit_state
     self.endtime=endtime
     self.period=period
Ejemplo n.º 6
0
 def __init__(self, mail_server, desc, port, use_secure, site_id, useremail,
              password):
     self.id = getHexID()
     self.mail_server = to_unicode(mail_server)
     self.description = desc
     self.port = port
     self.use_secure = use_secure
     self.site_id = site_id
     self.credential = Credential(self.id,
                                  u"",
                                  user_email=useremail,
                                  password=password)
Ejemplo n.º 7
0
 def __init__(self,
              entity_id,
              state,
              monit_state,
              timestamp,
              description,
              endtime=None,
              period=None):
     self.id = getHexID()
     self.entity_id = entity_id
     self.state = state
     self.timestamp = timestamp
     self.description = description
     self.monit_state = monit_state
     self.endtime = endtime
     self.period = period
Ejemplo n.º 8
0
    def __init__(self, name, node_list=None, group_vars=None):
        self.name = name
        self.id = getHexID(name, [constants.SERVER_POOL])
        self.n_list = {}  # dict()
        self.groupVars = {}  # dict

        self.alloc_policy = SimpleAllocationPolicy(self)  #TBD: parametrise!

        if node_list is not None:
            self.n_list = node_list

        if group_vars is not None:
            self.groupVars = group_vars

        self.current_state = AvailState(self.id, None, \
                                    AvailState.MONITORING, \
                                    description = u'New ServerPool')
Ejemplo n.º 9
0
    def __init__(self, name, node_list = None, group_vars = None):
        self.name = name
        self.id = getHexID(name,[constants.SERVER_POOL])
        self.n_list = {}   # dict()
        self.groupVars = {} # dict

        self.alloc_policy = SimpleAllocationPolicy(self) #TBD: parametrise!
        
        if node_list is not None:
            self.n_list = node_list

        if group_vars is not None:
            self.groupVars = group_vars

        self.current_state = AvailState(self.id, None, \
                                    AvailState.MONITORING, \
                                    description = u'New ServerPool')
Ejemplo n.º 10
0
    def __init__(self, node, config=None, vm_info=None):
        if not config and vm_info is None:
            raise Exception("config and vm_info both can not be None")
        self.vm_config = ""
        if config:
            for name, value in config.options.iteritems():
                self.vm_config += "%s = %s\n" % (name, repr(value))

        self.node = node
        self._config = config
        self._vm_info = vm_info

        self.id = None
        self.name = None
        self._is_resident = False
        self.pid = None  # to keep track of the dom once it is started
        # Now call the init method that would initialized the above
        # state variables
        self.init()
        self.id = getHexID(self.name, [constants.DOMAIN])  # id is name, need to resolve this with guid
        self.current_state = AvailState(self.id, self.NOT_STARTED, AvailState.NOT_MONITORING, description=u"New VM")
Ejemplo n.º 11
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID(name, [constants.APPLIANCE_CATALOG])
Ejemplo n.º 12
0
 def __init__(self, node):
     self.id = getHexID()
     self.node_id = node.id
     self.node = node
     self.config = {}
     self.__populateDefaultEntries()
Ejemplo n.º 13
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID(name, [constants.DATA_CENTER])
Ejemplo n.º 14
0
 def __init__(self, name, node_id, status):
     self.id = getHexID(name, [constants.DOMAIN])
     self.name = name
     self.node_id = node_id
     self.status = status
Ejemplo n.º 15
0
 def __init__(self, name, node_id, status):
     self.id = getHexID(name, [constants.DOMAIN])
     self.name = name
     self.node_id = node_id
     self.status = status
Ejemplo n.º 16
0
 def __init__(self,entity_id,type,**kwargs):
     self.id=getHexID()
     self.entity_id=entity_id
     self.cred_type=type
     self.cred_details=kwargs
Ejemplo n.º 17
0
 def __init__(self, title):
     self.title = title
     self.id = getHexID()
Ejemplo n.º 18
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID(name,[constants.APPLIANCE_CATALOG])
Ejemplo n.º 19
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID()
Ejemplo n.º 20
0
 def __init__(self, type):
     self.type = type
     self.id = getHexID(type,[constants.NODEINFO_COMPONENT])
Ejemplo n.º 21
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID(name,[constants.NODEINFO_CATEGORY])
Ejemplo n.º 22
0
 def __init__(self,node):
     self.id=getHexID()
     self.node_id=node.id
     self.node=node
     self.config={}
     self.__populateDefaultEntries()
Ejemplo n.º 23
0
 def __init__(self, provider_id):
     self.provider_id = provider_id
     self.id = getHexID(provider_id, [constants.APPLIANCE_FEED])
Ejemplo n.º 24
0
 def __init__(self, provider_id):
     self.provider_id = provider_id
     self.id = getHexID(provider_id,[constants.APPLIANCE_FEED])
Ejemplo n.º 25
0
 def __init__(self, title):
     self.title = title
     self.id = getHexID()
Ejemplo n.º 26
0
 def __init__(self, name):
     self.name = name
     self.id = getHexID(name,[constants.DATA_CENTER])
Ejemplo n.º 27
0
        model.DBSession.merge(site)
    else:
        site=ex_sites[0]
        s.entity_id=site.id
    entities.append(s)

    locn=tg.config.get(constants.prop_image_store)
    image_store_location= to_unicode(os.path.abspath(locn))
    #img_str={'id':2,'name':u'Template Library','type':'IMAGE_STORE'}
    img_str={'id':2,'name':u'模板库','type':'IMAGE_STORE'}
    #for img_str in image_stores:
    image_store = ImageStore(registry)
    image_store.name=img_str['name']
    image_store.location=image_store_location
    image_store._store_location=image_store_location
    image_store.id=getHexID()
    iss=model.Entity()
    iss.name=img_str['name']
    iss.id=img_str['id']
    iss.entity_id=image_store.id
    iss.type=entity_types[img_str['type']]
    ex_iss=model.DBSession.query(model.ImageStore).filter(model.ImageStore.name==img_str['name']).all()
    if len(ex_iss)==0:
        model.DBSession.merge(image_store)
        model.DBSession.merge(iss)
    else:
        image_store=ex_iss[0]
        iss.entity_id=image_store.id
    entities.append(iss)

    tot_entities.extend(entities)