Search in sources :

Example 1 with VmJobType

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

the class VdsBrokerObjectsBuilder method buildVmJobData.

private static VmJob buildVmJobData(Guid vmId, Map<String, Object> struct) {
    VmJob ret;
    VmJobType jobType = VmJobType.getByName(assignStringValue(struct, VdsProperties.vmJobType));
    if (jobType == null) {
        jobType = VmJobType.UNKNOWN;
    }
    switch(jobType) {
        case BLOCK:
            VmBlockJob blockJob = new VmBlockJob();
            blockJob.setBlockJobType(VmBlockJobType.getByName(assignStringValue(struct, VdsProperties.vmBlockJobType)));
            blockJob.setCursorCur(assignLongValue(struct, VdsProperties.vmJobCursorCur));
            blockJob.setCursorEnd(assignLongValue(struct, VdsProperties.vmJobCursorEnd));
            blockJob.setBandwidth(assignLongValue(struct, VdsProperties.vmJobBandwidth));
            blockJob.setImageGroupId(new Guid(assignStringValue(struct, VdsProperties.vmJobImageUUID)));
            ret = blockJob;
            break;
        default:
            ret = new VmJob();
            break;
    }
    ret.setVmId(vmId);
    ret.setId(new Guid(assignStringValue(struct, VdsProperties.vmJobId)));
    ret.setJobState(VmJobState.NORMAL);
    ret.setJobType(jobType);
    return ret;
}
Also used : VmJobType(org.ovirt.engine.core.common.businessentities.VmJobType) VmJob(org.ovirt.engine.core.common.businessentities.VmJob) VmBlockJob(org.ovirt.engine.core.common.businessentities.VmBlockJob) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

VmBlockJob (org.ovirt.engine.core.common.businessentities.VmBlockJob)1 VmJob (org.ovirt.engine.core.common.businessentities.VmJob)1 VmJobType (org.ovirt.engine.core.common.businessentities.VmJobType)1 Guid (org.ovirt.engine.core.compat.Guid)1