def get_virtual_disk_count(cls, client_object, vm_ip_address=None, esx_host_ip=None, esx_username=None, esx_password=None, **kwargs): """ Fetches the VIRTUAL DISK COUNT for given VM IP Addr The method uses the ESX ip and credentials to create the ESX managed object reference. Next it uses the ESX mor to fetch MOID of given vm_ip_address Thereafter it fetches the Disk Count using the moid Finally returns the fetched value to calling method @type client_object: instance @param client_object: VMAPIClient object. @rtype: int @param: Virtual Disk Count """ hc = esx_facade.ESXFacade(esx_host_ip, esx_username, esx_password) edge_moid = hc.fetch_moid_from_ip(vm_ip_address=vm_ip_address) vm = vm_facade.VMFacade(edge_moid, parent=hc) actual_virtual_disk_count = vm.get_virtual_disk_count() pylogger.debug("actual_virtual_disk_count retrieved ...%s ", actual_virtual_disk_count) pydict = {'expected_virtual_disk_count': actual_virtual_disk_count} return pydict
def get_nic_status(cls, client_object, vm_ip_address=None, vnic_index=None, esx_host_ip=None, esx_username=None, esx_password=None, **kwargs): """ Fetches the NIC STATUS for given VM IP Addr and vnic_index The method uses the ESX ip and credentials to create the ESX managed object reference. Next it uses the ESX mor to fetch MOID of given vm_ip_address Thereafter it fetches the NIC Status for the given index using the moid Finally returns the fetched value to calling method @type client_object: instance @param client_object: VMAPIClient object. @rtype: str @param: NIC Status """ hc = esx_facade.ESXFacade(esx_host_ip, esx_username, esx_password) edge_moid = hc.fetch_moid_from_ip(vm_ip_address=vm_ip_address) vm = vm_facade.VMFacade(edge_moid, parent=hc) actual_nic_status = vm.get_nic_status(vnic_index=int(vnic_index)) pylogger.debug("actual_nic_status retrieved ...%s ", actual_nic_status) pydict = {'expected_nic_status': actual_nic_status} return pydict
def get_guest_net_info(cls, client_object, vm_name=None, host_ip=None, username=None, password=None, **kwargs): """ Fetches guest net info for given VM name The method uses the ESX ip and credentials to create the ESX managed object reference. Next it uses the ESX mor to fetch MOID of given vm_name Finally returns the fetched value to calling method @type client_object: instance @param client_object: VMAPIClient object. @rtype: table @param: guest net info table """ hc = esx_facade.ESXFacade(host_ip, username, password) edge_moid = hc.fetch_vm_mor_from_name(vm_name=vm_name) vm = vm_facade.VMFacade(edge_moid, parent=hc) return vm.get_guest_net_info()
def get_max_cpu_usage(cls, client_object, vm_ip_address=None, esx_host_ip=None, esx_username=None, esx_password=None, **kwargs): """ Fetches the MAX CPU value for given VM IP Addr The method uses the ESX ip and credentials to create the ESX managed object reference. Next it uses the ESX mor to fetch MOID of given vm_ip_address Thereafter it fetches the Maximum CPU Usage for the given moid Finally returns the fetched value to calling method @type client_object: instance @param client_object: VMAPIClient object. @rtype: str @param: Maximum CPU Usage """ hc = esx_facade.ESXFacade(esx_host_ip, esx_username, esx_password) edge_moid = hc.fetch_moid_from_ip(vm_ip_address=vm_ip_address) vm = vm_facade.VMFacade(edge_moid, parent=hc) actual_max_cpu_usage = vm.get_max_cpu_usage() pylogger.debug("actual_max_cpu_usage retrieved ...%s ", actual_max_cpu_usage) pydict = {'expected_max_cpu_usage': actual_max_cpu_usage} return pydict