Ejemplo n.º 1
0
def get_networks(vcip):
    url = 'https://' + vcip + '/rest/vcenter/network'
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 2
0
def get_vm_nics(vcip, vmid):
    url = 'https://' + vcip + '/rest/vcenter/vm/' + vmid + '/hardware/ethernet'
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 3
0
def get_vm_nic_detail(vcip, vmid, nic):
    url = 'https://' + vcip + '/rest/vcenter/vm/' + vmid + '/hardware/ethernet/' + nic
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 4
0
def get_vm_power_status(vcip, vmid):
    url = 'https://' + vcip + '/rest/vcenter/vm/' + vmid + '/power'
    r = vc_session.get(url)
    return r.json()['value']
Ejemplo n.º 5
0
def get_vms(vcip):
    url = 'https://' + vcip + '/rest/vcenter/vm'
    r = vc_session.get(url)
    return r.json()['value']
Ejemplo n.º 6
0
def get_vms_name_id(vcip):
    url = 'https://' + vcip + '/rest/vcenter/vm'
    r = vc_session.get(url)
    # 将每个虚拟机的vm和name做映射
    return {x['name']: x['vm'] for x in r.json()['value']}
Ejemplo n.º 7
0
def get_vm_mem(vcip, vmid):
    url = 'https://' + vcip + '/rest/vcenter/vm/' + vmid + '/hardware/memory/'
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 8
0
def get_folders(vcip):
    url = 'https://' + vcip + '/rest/vcenter/folder'
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 9
0
def get_datastores(vcip):
    url = 'https://' + vcip + '/rest/vcenter/datastore'
    r = vc_session.get(url)
    return r.json()
Ejemplo n.º 10
0
def get_hosts(vcip):
    url = 'https://' + vcip + '/rest/vcenter/host'
    r = vc_session.get(url)
    return r.json()