示例#1
0
def main():
    host = "127.0.0.1"
    port = ":8443"
    username = raw_input('username? ')
    password = raw_input('password? ')

    hostconnection = VmInclude.connectToHost(host + port, username, password)

    webserver = hostconnection.get_vm_by_name("Ubuntu 64-bit - webserver")
    if webserver.is_powered_off():
        print('Info: VM webserver already off - nothing to do here')
    else:
        print('Info: Powering off VM webserver')
        webserver.power_off()

    bigip1 = hostconnection.get_vm_by_name("v11.6-1")
    if bigip1.is_powered_off():
        print('Info: VM v11.6-1 already off - nothing to do here')
    else:
        print('Info: Powering off VM v11.6-1')
        bigip1.power_off()

    bigip2 = hostconnection.get_vm_by_name("v11.6-2")
    if bigip2.is_powered_off():
        print('Info: VM v11.6-2 already off - nothing to do here')
    else:
        print('Info: Powering off VM v11.6-2')
        bigip2.power_off()
示例#2
0
def main():
    host = "127.0.0.1"
    port = ":8443"
    username = raw_input("username? ")
    password = raw_input("password? ")

    hostconnection = VmInclude.connectToHost(host + port, username, password)
    startWebServer(hostconnection)
    startLoadBalancer(hostconnection)
示例#3
0
def main():
    host = "127.0.0.1"
    port = ":8443"
    username = raw_input('username? ')
    password = raw_input('password? ')


    #connect to host
    try:
        hostconnection = VmInclude.connectToHost(host+port, username, password)
        print("Type: ", hostconnection.get_server_type())
        print(hostconnection.get_registered_vms())
        print(hostconnection.get_clusters())
        print('API Type: ' + hostconnection.get_api_type() + ' API Version: ', hostconnection.get_api_version())
        print(hostconnection.get_resource_pools())
        print(hostconnection.get_datacenters())
        webserver = hostconnection.get_vm_by_name('Ubuntu 64-bit - webserver');
        print(webserver.get_snapshots())
        hostconnection.disconnect()

    except VmInclude.VIApiException as err:
        print(err)