Exemplo n.º 1
0
 def luhya_clc_start_vm(self, clientInfo):
     """ harrison
     远程模式(clientData.is_local==False):
         直接调用ClcThriftServer API luhya_clc_start_vm(clientData)启动虚拟机
     本地模式(clientData.is_local==True):
         调用本地NcThriftServer API luhya_res_start_vm (clientData)启动虚拟机
     """
     ret = -1
     if clientInfo.instance_state.is_local:
         local_nc_ip = utility.get_local_publicip()
         if local_nc_ip != None:
             ret = OpenLdap.p_nc_start_vm(local_nc_ip, clientInfo)
         else:
             logger.debug("get local ip is error!")
     else:
         ldap_ip = utility.get_real_ldap()
         if ldap_ip != None:
             clc_ip = OpenLdap.get_clc_ip(ldap_ip)
             if clc_ip != None:
                 ret = OpenLdap.clc_start_vm(clc_ip, clientInfo)
             else:
                 logger.debug("get real clc ip is error!")
         else:
             logger.debug("get real ldap ip is error!")
     return ret
Exemplo n.º 2
0
def p_start_vm(clientInfo):
    nodeIp = None
    ret = 0
    if clientInfo.is_assign_node!=None and clientInfo.is_assign_node:
        nodeIp = clientInfo.node_ip
    else:
        nodeIp = p_dispatch_nodes()
    if nodeIp!=None:
        logger.debug('p_start_vm node:%s' %nodeIp)
        ret = OpenLdap.p_nc_start_vm(nodeIp,clientInfo)
    else:
        ret = -7
    retInfo = thd_run_instance_ret()
    retInfo.node_ip = nodeIp
    retInfo.return_value = ret
    logger.debug('p_start_vm the return value:%s' %str(retInfo))
    return retInfo