Search in sources :

Example 1 with OsType

use of org.ovirt.engine.core.common.businessentities.OsType in project ovirt-engine by oVirt.

the class VdsBrokerObjectsBuilder method updateGuestOsInfo.

private static void updateGuestOsInfo(VmDynamic vm, Map<String, Object> struct) {
    Map<String, Object> guestOsInfoStruct = (Map<String, Object>) struct.get(VdsProperties.GUEST_OS_INFO);
    if (guestOsInfoStruct.containsKey(VdsProperties.GUEST_OS_INFO_ARCH)) {
        String arch = assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_ARCH);
        try {
            vm.setGuestOsArch(arch);
        } catch (IllegalArgumentException e) {
            log.warn("Invalid or unknown guest architecture type '{}' received from guest agent", arch);
        }
    }
    vm.setGuestOsCodename(assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_CODENAME));
    vm.setGuestOsDistribution(assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_DISTRIBUTION));
    vm.setGuestOsKernelVersion(assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_KERNEL));
    if (guestOsInfoStruct.containsKey(VdsProperties.GUEST_OS_INFO_TYPE)) {
        String osType = assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_TYPE);
        try {
            OsType type = EnumUtils.valueOf(OsType.class, osType, true);
            vm.setGuestOsType(type);
        } catch (IllegalArgumentException e) {
            log.warn("Invalid or unknown guest os type '{}' received from guest agent", osType);
        }
    } else {
        log.warn("Guest OS type not reported by guest agent but expected.");
    }
    vm.setGuestOsVersion(assignStringValue(guestOsInfoStruct, VdsProperties.GUEST_OS_INFO_VERSION));
}
Also used : OsType(org.ovirt.engine.core.common.businessentities.OsType) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 OsType (org.ovirt.engine.core.common.businessentities.OsType)1