Search in sources :

Example 1 with GuestOsDescriptor

use of com.vmware.vim25.GuestOsDescriptor in project cloudstack by apache.

the class ClusterMO method getRecommendedDiskController.

@Override
public String getRecommendedDiskController(String guestOsId) throws Exception {
    VirtualMachineConfigOption vmConfigOption = _context.getService().queryConfigOption(getEnvironmentBrowser(), null, null);
    GuestOsDescriptor guestOsDescriptor = null;
    String diskController = null;
    List<GuestOsDescriptor> guestDescriptors = vmConfigOption.getGuestOSDescriptor();
    for (GuestOsDescriptor descriptor : guestDescriptors) {
        if (guestOsId != null && guestOsId.equalsIgnoreCase(descriptor.getId())) {
            guestOsDescriptor = descriptor;
            break;
        }
    }
    if (guestOsDescriptor != null) {
        diskController = VmwareHelper.getRecommendedDiskControllerFromDescriptor(guestOsDescriptor);
        s_logger.debug("Retrieved recommended disk controller for guest OS : " + guestOsId + " in cluster " + getHyperHostName() + " : " + diskController);
        return diskController;
    } else {
        String msg = "Unable to retrieve recommended disk controller for guest OS : " + guestOsId + " in cluster " + getHyperHostName();
        s_logger.error(msg);
        throw new CloudRuntimeException(msg);
    }
}
Also used : VirtualMachineConfigOption(com.vmware.vim25.VirtualMachineConfigOption) GuestOsDescriptor(com.vmware.vim25.GuestOsDescriptor) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException)

Example 2 with GuestOsDescriptor

use of com.vmware.vim25.GuestOsDescriptor in project cloudstack by apache.

the class VirtualMachineMO method isMemoryHotAddSupported.

public boolean isMemoryHotAddSupported(String guestOsId) throws Exception {
    boolean guestOsSupportsMemoryHotAdd = false;
    boolean virtualHardwareSupportsMemoryHotAdd = false;
    GuestOsDescriptor guestOsDescriptor;
    int virtualHardwareVersion;
    guestOsDescriptor = getGuestOsDescriptor(guestOsId);
    virtualHardwareVersion = getVirtualHardwareVersion();
    // Check if guest operating system supports memory hotadd
    if (guestOsDescriptor != null && guestOsDescriptor.isSupportsMemoryHotAdd()) {
        guestOsSupportsMemoryHotAdd = true;
    }
    // Check if virtual machine is using hardware version 7 or later.
    if (virtualHardwareVersion >= 7) {
        virtualHardwareSupportsMemoryHotAdd = true;
    }
    return guestOsSupportsMemoryHotAdd && virtualHardwareSupportsMemoryHotAdd;
}
Also used : GuestOsDescriptor(com.vmware.vim25.GuestOsDescriptor)

Example 3 with GuestOsDescriptor

use of com.vmware.vim25.GuestOsDescriptor in project cloudstack by apache.

the class VirtualMachineMO method getRecommendedDiskController.

public String getRecommendedDiskController(String guestOsId) throws Exception {
    String recommendedController;
    GuestOsDescriptor guestOsDescriptor = getGuestOsDescriptor(guestOsId);
    recommendedController = VmwareHelper.getRecommendedDiskControllerFromDescriptor(guestOsDescriptor);
    return recommendedController;
}
Also used : GuestOsDescriptor(com.vmware.vim25.GuestOsDescriptor)

Example 4 with GuestOsDescriptor

use of com.vmware.vim25.GuestOsDescriptor in project cloudstack by apache.

the class VirtualMachineMO method getGuestOsDescriptor.

public GuestOsDescriptor getGuestOsDescriptor(String guestOsId) throws Exception {
    GuestOsDescriptor guestOsDescriptor = null;
    String guestId = guestOsId;
    if (guestId == null) {
        guestId = getGuestId();
    }
    ManagedObjectReference vmEnvironmentBrowser = _context.getVimClient().getMoRefProp(_mor, "environmentBrowser");
    VirtualMachineConfigOption vmConfigOption = _context.getService().queryConfigOption(vmEnvironmentBrowser, null, null);
    List<GuestOsDescriptor> guestDescriptors = vmConfigOption.getGuestOSDescriptor();
    for (GuestOsDescriptor descriptor : guestDescriptors) {
        if (guestId != null && guestId.equalsIgnoreCase(descriptor.getId())) {
            guestOsDescriptor = descriptor;
            break;
        }
    }
    return guestOsDescriptor;
}
Also used : VirtualMachineConfigOption(com.vmware.vim25.VirtualMachineConfigOption) GuestOsDescriptor(com.vmware.vim25.GuestOsDescriptor) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 5 with GuestOsDescriptor

use of com.vmware.vim25.GuestOsDescriptor in project cloudstack by apache.

the class VirtualMachineMO method isCpuHotAddSupported.

public boolean isCpuHotAddSupported(String guestOsId) throws Exception {
    boolean guestOsSupportsCpuHotAdd = false;
    boolean virtualHardwareSupportsCpuHotAdd = false;
    GuestOsDescriptor guestOsDescriptor;
    int virtualHardwareVersion;
    int numCoresPerSocket;
    guestOsDescriptor = getGuestOsDescriptor(guestOsId);
    virtualHardwareVersion = getVirtualHardwareVersion();
    // Check if guest operating system supports cpu hotadd
    if (guestOsDescriptor != null && guestOsDescriptor.isSupportsCpuHotAdd()) {
        guestOsSupportsCpuHotAdd = true;
    }
    // If hardware version is 7, then only 1 core per socket is supported. Hot adding multi-core vcpus is not allowed if hardware version is 7.
    if (virtualHardwareVersion >= 8) {
        virtualHardwareSupportsCpuHotAdd = true;
    } else if (virtualHardwareVersion == 7) {
        // Check if virtual machine has only 1 core per socket.
        numCoresPerSocket = getCoresPerSocket();
        if (numCoresPerSocket == 1) {
            virtualHardwareSupportsCpuHotAdd = true;
        }
    }
    return guestOsSupportsCpuHotAdd && virtualHardwareSupportsCpuHotAdd;
}
Also used : GuestOsDescriptor(com.vmware.vim25.GuestOsDescriptor)

Aggregations

GuestOsDescriptor (com.vmware.vim25.GuestOsDescriptor)6 VirtualMachineConfigOption (com.vmware.vim25.VirtualMachineConfigOption)3 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ArrayOfManagedObjectReference (com.vmware.vim25.ArrayOfManagedObjectReference)1 ConnectionResources (io.cloudslang.content.vmware.connection.ConnectionResources)1 MorObjectHandler (io.cloudslang.content.vmware.services.helpers.MorObjectHandler)1