On 04/17/2012 05:54 PM, Itamar Heim wrote:
> If we can expose the "shared" flag though, i think the
API gets more
> natural. We can then only show the shared disks in the root context.
>
> Itamar, can we expose this flag, or do you consider this flag is
> internal to the BE?
we have to expose this flag for shared disk functionality. this is the
only way via ui/api to flag the disk as shared (which only then allows
attaching it to more than a single vm - this is explicit to avoid disk
corruptions)
OK, understood.
Which then begs the question - why we are trying to make the setting /
unsetting of this flag implicit via the various POST and DELETE calls we
were trying to model.
Maybe we ought to just allow a user to set the shared flag:
PUT /api/vms/{vm:id}/disks/{disk:id}
<disk>
<shared>true|false</shared>
</disk>
When a disk is shared:
- The disks shows up in the root context /api/disks.
- You can POST this disk to another VM, making it available to that VM.
- Detach it from a VM using DELETE.
To delete a shared disk, you need to either:
- Unshare it first. Then DELETE.
- DELETE it from the root context.
Regards,
Geert