Liron Ar has posted comments on this change. Change subject: core, restapi: Introducing support for attaching disk snapshot ......................................................................
Patch Set 32: (5 comments) .................................................... Commit Message Line 3: AuthorDate: 2013-08-26 16:35:47 +0300 Line 4: Commit: Liron Aravot <lara...@redhat.com> Line 5: CommitDate: 2013-10-16 00:27:38 +0300 Line 6: Line 7: core, restapi: Introducing support for attaching disk snapshot Done (Added for 3.3) Line 8: Line 9: This patch adds the engine support for attaching a disk snapshot to a Line 10: VM (currently different VM than the one for which the VM Line 11: snapshot was taken). .................................................... File backend/manager/modules/restapi/interface/common/jaxrs/src/main/java/org/ovirt/engine/api/common/util/LinkHelper.java Line 694: setHref(uriInfo, model, suggestedParentType); Line 695: if (addActions) { Line 696: setActions(uriInfo, model, suggestedParentType); Line 697: } Line 698: as discussed f2f, it's needed to avoid adding the actions in case we call the addLinks method "directly" on the parent , snapshot in that case(in that case, could be for any object) Line 699: for (BaseResource inline : getInlineResources(model)) { Line 700: if (inline.getId() != null) { Line 701: setHref(uriInfo, inline); Line 702: } .................................................... File backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml Line 553: disk.storage_domains.storage_domain--COLLECTION: {storage_domain.id|name: 'xs:string'} Line 554: description: add a new direct lun disk to the virtual machine, this operation does not require size but needs lun connection details Line 555: - mandatoryArguments: {disk.id: 'xs:string'} Line 556: optionalArguments: {disk.active: 'xs:boolean', disk.snapshot.id: xs:string} Line 557: description: attach a disk or disk snapshot to the virtual machine Done Line 558: urlparams: {} Line 559: headers: Line 560: Content-Type: {value: application/xml|json, required: true} Line 561: Expect: {value: 201-created, required: false} .................................................... File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmDisksResource.java Line 119: model.setSnapshot(null); Line 120: super.addLinks(model, subCollectionMembersToExclude); Line 121: if (snapshotInfo != null) { Line 122: VdcQueryReturnValue queryReturnValue = Line 123: runQuery(VdcQueryType.GetSnapshotBySnapshotId, commented there, copied here: When querying the disk object, it has property with the guid of it's originating snapshot and not the complete snapshot object, thus we don't have the vm id. At the moment the backend won't fetch the snapshot info for each disk and we'll keep it as guid..therefore executing this is mandatory - when we'll possibly add other uses for this "snapshot" a query and related changes might be added/modified. Line 124: new IdQueryParameters(asGuid(snapshotInfo.getId()))); Line 125: if (queryReturnValue.getSucceeded() && queryReturnValue.getReturnValue() != null) { Line 126: org.ovirt.engine.core.common.businessentities.Snapshot snapshot = queryReturnValue.getReturnValue(); Line 127: VM vm = new VM(); .................................................... File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DiskMapper.java Line 112: if (disk.isSetStatus()) { Line 113: diskImage.setImageStatus(map(DiskStatus.fromValue(disk.getStatus().getState()))); Line 114: } Line 115: if (disk.isSetSnapshot() && disk.getSnapshot().isSetId()) { Line 116: diskImage.setVmSnapshotId(GuidUtils.asGuid(disk.getSnapshot().getId())); Done Line 117: } Line 118: if (disk.isSetSparse()) { Line 119: diskImage.setVolumeType(disk.isSparse() ? VolumeType.Sparse : VolumeType.Preallocated); Line 120: } -- To view, visit http://gerrit.ovirt.org/17679 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I02579bf1a91cd294a5040acf432f1fdb87eb18c1 Gerrit-PatchSet: 32 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Alissa Bonas <abo...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Ayal Baron <aba...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches