Interface HypervisorMXBean
- All Superinterfaces:
PlatformManagedObject
- All Known Implementing Classes:
HypervisorMXBeanImpl
This interface provides information on whether the current Operating System is running directly on physical hardware
or running as a Guest (Virtual Machine (VM)/Logical Partition (LPAR)) on top of a Hypervisor.
If the Operating System is running as a Guest, the interface provides information about the Hypervisor.
Where there are multiple levels of Hypervisor, only the top level Hypervisor information is returned.
The supported Hypervisors and the platforms on which they are supported:
Usage example for the
- Linux and Windows on VMWare (IBM Java 8 only).
- Linux and Windows on KVM.
- Windows on Hyper-V.
- AIX and Linux on PowerVM.
- Linux and z/OS on z/VM.
- Linux and z/OS on PR/SM.
On some hardware, Hypervisor detection might fail, even if the Hypervisor and Operating System combination is supported. In this case you can set an Environment variable - IBM_JAVA_HYPERVISOR_SETTINGS that forces the JVM to recognize the Hypervisor.
- For example: On Windows to set the Hypervisor as VMWare,
set IBM_JAVA_HYPERVISOR_SETTINGS="DefaultName=VMWare" - Other valid Hypervisor name strings (case insensitive):
- VMWare, Hyper-V, KVM, PowerVM, PR/SM, z/VM.
- If the actual Hypervisor and the one provided through the Environment variable differ, the results are indeterminate.
Usage example for the
HypervisorMXBean
...
try {
mxbeanName = new ObjectName("com.ibm.virtualization.management:type=Hypervisor");
} catch (MalformedObjectNameException e) {
// Exception Handling
}
try {
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (true != mbeanServer.isRegistered(mxbeanName)) {
// HypervisorMXBean not registered
}
HypervisorMXBean hypBean = JMX.newMXBeanProxy(mbeanServer, mxbeanName, HypervisorMXBean.class);
} catch (Exception e) {
// Exception Handling
}
- Since:
- 1.7.1
-
Method Summary
Modifier and TypeMethodDescriptionReturns the vendor of the Hypervisor if running in a virtualized environment.boolean
Indicates if the Operating System is running on a Hypervisor or not.Methods declared in interface java.lang.management.PlatformManagedObject
getObjectName
-
Method Details
-
isEnvironmentVirtual
boolean isEnvironmentVirtual() throws UnsupportedOperationException, HypervisorInfoRetrievalExceptionIndicates if the Operating System is running on a Hypervisor or not.- Returns:
- true if running on a Hypervisor, false otherwise.
- Throws:
UnsupportedOperationException
- if the underlying Hypervisor is unsupported.HypervisorInfoRetrievalException
- if there is an error during Hypervisor detection.
-
getVendor
String getVendor()Returns the vendor of the Hypervisor if running in a virtualized environment.- Returns:
- string identifying the vendor of the Hypervisor if running under Hypervisor, null otherwise.
-