[Kimchi-devel] [RFC]Attatch Disk to VM

Royce Lv lvroyce at linux.vnet.ibm.com
Fri Feb 14 07:04:38 UTC 2014


This RFC is to illustrate how attach disk to vm works and what the API 
looks like.

Use case:
     1. Guest wants to attach a volume which contains data.
     2. Guest is running out of storage space, attach an empty volume to 
extend storage space.

Flow:
     1. Create a **float** volume in a storage pool.(float means this 
volume will not be deleted when vm's deleted, it is independent from vm)
         Only **float** volume can be attached to vm.(to solve volume 
ref count problem), All volumes created from storage tab is float ones,
         because embedded storage is created when vm's created.

         POST /storagepools/pool-1/storagevolumes/
            {'float': True, 'size':10G, 'name': 'a-float-volume'}
         GET /storagepools/pool-1/storagevolumes/a-float-volume
            {'float': True, 'ref_count':0, ...}

     2. On vm tab, list all availabe float volumes, currently only 
support ref_count=0 volumes, select one and attach it to vm.
         GET /storagepools/pool-1/storagevolumes?float=True&ref_count=0
         GET /storagepools/pool-2/storagevolumes?float=True&ref_count=0
         ...
         POST /vms/vm-1/storages/
         {'storagepool': 'pool-1', 'storagevolume':'a-float-volume', 
'dev': 'hda', 'type':'disk'}

     3. Detaching a disk from a vm, NOTE: this will make no change to 
content in the volume, just make it isolated from vm, if you want to 
delete storage, go to storage tab.
         DELETE /vms/vm-1/storages/hda

NOTE:
     This means we support disks from different storagepool,
     Temporarily we don't support share disk (in the future it will be 
handled in a single feature).
     VM deletion will not involve float disk.
     As PCI hotplug already supported, we can add disk to a running vm.

Thanks to Mark Wu to contribute idea of float to solve volume life cycle 
problem. Part of the inner implementation already be done by Rodrigo and 
Daniel, I will try to extend their implementation for hard disk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140214/27b76daa/attachment.html>


More information about the Kimchi-devel mailing list