On Wed, Sep 21, 2011 at 07:10:28AM +0300, Yaniv Kaul wrote:
On 09/21/2011 04:58 AM, Adam Litke wrote:
As it currently stands, images are created implicitly when a volume is created using a new imageUUID. Although this is practical for the current use cases, it doesn't present a semetrical API. Other vdsm objects have create/delete methods.i
Furthermore, it preents challenges when trying to model VDSM in a REST API. Let's say I want to create a new disk for a VM. I would want to issue the following sequence of commands:
POST -> /vdsm-api/storagedomains/<sdUUID>/images/create <- HTTP/202 Accepted: /vdsm-api/tasks/<task-uuid> GET -> /vdsm-api/tasks/<task-uuid> <- HTTP/200 OK: /vdsm-api/storagedomains/<sdUUID>/images/<imgUUID> POST -> /vdsm-api/storagedomains/<sdUUID>/images/<imgUUID>/volumes/create <- HTTP/202 Accepted: /vdsm-api/tasks/<task-uuid> GET -> /vdsm-api/tasks/<task-uuid> <- HTTP/200 OK: /vdsm-api/storagedomains/<sdUUID>/images/<imgUUID>/volumes/<volUUID>
The only way to support this pattern is to allow for the explicit creation of an image with an empty volume chain.
Signed-off-by: Adam Litkeagl@us.ibm.com
diff --git a/vdsm/storage/spm.py b/vdsm/storage/spm.py index 849b9d2..1222752 100644 --- a/vdsm/storage/spm.py +++ b/vdsm/storage/spm.py @@ -820,6 +820,23 @@ class SPM: repoPath = os.path.join(self.storage_repository, spUUID) image.Image(repoPath).multiMove(srcDomUUID, dstDomUUID, imgDict, vmUUID, force)
- def createImage(self, sdUUID, spUUID, imgUUID):
"""
Create a new, empty image
:param sdUUID: The UUID of the storage domain that contains the images.
:type sdUUID: UUID
:param spUUID: The UUID of the storage pool that contains the images.
:type spUUID: UUID
:param imgUUID: The UUID of the image you want to delete.
why delete?
Oops. That was a result of a hasty copy/paste of arguments documentation from deleteImage() :) I will fix.