Search in sources :

Example 1 with HostJobType

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

the class GetHostJobsVDSCommand method parseJob.

private HostJobInfo parseJob(Map<String, Object> job) {
    Guid id = Guid.createGuidFromString((String) job.get(VdsProperties.jobId));
    HostJobType type = HostJobType.valueOf((String) job.get(VdsProperties.jobType));
    HostJobStatus status = HostJobStatus.valueOf((String) job.get(VdsProperties.jobStatus));
    String description = (String) job.get(VdsProperties.jobDescription);
    Integer jobProgress = job.containsKey(VdsProperties.jobProgress) ? ((Double) job.get(VdsProperties.jobProgress)).intValue() : null;
    VDSError error = null;
    if (job.containsKey(VdsProperties.jobError)) {
        Map<String, Object> errorInfo = (Map<String, Object>) job.get(VdsProperties.jobError);
        Integer code = (Integer) errorInfo.get(VdsProperties.jobErrorCode);
        String message = (String) errorInfo.get(VdsProperties.jobErrorMessage);
        error = new VDSError(EngineError.forValue(code), message);
    }
    return new HostJobInfo(id, description, type, status, jobProgress, error);
}
Also used : HostJobStatus(org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobStatus) VDSError(org.ovirt.engine.core.common.errors.VDSError) Guid(org.ovirt.engine.core.compat.Guid) HostJobType(org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobType) HostJobInfo(org.ovirt.engine.core.common.businessentities.HostJobInfo) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 HostJobInfo (org.ovirt.engine.core.common.businessentities.HostJobInfo)1 HostJobStatus (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobStatus)1 HostJobType (org.ovirt.engine.core.common.businessentities.HostJobInfo.HostJobType)1 VDSError (org.ovirt.engine.core.common.errors.VDSError)1 Guid (org.ovirt.engine.core.compat.Guid)1