use of org.ovirt.engine.api.v3.types.V3DiskSnapshot in project ovirt-engine by oVirt.
the class V3DiskSnapshotOutAdapter method adapt.
@Override
public V3DiskSnapshot adapt(DiskSnapshot from) {
V3DiskSnapshot to = new V3DiskSnapshot();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptOut(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptOut(from.getActions()));
}
if (from.isSetActualSize()) {
to.setActualSize(from.getActualSize());
}
if (from.isSetAlias()) {
to.setAlias(from.getAlias());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisk()) {
to.setDisk(adaptOut(from.getDisk()));
}
if (from.isSetDiskProfile()) {
to.setDiskProfile(adaptOut(from.getDiskProfile()));
}
if (from.isSetFormat()) {
to.setFormat(from.getFormat().value());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetImageId()) {
to.setImageId(from.getImageId());
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptOut(from.getInstanceType()));
}
if (from.isSetLogicalName()) {
to.setLogicalName(from.getLogicalName());
}
if (from.isSetLunStorage()) {
to.setLunStorage(adaptOut(from.getLunStorage()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOpenstackVolumeType()) {
to.setOpenstackVolumeType(adaptOut(from.getOpenstackVolumeType()));
}
if (from.isSetPropagateErrors()) {
to.setPropagateErrors(from.isPropagateErrors());
}
if (from.isSetProvisionedSize()) {
to.setProvisionedSize(from.getProvisionedSize());
}
if (from.isSetQuota()) {
to.setQuota(adaptOut(from.getQuota()));
}
if (from.isSetReadOnly()) {
to.setReadOnly(from.isReadOnly());
}
if (from.isSetSgio()) {
to.setSgio(from.getSgio().value());
}
if (from.isSetShareable()) {
to.setShareable(from.isShareable());
}
if (from.isSetSnapshot()) {
to.setSnapshot(adaptOut(from.getSnapshot()));
}
if (from.isSetSparse()) {
to.setSparse(from.isSparse());
}
if (from.isSetStatistics()) {
to.setStatistics(new V3Statistics());
to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
}
if (from.isSetStatus()) {
V3Status status = new V3Status();
status.setState(from.getStatus().value());
to.setStatus(status);
}
if (from.isSetStorageDomain()) {
to.setStorageDomain(adaptOut(from.getStorageDomain()));
}
if (from.isSetStorageDomains()) {
to.setStorageDomains(new V3StorageDomains());
to.getStorageDomains().getStorageDomains().addAll(adaptOut(from.getStorageDomains().getStorageDomains()));
}
if (from.isSetStorageType()) {
to.setStorageType(from.getStorageType().value());
}
if (from.isSetTemplate()) {
to.setTemplate(adaptOut(from.getTemplate()));
}
if (from.isSetUsesScsiReservation()) {
to.setUsesScsiReservation(from.isUsesScsiReservation());
}
if (from.isSetVm()) {
to.setVm(adaptOut(from.getVm()));
}
if (from.isSetVms()) {
to.setVms(new V3VMs());
to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
}
if (from.isSetWipeAfterDelete()) {
to.setWipeAfterDelete(from.isWipeAfterDelete());
}
// continue supporting it. To do so we need to find the disk attachment and copy this attribute to the disk.
if (to.isSetId() && to.isSetVm() && to.getVm().isSetId()) {
String diskId = to.getId();
String vmId = to.getVm().getId();
VmsResource vmsResource = BackendApiResource.getInstance().getVmsResource();
VmResource vmResource = vmsResource.getVmResource(vmId);
DiskAttachmentsResource attachmentsResource = vmResource.getDiskAttachmentsResource();
DiskAttachmentResource attachmentResource = attachmentsResource.getAttachmentResource(diskId);
DiskAttachment attachment = attachmentResource.get();
if (attachment.isSetActive()) {
to.setActive(attachment.isActive());
}
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3DiskSnapshot in project ovirt-engine by oVirt.
the class V3DiskSnapshotInAdapter method adapt.
@Override
public DiskSnapshot adapt(V3DiskSnapshot from) {
DiskSnapshot to = new DiskSnapshot();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActualSize()) {
to.setActualSize(from.getActualSize());
}
if (from.isSetAlias()) {
to.setAlias(from.getAlias());
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisk()) {
to.setDisk(adaptIn(from.getDisk()));
}
if (from.isSetDiskProfile()) {
to.setDiskProfile(adaptIn(from.getDiskProfile()));
}
if (from.isSetFormat()) {
to.setFormat(DiskFormat.fromValue(from.getFormat()));
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetImageId()) {
to.setImageId(from.getImageId());
}
if (from.isSetInstanceType()) {
to.setInstanceType(adaptIn(from.getInstanceType()));
}
if (from.isSetLogicalName()) {
to.setLogicalName(from.getLogicalName());
}
if (from.isSetLunStorage()) {
to.setLunStorage(adaptIn(from.getLunStorage()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOpenstackVolumeType()) {
to.setOpenstackVolumeType(adaptIn(from.getOpenstackVolumeType()));
}
if (from.isSetPropagateErrors()) {
to.setPropagateErrors(from.isPropagateErrors());
}
if (from.isSetProvisionedSize()) {
to.setProvisionedSize(from.getProvisionedSize());
}
if (from.isSetQuota()) {
to.setQuota(adaptIn(from.getQuota()));
}
if (from.isSetReadOnly()) {
to.setReadOnly(from.isReadOnly());
}
if (from.isSetSgio()) {
to.setSgio(ScsiGenericIO.fromValue(from.getSgio()));
}
if (from.isSetShareable()) {
to.setShareable(from.isShareable());
}
if (from.isSetSnapshot()) {
to.setSnapshot(adaptIn(from.getSnapshot()));
}
if (from.isSetSparse()) {
to.setSparse(from.isSparse());
}
if (from.isSetStatistics()) {
to.setStatistics(new Statistics());
to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
}
if (from.isSetStatus() && from.getStatus().isSetState()) {
to.setStatus(DiskStatus.fromValue(from.getStatus().getState()));
}
if (from.isSetStorageDomain()) {
to.setStorageDomain(adaptIn(from.getStorageDomain()));
}
if (from.isSetStorageDomains()) {
to.setStorageDomains(new StorageDomains());
to.getStorageDomains().getStorageDomains().addAll(adaptIn(from.getStorageDomains().getStorageDomains()));
}
if (from.isSetStorageType()) {
to.setStorageType(DiskStorageType.fromValue(from.getStorageType()));
}
if (from.isSetTemplate()) {
to.setTemplate(adaptIn(from.getTemplate()));
}
if (from.isSetUsesScsiReservation()) {
to.setUsesScsiReservation(from.isUsesScsiReservation());
}
if (from.isSetVm()) {
to.setVm(adaptIn(from.getVm()));
}
if (from.isSetVms()) {
to.setVms(new Vms());
to.getVms().getVms().addAll(adaptIn(from.getVms().getVMs()));
}
if (from.isSetWipeAfterDelete()) {
to.setWipeAfterDelete(from.isWipeAfterDelete());
}
return to;
}
Aggregations