Пример #1
0
Файл: vps.py Проект: wwq0327/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()
Пример #2
0
Файл: vps.py Проект: wwq0327/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()
Пример #3
0
Файл: vps.py Проект: wwq0327/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)
Пример #4
0
Файл: vps.py Проект: wwq0327/vps
            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)