[Kimchi-devel] Rethink the Relationship of Template and VM

Zhou Zheng Sheng zhshzhou at linux.vnet.ibm.com
Sun Apr 27 14:38:36 UTC 2014


Hi all,

I'm working on host device passthrough. A a problem troubles me: I see
in current Kimchi code, when adding a specific SCSI or iSCSI LUN, it is
added to the template but not the VM. This is counter-intuitive, because
a template is to store the common information for lots of VMs, while a
specific LUN should only be used by just one VM. It's OK for DIR, NFS
and Logical storage pool being managed by the template, because actually
the template allocates a new specific volume for a new VM, so the
specific volume goes with the specific VM but not the template. Since we
don't define a specific DIR storage volume in the template, why we
define a concrete LUN in it?

The first problem in the current design is that we can not attach a new
LUN to a VM after the VM is created.

Another problem is that we mix the "things in common" and "things
special" in template, thus we make its responsibility complex. Static
and dynamic validations are also mixed in template.

The third problem is that if we get 10 LUNs for 10 VMs, the user has to
create 10 templates at first, then create 10 VMs from the 10 templates
respectively. It's a bit tedious.

The fourth problem is that if a LUN is used by a VM, usually it should
not be used by other VMs, so it implies that by specifying a LUN in a
template, the template should only create just one VM. What's the point
to make a template that only produces one VM?

It seems a cleaner way is putting SCSI LUN handling code in VM. Firstly,
we can assign a SCSI/iSCSI storage pool to the template. When it's time
to create a VM from the template, Kimchi lists all the available LUNs in
the storage pool and the user can just pick some LUNs. The VM override
parameters are suitable to store the LUNs information. It also makes
possible to implement some mechanisms to add/remove LUNs after a VM is
created, which is a very typical user requirement.

The same problem exists in host device passthrough. For a specific
device, it should be passthrough to a specific VM but not a template.
I'd like to collect some thoughts before my device passthrough patch V2.
In which place you'd suggest me to put device passthrough information,
template or VM?

Thanks for sharing your ideas!

-- 
Thanks and best regards!

Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou at linux.vnet.ibm.com
Telephone: 86-10-82454397




More information about the Kimchi-devel mailing list