[Kimchi-devel] [PATCH V2] Create new storage volume when attaching disk to a guest.

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Fri Nov 13 16:46:02 UTC 2015


On Fri, 2015-11-13 at 14:34 -0200, Aline Manera wrote:
> Hi Paulo,
> 
> As we have discussed about it in the last scrum meeting, we can use
> the 
> existing APIs to provide this feature.
> 
> POST /storagepools/<pool>/storagevolumes {capacity:..., format:..}
> POST /vms/<name>/storages {vol:..}
> 
> We just need to confirm it is working properly and add necessary
> tests 
> to cover this scenario.
> 

test_model.ModelTests.test_vm_disk already does this. It creates a new
volume and then attach it to a VM, in both cold and hot plug cases.


> Regards,
> Aline Manera
> 
> On 11/11/2015 11:43, pvital at linux.vnet.ibm.com wrote:
> > From: Paulo Vital <pvital at linux.vnet.ibm.com>
> > 
> > Changes in V2:
> >   * Updated test cases
> >   * Modified dictionary return of parameters
> > 
> > V1:
> > 
> > Add back-end support to create new storage volume (new virtual
> > disk) when
> > attaching disk to a guest created before.
> >      
> > There are three essential parameters to create the new volume:
> >       * vol: Storage volume name of disk image, that should be
> > 'new_vol'.
> >       * capacity: The total space which can be used to store new
> > volumes.
> >                   The unit is bytes.
> >       * format: The format of the defined Storage Volume. Only used
> > when creating
> >                 a storage volume with 'capacity'.
> >      
> > To test this patch:
> > 
> > $ curl -k -u test -H "Content-Type: application/json" -H "Accept:
> > application/json" 'https://localhost:8001/plugins/kimchi/vms/kimchi
> > -vm-new/storages' -X POST -d '{ "vol": "new_vol", "type": "disk",
> > "pool": "default", "format": "qcow2", "capacity": 1024 }'
> > Enter host password for user 'test':
> > {
> >    "bus":"virtio",
> >    "path":"/var/lib/libvirt/images/2477bfd8-a9e2-4887-a683-
> > e89015b3ba11
> > -1.img",
> >    "type":"disk",
> >    "dev":"vdb",
> >    "format":"qcow2"
> > }
> > 
> > $ curl -k -u test -H "Content-Type: application/json" -H "Accept:
> > application/json" 'https://localhost:8001/plugins/kimchi/vms/kimchi
> > -vm-new/storages' -X GET
> > Enter host password for user 'test':
> > [
> >    {
> >      "bus":"virtio",
> >      "path":"/var/lib/libvirt/images/2477bfd8-a9e2-4887-a683
> > -e89015b3ba11-0.img",
> >      "type":"disk",
> >      "dev":"vda",
> >      "format":"qcow2"
> >    },
> >    {
> >      "bus":"virtio",
> >      "path":"/var/lib/libvirt/images/2477bfd8-a9e2-4887-a683
> > -e89015b3ba11-1.img",
> >      "type":"disk",
> >      "dev":"vdb",
> >      "format":"qcow2"
> >    },
> >    {
> >      "bus":"ide",
> >      "path":"/var/lib/kimchi/tests/ubuntu14.04.iso",
> >      "type":"cdrom",
> >      "dev":"hdc",
> >      "format":"raw"
> >    }
> > ]
> > 
> > 
> > Paulo Vital (1):
> >    Create new storage volume when attaching disk to a guest.
> > 
> >   src/wok/plugins/kimchi/API.json            | 12 ++++++++++++
> >   src/wok/plugins/kimchi/docs/API.md         |  6 +++++-
> >   src/wok/plugins/kimchi/i18n.py             |  1 +
> >   src/wok/plugins/kimchi/model/vmstorages.py | 28
> > +++++++++++++++++++++++++++-
> >   src/wok/plugins/kimchi/tests/test_model.py | 25
> > +++++++++++++++++++++++++
> >   5 files changed, 70 insertions(+), 2 deletions(-)
> > 
> 




More information about the Kimchi-devel mailing list