public static void validateAdd(Snapshot snapshot) { if (snapshot == null) { throw new ValidationException("Parameter 'snapshot' is mandatory but was not provided."); } if (snapshot.getDescription()==null) { throw new ValidationException("Parameter 'snapshot.description' is mandatory but was not provided."); } }
protected Snapshots mapCollection(List<org.ovirt.engine.core.common.businessentities.Snapshot> entities) { Snapshots snapshots = new Snapshots(); for (org.ovirt.engine.core.common.businessentities.Snapshot entity : entities) { Snapshot snapshot = map(entity, null); snapshot = populate(snapshot, entity); snapshot = addLinks(snapshot); try { snapshot = addVmConfiguration(entity, snapshot); } catch (WebFaultException wfe) { // Avoid adding the snapshot to the response if the VM configuration is missing. // This scenario might be caused by initiating a snapshot deletion request // right before listing the snapshots. See: https://bugzilla.redhat.com/1530603 if (Response.Status.NOT_FOUND.getStatusCode() == wfe.getResponse().getStatus()) { log.warn("Missing VM configuration for snapshot \"{}\". " + "Excluding the snapshot from response.", snapshot.getDescription()); continue; } throw wfe; } snapshots.getSnapshots().add(snapshot); } return snapshots; }
protected Response doAdd(Snapshot snapshot, boolean block) { validateParameters(snapshot, "description"); CreateSnapshotForVmParameters snapshotParams = new CreateSnapshotForVmParameters(parentId, snapshot.getDescription()); if (snapshot.isSetPersistMemorystate()) { snapshotParams.setSaveMemory(snapshot.isPersistMemorystate()); } if (snapshot.isSetDiskAttachments()) { Map<Guid, Guid> diskToImageIds = mapDisks(snapshot.getDiskAttachments()); snapshotParams.setDiskIds(new TreeSet<>(diskToImageIds.keySet())); snapshotParams.setDiskToImageIds(diskToImageIds); } return performCreate(ActionType.CreateSnapshotForVm, snapshotParams, new SnapshotIdResolver(), block); }
@Override protected void verifyModel(Snapshot model, int index) { assertEquals(GUIDS[index].toString(), model.getId()); assertEquals(DESCRIPTIONS[index], model.getDescription()); verifyLinks(model); }
@Override protected void verifyModel(Snapshot model, int index) { assertEquals(GUIDS[index].toString(), model.getId()); assertEquals(DESCRIPTIONS[index], model.getDescription()); verifyLinks(model); } }
to.setDescription(from.getDescription());