doskiran's Posts

Java sample to extend VM hard-disk using VI Java API (SOAP Based) - Extend VM Hard Disk 
List Guest Networking Interfaces in the guest operating system. GET: https://{vCenter}/api/vcenter/vm/{vm}/guest/networking/interfaces It lists the nic-wise ip_addresses and its mac_address. Sa... See more...
List Guest Networking Interfaces in the guest operating system. GET: https://{vCenter}/api/vcenter/vm/{vm}/guest/networking/interfaces It lists the nic-wise ip_addresses and its mac_address. Sample program to print the Virtual machine network details(Nic name, IPv4, Mac, Nic Key, Portgroup) using VI java API(vSphere Management SDK). - PrintVMNetworkDetails.java Output: Network Adatpter IP4Address Mac Key Portgroup ---------------- ---------- --- --- --------- Network adapter 1 10.10.10.6 00:15:23:31:c9:22 4000 VM Network Network adapter 2 10.20.20.7 07:89:61:14:38:66 4001 dvPortgroup  
This error occurs when one of the host is in Standby Mode. To get the Connected hosts use the below host filter API, i.e,   curl -k -X GET 'https://xxxxxxx.xxxxxxxx.xx/api/vcenter/host?connection_... See more...
This error occurs when one of the host is in Standby Mode. To get the Connected hosts use the below host filter API, i.e,   curl -k -X GET 'https://xxxxxxx.xxxxxxxx.xx/api/vcenter/host?connection_states=CONNECTED' -H 'vmware-api-session-id: efaf02a0237ca4e45b19ce1dae1680f1'      
As per my understanding, All Rest APIs related to VM are not available in current vSphere releases, we might expect them in the next vSphere major releases.   For now to get this VM committed stora... See more...
As per my understanding, All Rest APIs related to VM are not available in current vSphere releases, we might expect them in the next vSphere major releases.   For now to get this VM committed storage use vSphere Management SDK (SOAP based):   VM committed storage(VirtualMachineStorageSummary ) - Total storage space, in bytes, committed to this virtual machine across all data stores. Essentially an aggregate of the property committed across all data stores that this virtual machine is located on.    Here is the sample code to get the VM committed storage using VIJava API:    ServiceInstance si = new ServiceInstance(new URL("https://" + vcIPaddress + "/sdk"), userName, password, true); VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder()) .searchManagedEntity("VirtualMachine", "<VM_Name>"); System.out.println("VM Committed storage::"+vm.getSummary().getStorage().getCommitted()); System.out.println("VM UnCommitted storage::"+vm.getSummary().getStorage().getUncommitted());    
Use vSphere H5 Client by following the steps to setup the instance for 6.0- vSphere H5 Client Download OVA - vsphere-html5-web-client 
Hi Graham, vimapi feature is not available in VMware vSphere 7 Hypervisor license. Its available from VMware vSphere 7 Foundation / Essentials / Standard / Enterprise.. license  Thanks, Kiran... See more...
Hi Graham, vimapi feature is not available in VMware vSphere 7 Hypervisor license. Its available from VMware vSphere 7 Foundation / Essentials / Standard / Enterprise.. license  Thanks, Kiran  
This fault is the license check of API restrictions based on the product version. Looks like the current license on the host doesn't have the vimapi feature or has expired.   > vim-cmd vimsvc/lice... See more...
This fault is the license check of API restrictions based on the product version. Looks like the current license on the host doesn't have the vimapi feature or has expired.   > vim-cmd vimsvc/license --show | grep vimapi      [feature] = vimapi ("vSphere API")  
Command to check the ESXi license info: ~ # vim-cmd vimsvc/license --show
vSphere 7.0 release is a major vSphere release. All major vSphere releases require new license keys. The existing 6.x license should not be valid for vSphere 7.0. I observed the same error in my... See more...
vSphere 7.0 release is a major vSphere release. All major vSphere releases require new license keys. The existing 6.x license should not be valid for vSphere 7.0. I observed the same error in my vCenter setup , after updating to 7.0 license it started working for me. Refer below link if you are running pyVmomi directly on ESX:  https://github.com/vmware/pyvmomi/issues/625
VirtualMachine - CreateSnapshot_Task(createSnapshot) : Creates a new snapshot of this virtual machine. MOB - https://<vc_ip>/mob/?moid=vm-<vm-id>   // attched screenshot for reference   VirtualMac... See more...
VirtualMachine - CreateSnapshot_Task(createSnapshot) : Creates a new snapshot of this virtual machine. MOB - https://<vc_ip>/mob/?moid=vm-<vm-id>   // attched screenshot for reference   VirtualMachineSnapshotTree: Provides all the information about the hierarchy of snapshots in a virtual machine. MOB - https://<vc_ip>/mob/?moid=vm-<vm-id>&doPath=snapshot.rootSnapshotList  
Below is the sample java code to set the particular controller in adding VirtualDisk.    *unitNumber = The unit number of this device on its controller.    . . int ckey = 0; VirtualDisk disk = ne... See more...
Below is the sample java code to set the particular controller in adding VirtualDisk.    *unitNumber = The unit number of this device on its controller.    . . int ckey = 0; VirtualDisk disk = new VirtualDisk(); VirtualDevice[] vDevice = vmConfigInfo.getHardware().getDevice(); for (int i = 0; i < vDevice.length; i++) { if (vDevice[i].getDeviceInfo().getLabel().equalsIgnoreCase("SCSI Controller 0")) { ckey = vDevice[i].getKey(); break; } } disk.setControllerKey(ckey); disk.setUnitNumber(13); //SCSI Controller 0 - 0:13. . .          
Try with this spec: POST: https://{{vc}}/api/stats/acq-specs   { "counters": { "cid_mid": { "cid": "cpu.usage.PCPU" } }, "expiration": 0, "interval": ... See more...
Try with this spec: POST: https://{{vc}}/api/stats/acq-specs   { "counters": { "cid_mid": { "cid": "cpu.usage.PCPU" } }, "expiration": 0, "interval": 30, "memo_": "Create acq Specs Test", "resources": [ { "id_value": "*", "predicate": "EQUAL", "type": "HOST" } ] }     Response- eg: ------------ "110"
If I understand the question correctly, guess you are looking for the mapping details of VM vnic to guest OS ethernet interface. Please let me know if you are looking for any other details. Sample... See more...
If I understand the question correctly, guess you are looking for the mapping details of VM vnic to guest OS ethernet interface. Please let me know if you are looking for any other details. Sample program to print the Virtual machine network details(Nic name, IPv4, Mac, Nic Key, Portgroup) using vSphere java API. - PrintVMNetworkDetails.java  Output: Network Adatpter IP4Address Mac Key Portgroup ---------------- ---------- --- --- --------- Network adapter 1 10.10.10.6 00:15:23:31:c9:22 4000 VM Network Network adapter 2 10.20.20.7 07:89:61:14:38:66 4001 dvPortgroup Using the above VM network details it is easy to map the guest OS ethernet number.
Use vCLI(vSphere Command-Line Interface) to change vLAN on a particular portgroup in a vSwitch on the standalone ESXi host.   Eg:  > esxcli network vswitch standard portgroup set --portgroup-name=... See more...
Use vCLI(vSphere Command-Line Interface) to change vLAN on a particular portgroup in a vSwitch on the standalone ESXi host.   Eg:  > esxcli network vswitch standard portgroup set --portgroup-name=<port_group> --vlan-id=<VLAN ID>  or  > vicfg-vswitch.pl --pg <port_group> --vlan <VLAN ID>    Reference: https://developer.vmware.com/docs/6676/vsphere-command-line-interface-reference/ https://developer.vmware.com/docs/11743/esxi-7-0-esxcli-command-reference/namespace/esxcli_network.html  
Each sub-resource in a virtual machine (such as disk, cdrom, sata_adapter....) is also called a VirtualDevice. i.e,    VirtualDevice = VirtualDisk, VirtualCdrom, VirtualController,  VirtualEtherne... See more...
Each sub-resource in a virtual machine (such as disk, cdrom, sata_adapter....) is also called a VirtualDevice. i.e,    VirtualDevice = VirtualDisk, VirtualCdrom, VirtualController,  VirtualEthernetCard, VirtualFloppy, VirtualKeyboard, VirtualMachineVideoCard, VirtualPCIPassthrough, VirtualSerialPort, VirtualSoundCard, VirtualTPM, VirtualUSB , .... and more   Every VirtualDevice has a unique "key" that distinguishes this device from other devices in the same virtual machine.   i.e,   Key( integer ) = A unique key that distinguishes this device from other devices in the same virtual machine. Keys are immutable but may be recycled; that is, a key does not change as long as the device is associated with a particular virtual machine. However, once a device is removed, its key may be used when another device is added. This property is not read-only, but the client cannot control its value. Persistent device keys are always assigned and managed by the server, which guarantees that all devices will have non-negative key values. When adding new devices, it may be necessary for a client to assign keys temporarily in order to associate controllers with devices in configuring a virtual machine. However, the server does not allow a client to reassign a device key, and the server may assign a different value from the one passed during configuration. Clients should ensure that existing device keys are not reused as temporary key values for the new device to be added (for example, by using unique negative integers as temporary keys). When editing or deleting a device, clients must use the server-provided key to refer to an existing device.     Virtualdevice Keys: device[100]  =   VirtualPCIController device[200]  =   VirtualIDEController device[300]  =   VirtualPS2Controller device[400]  =   VirtualSIOController device[500]  =   VirtualMachineVideoCard device[600]  =   VirtualKeyboard . . device[3000] =   VirtualCdrom device[2000] =   VirtualDisk . . .   Eg:  Multiple disks in a VM with device keys   Hard Disk 1  = device[2000] =   VirtualDisk Hard Disk 2 = device[2001]  =   VirtualDisk Hard Disk 3 = device[2002] =   VirtualDisk   For more info refer : - Data Object - VirtualDevice(vim.vm.device.VirtualDevice)  - Data Object - VirtualDisk(vim.vm.device.VirtualDisk)
Ues below Rest API and spec, which will relocate both vDisk and VMX file into destination datastore. POST: https://{{vCenter}}/api/vcenter/vm/{vm-id}?action=relocate Spec: ----- { "disks":... See more...
Ues below Rest API and spec, which will relocate both vDisk and VMX file into destination datastore. POST: https://{{vCenter}}/api/vcenter/vm/{vm-id}?action=relocate Spec: ----- { "disks": { "2000": { "datastore": "datastore-11" } }, "placement": { "datastore": "datastore-11" } }  
Please refer to this sample to create Virtual standard switch - Create Virtual Standard Switch
From my understanding, not all vSphere REST APIs for the VM get/post operations are available in the current releases. We may expect all REST APIs in the next vSphere major release. But for your req... See more...
From my understanding, not all vSphere REST APIs for the VM get/post operations are available in the current releases. We may expect all REST APIs in the next vSphere major release. But for your requirement use vSphere management SDK(SOAP-based APIs) to query VM info. Data Object - VirtualMachineRuntimeInfo(vim.vm.RuntimeInfo)  - bootTime Data Object - VirtualMachineQuickStats(vim.vm.Summary.QuickStats)  - uptimeSeconds Data Object - VirtualMachineConfigInfo(vim.vm.ConfigInfo)  - createDate , modified  
VMware vCenter Server Workaround KB -> KB87081  Script vc_log4j_mitigator.py(attached in above KB) will now mitigate CVE-2021-44228 and CVE-2021-45046 on vCenter Server end-to-end without extra st... See more...
VMware vCenter Server Workaround KB -> KB87081  Script vc_log4j_mitigator.py(attached in above KB) will now mitigate CVE-2021-44228 and CVE-2021-45046 on vCenter Server end-to-end without extra steps. This script replaces the need to run remove_log4j_class.py and vmsa-2021-0028-kb87081.py independently. However, it is not necessary to run if you've already used those in your environment.   To List the vulnerable files in vCenter, run script with dryrun option: $ python vc_log4j_mitigator.py -r  
Data Object - VirtualMachineRuntimeInfo(vim.vm.RuntimeInfo)  The RuntimeInfo data object type provides information about the execution state and history of a virtual machine. Properties: bootTi... See more...
Data Object - VirtualMachineRuntimeInfo(vim.vm.RuntimeInfo)  The RuntimeInfo data object type provides information about the execution state and history of a virtual machine. Properties: bootTime* xsd:dateTime   The timestamp when the virtual machine was most recently powered on. This property is updated when the virtual machine is powered on from the poweredOff state, and is cleared when the virtual machine is powered off. This property is not updated when a virtual machine is resumed from a suspended state.   Sample code: -----------------   VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder()) .searchManagedEntity("VirtualMachine", "<VM_Name>"); System.out.println("Recently poweredOn Date::" + vm.getRuntime().getBootTime().getTime());     Another option is to get from the Even history.