def vps(self, vps_id): try: vps = VpsOne.mc_get(vps_id) if not vps: return Vps() ip = vps.ip_autobind() # what if no ip can be autobind ? if ip: ipv4 = ip.ip ipv4_netmask = ip.netmask ipv4_gateway = ip.gateway else: ipv4 = ipv4_netmask = ipv4_gateway = 0 return Vps( id=vps.id, ipv4=ipv4, ipv4_netmask=ipv4_netmask, ipv4_gateway=ipv4_gateway, password=vps.password, os=vps.os, hd=vps.hd, ram=vps.ram, cpu=vps.cpu, host_id=vps.host_id, state=vps.state, ipv4_inter=vps.ip_inter, bandwidth=vps.bandwidth, qos=vps.qos, ) except Exception, e: logging.exception(e) return Vps()
def vps(self, vps_id): try: vps = VpsOne.mc_get(vps_id) if not vps: return Vps() ip = vps.ip_autobind() # what if no ip can be autobind ? if ip: ipv4 = ip.ip ipv4_netmask = ip.netmask ipv4_gateway = ip.gateway else: ipv4 = ipv4_netmask = ipv4_gateway = 0 return Vps(id=vps.id, ipv4=ipv4, ipv4_netmask=ipv4_netmask, ipv4_gateway=ipv4_gateway, password=vps.password, os=vps.os, hd=vps.hd, ram=vps.ram, cpu=vps.cpu, host_id=vps.host_id, state=vps.state, ipv4_inter=vps.ip_inter, bandwidth=vps.bandwidth, qos=vps.qos) except Exception, e: logging.exception(e) return Vps()
id=vps.id, ipv4=ipv4, ipv4_netmask=ipv4_netmask, ipv4_gateway=ipv4_gateway, password=vps.password, os=vps.os, hd=vps.hd, ram=vps.ram, cpu=vps.cpu, host_id=vps.host_id, state=vps.state, ipv4_inter=vps.ip_inter, bandwidth=vps.bandwidth, qos=vps.qos, ) except Exception, e: logging.exception(e) return Vps() if __name__ == "__main__": pass vps = VpsOne.mc_get(2) print dir(vps) print vps.ip_inter_str, vps.ip_list # handler = Handler() # print handler.vps(40) # from zkit.ip import int2ip # print int2ip(-16)
return Vps(id=vps.id, ipv4=ipv4, ipv4_netmask=ipv4_netmask, ipv4_gateway=ipv4_gateway, password=vps.password, os=vps.os, hd=vps.hd, ram=vps.ram, cpu=vps.cpu, host_id=vps.host_id, state=vps.state, ipv4_inter=vps.ip_inter, bandwidth=vps.bandwidth, qos=vps.qos) except Exception, e: logging.exception(e) return Vps() if __name__ == '__main__': pass vps = VpsOne.mc_get(2) print dir(vps) print vps.ip_inter_str, vps.ip_list # handler = Handler() # print handler.vps(40) # from zkit.ip import int2ip # print int2ip(-16)