Как я могу получить IP-адрес виртуальной машины NIC? - PullRequest
0 голосов
/ 30 октября 2019

Я использую VSPHERE JDK JAVA 6.5. Где скрыты IP-адреса виртуальной машины? Я получил vmNics () с некоторой информацией, но IP-адреса не являются частью этого.

Какой класс мне нужно использовать? Thx

VMTypes.Info vmInfo = vcVAPIConnect.getVM(vapiStub, vmID);
if (vmInfo != null) {
    System.out.println("VM Detail Id   = " + vmID);
    System.out.println("VM Detail Name = " + vmInfo.getName());

    Set<String> fldList = vmInfo._getDynamicFieldNames();
    System.out.println("VM Dyn. Fieldlist (Size): " + fldList.size());
    for (String fldValue: fldList) {
        System.out.println("VM Detail Name = " + fldValue + " / " + vmInfo._getDynamicField(fldValue));
    }

    System.out.println("VM Detail Hardware Version   = " + vmInfo.getHardware().getVersion());

    System.out.println("VM Detail CPU CoresPerSocket = " + vmInfo.getCpu().getCoresPerSocket());
    System.out.println("VM Detail CPU Count          = " + vmInfo.getCpu().getCount());
    System.out.println("VM Detail CPU CannonialName  = " + vmInfo.getCpu()._getCanonicalName());

    System.out.println("VM Detail RAM Size           = " + vmInfo.getMemory().getSizeMiB());
    System.out.println("VM Detail RAM CannonialName  = " + vmInfo.getMemory()._getCanonicalName());

    Map<String, EthernetTypes.Info> vmNics = vmInfo.getNics();
    System.out.println("VM Detail NIC Size           = " + vmNics.size());
    for (String nicKey: vmNics.keySet()) {
        System.out.println("VM Detail NIC Key            = " + nicKey);
        System.out.println("VM Detail NIC CannonialName  = " + vmNics.get(nicKey)._getCanonicalName());
        System.out.println("VM Detail NIC MacAddr        = " + vmNics.get(nicKey).getMacAddress());
        System.out.println("VM Detail NIC MacType        = " + vmNics.get(nicKey).getMacType().toString());
        System.out.println("VM Detail NIC Label          = " + vmNics.get(nicKey).getLabel());
        System.out.println("VM Detail NIC PCI Slot       = " + vmNics.get(nicKey).getPciSlotNumber());
        System.out.println("VM Detail NIC Backing Name   = " + vmNics.get(nicKey).getBacking().getNetworkName());
        System.out.println("VM Detail NIC Backing Net    = " + vmNics.get(nicKey).getBacking().getNetwork());
        System.out.println("VM Detail NIC Backing Host   = " + vmNics.get(nicKey).getBacking().getHostDevice());

        fldList = vmNics.get(nicKey)._getDynamicFieldNames();
        System.out.println("VM Detail NIC Dyn. Fieldlist (Size):    " + fldList.size());
        for (String fldValue: fldList) {
            System.out.println("VM Detail NIC = " + fldValue + " / " + vmInfo._getDynamicField(fldValue));
        }
    }
}
...