Пример #1
0
 def luhya_clc_stop_vm(self, clientInfo):
     """ harrison
        如果是在线并且是远程模式:
             转发调用ClcThriftServer API luhya_clc_stop_vm(client_info)停止虚拟机
        如果是在线本地模式或离线模式:
             直接调用NcThriftServer API luhya_nc_stop_vm(client_info)停止虚拟机
     """
     ret = False
     if clientInfo.instance_state.is_local:
         local_nc_ip = utility.get_local_publicip()
         if local_nc_ip != None:
             ret = OpenLdap.p_nc_stop_vm(local_nc_ip, clientInfo)
     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_stop_vm(clc_ip, clientInfo)
             else:
                 logger.debug("get real clc ip is error!")
         else:
             logger.debug("get real ldap ip is error!")
     return ret