Skip to contentSkip to conversation

libxenlight driver

RFC Jim Fehlig 7 participants 11 messages Jan 21, 2011 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jim Fehlig

author
#2 lore raw
Quoted 15 lines · Daniel P. Berrange
Quoted 4 lines · Jim Fehlig

I'm looking into creating a driver for the new Xen xl/libxl toolstack (aka libxenlight [1]), set to become the default in upcoming Xen 4.1.0 release.

Quoted 8 lines

My first hurdle is deciding whether this should be a new driver or integrated with existing xen-unified driver. Initially I thought a new driver would be a better approach - a clean break from the old code, similar to the xenapi driver. libxenlight is also stateless (no managed domains), which seems like another good argument for a new driver. But libxenlight is really just another interface into the same hypervisor, so in that regard it should be a xen-unified subdriver.

Quoted 5 lines

Something on the system must be stateful, continually monitoring guests & taking neccessary actions ? eg If XenD isn't used, then what is responsible for restarting guests which crash, or performing core dumps on crashed guests, etc, etc ?

Good questions. I have just started looking at the new toolstack, and frankly don't yet know how this is handled. Adding xen-devel for comment ...

Quoted 18 lines

This would have a bearing on how best to design a libvirt driver

Quoted 8 lines

There are certainly benefits to the xen-unified subdriver approach, e.g. the existing hypervisor and xenstore subdrivers can be leveraged, the former providing all the capabilities code. But AFAIK, libxenlight and xend should not be used together, so I don't think we would want the xend subdriver activated if libxenlight is detected. Supposedly xl can be used as a direct replacement for xm, allowing unconditional use of that subdriver.

Quoted 6 lines

BTW, Ian Jackson responded [2] to some of my questions regarding compatibility between old and new toolstack if you are interested.

I'd like to hear other's opinions on a new driver vs. a xen-unified subdriver.

Quoted 9 lines

Due to the number of revisions of Xen userspace stack, and the need to talk to so many pieces to get an efficient driver, the current Xen unified driver is rather hairy. Particularly if XenD itself is deprecated as a control mechanism, then I'd go for a new standalone driver, that runs from libvirtd context and leverages the standard libvirt storage/network/inteface drivers for non-HV stuff (which I assume libxenlight doesn't cover).

Correct. AFAICT, libxenlight does not cover any host storage or network management. A libxenlight driver will be a hypervsisor driver only.

Regards,
Jim

#3 lore raw
Quoted 22 lines · Jim Fehlig
Quoted 15 lines · Daniel P. Berrange
Quoted 4 lines · Jim Fehlig

I'm looking into creating a driver for the new Xen xl/libxl toolstack (aka libxenlight [1]), set to become the default in upcoming Xen 4.1.0 release.

Quoted 8 lines

My first hurdle is deciding whether this should be a new driver or integrated with existing xen-unified driver. Initially I thought a new driver would be a better approach - a clean break from the old code, similar to the xenapi driver. libxenlight is also stateless (no managed domains), which seems like another good argument for a new driver. But libxenlight is really just another interface into the same hypervisor, so in that regard it should be a xen-unified subdriver.

Quoted 5 lines

Something on the system must be stateful, continually monitoring guests & taking neccessary actions ? eg If XenD isn't used, then what is responsible for restarting guests which crash, or performing core dumps on crashed guests, etc, etc ?

Quoted 3 lines

Good questions. I have just started looking at the new toolstack, and frankly don't yet know how this is handled. Adding xen-devel for comment ...

Yes and no, in xen, the hypervisor internal data structures combined with xenstore is the state (pretty much anyway). The purpose of libxenlight is to abstract away these details.

However, when a domain is created with libxenlight one must wait for a few events to ensure the proper clean-up of the domain. The events are basically 'domain death' or 'device ejected'. These exist so the toolstack can handle rebooting, core dumping the domain, inserting the next CD image, or whatever. I am not sure how libvirt handles such events normally but you may either integrate with a poll/select based mainloop or have threads or processes with self-pipes handling these.

So in summary, state is maintained by the xen system outside of any libvirt driver, but handling the kind of events you mention will require some special work to be done for domains created by libvirt.

Quoted 28 lines
Quoted 18 lines

This would have a bearing on how best to design a libvirt driver

Quoted 8 lines

There are certainly benefits to the xen-unified subdriver approach, e.g. the existing hypervisor and xenstore subdrivers can be leveraged, the former providing all the capabilities code. But AFAIK, libxenlight and xend should not be used together, so I don't think we would want the xend subdriver activated if libxenlight is detected. Supposedly xl can be used as a direct replacement for xm, allowing unconditional use of that subdriver.

Quoted 6 lines

BTW, Ian Jackson responded [2] to some of my questions regarding compatibility between old and new toolstack if you are interested.

I'd like to hear other's opinions on a new driver vs. a xen-unified subdriver.

Quoted 9 lines

Due to the number of revisions of Xen userspace stack, and the need to talk to so many pieces to get an efficient driver, the current Xen unified driver is rather hairy. Particularly if XenD itself is deprecated as a control mechanism, then I'd go for a new standalone driver, that runs from libvirtd context and leverages the standard libvirt storage/network/inteface drivers for non-HV stuff (which I assume libxenlight doesn't cover).

Quoted 2 lines

Correct. AFAICT, libxenlight does not cover any host storage or network management. A libxenlight driver will be a hypervsisor driver only.

Yes definitely. We handle attaching and detaching NIC's and block devices. Any other management is orthogonal to libxenlight (as it is for xend).

BTW. I would also add my vote for a separate code-base for xend/traditional vs. libxenlight drivers as there is no similarity of interface. The xend HTTP RPC calls are unrelated to the libxl API.

In any case, please keep xen-devel in the distribution list :)

Gianni

#4 lore raw
Quoted 39 lines · Gianni Tedesco
Quoted 22 lines · Jim Fehlig
Quoted 15 lines · Daniel P. Berrange
Quoted 4 lines · Jim Fehlig

I'm looking into creating a driver for the new Xen xl/libxl toolstack (aka libxenlight [1]), set to become the default in upcoming Xen 4.1.0 release.

Quoted 8 lines

My first hurdle is deciding whether this should be a new driver or integrated with existing xen-unified driver. Initially I thought a new driver would be a better approach - a clean break from the old code, similar to the xenapi driver. libxenlight is also stateless (no managed domains), which seems like another good argument for a new driver. But libxenlight is really just another interface into the same hypervisor, so in that regard it should be a xen-unified subdriver.

Quoted 5 lines

Something on the system must be stateful, continually monitoring guests & taking neccessary actions ? eg If XenD isn't used, then what is responsible for restarting guests which crash, or performing core dumps on crashed guests, etc, etc ?

Quoted 3 lines

Good questions. I have just started looking at the new toolstack, and frankly don't yet know how this is handled. Adding xen-devel for comment ...

Yes and no, in xen, the hypervisor internal data structures combined with xenstore is the state (pretty much anyway). The purpose of libxenlight is to abstract away these details.

However, when a domain is created with libxenlight one must wait for a few events to ensure the proper clean-up of the domain. The events are basically 'domain death' or 'device ejected'. These exist so the toolstack can handle rebooting, core dumping the domain, inserting the next CD image, or whatever. I am not sure how libvirt handles such events normally but you may either integrate with a poll/select based mainloop or have threads or processes with self-pipes handling these.

Quoted 3 lines

So in summary, state is maintained by the xen system outside of any libvirt driver, but handling the kind of events you mention will require some special work to be done for domains created by libvirt.

Ok, so basically the mgmt app that is using the libxenlight API is taking the place of XenD. Thus in the new scheme libvirtd would have to handle those kind of events. This is fine because we already do that kind of thing with our other HV drivers for QEMU/KVM, UserModeLinux and LXC.

Quoted 32 lines
Quoted 29 lines
Quoted 19 lines

This would have a bearing on how best to design a libvirt driver

Quoted 8 lines

There are certainly benefits to the xen-unified subdriver approach, e.g. the existing hypervisor and xenstore subdrivers can be leveraged, the former providing all the capabilities code. But AFAIK, libxenlight and xend should not be used together, so I don't think we would want the xend subdriver activated if libxenlight is detected. Supposedly xl can be used as a direct replacement for xm, allowing unconditional use of that subdriver.

Quoted 6 lines

BTW, Ian Jackson responded [2] to some of my questions regarding compatibility between old and new toolstack if you are interested.

I'd like to hear other's opinions on a new driver vs. a xen-unified subdriver.

Quoted 9 lines

Due to the number of revisions of Xen userspace stack, and the need to talk to so many pieces to get an efficient driver, the current Xen unified driver is rather hairy. Particularly if XenD itself is deprecated as a control mechanism, then I'd go for a new standalone driver, that runs from libvirtd context and leverages the standard libvirt storage/network/inteface drivers for non-HV stuff (which I assume libxenlight doesn't cover).

Quoted 2 lines

Correct. AFAICT, libxenlight does not cover any host storage or network management. A libxenlight driver will be a hypervsisor driver only.

Quoted 7 lines

Yes definitely. We handle attaching and detaching NIC's and block devices. Any other management is orthogonal to libxenlight (as it is for xend).

BTW. I would also add my vote for a separate code-base for xend/traditional vs. libxenlight drivers as there is no similarity of interface. The xend HTTP RPC calls are unrelated to the libxl API.

Agreed, now you clarified my question(s) above, I think a dedicated libxenlight driver in libvirtd is the only sensible option.

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

Regards,
Daniel

#5 lore raw
Quoted 7 lines · Daniel P. Berrange

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

The xapi toolstack which implements XenAPI is now open source as well and is used in XCP (as well as XenServer).

Ian.

author
#6 lore raw
Quoted 10 lines · Ian Campbell
Quoted 7 lines · Daniel P. Berrange

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

Quoted 3 lines

The xapi toolstack which implements XenAPI is now open source as well and is used in XCP (as well as XenServer).

But there is no intent on putting this toolstack in the traditional Xen releases from xen.org correct?

Jim

#7 lore raw
Quoted 11 lines · Jim Fehlig
Quoted 10 lines · Ian Campbell
Quoted 7 lines · Daniel P. Berrange

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

Quoted 6 lines
Quoted 3 lines

The xapi toolstack which implements XenAPI is now open source as well and is used in XCP (as well as XenServer).

But there is no intent on putting this toolstack in the traditional Xen releases from xen.org correct?

Although XCP and xapi are themselves xen.org projects they are maintained and released separately.

The intention is that in the future xapi will use libxl too, but still as an external consumer not part of the main xen hg repository.

The xcp and xapi folks hang out on the [email protected] list.

Ian.

#8 lore raw
In reply to Jim Fehlig

Jim Fehlig writes ("Re: [Xen-devel] Re: [libvirt] [RFC] libxenlight driver"):

Quoted 6 lines
Quoted 2 lines · Ian Campbell

The xapi toolstack which implements XenAPI is now open source as well and is used in XCP (as well as XenServer).

But there is no intent on putting this toolstack in the traditional Xen releases from xen.org correct?

That's right, there isn't.

Ian.

#9 lore raw
In reply to Daniel P. Berrange
Quoted 3 lines · Daniel P. Berrange

Ok, so basically the mgmt app that is using the libxenlight API is taking the place of XenD. Thus in the new scheme libvirtd would have to handle those kind of events.

Right.
Libxenlight provides all the functions needed to do that and you can find a reference implementation in xl (tools/libxl/xl_cmdimpl.c).

Quoted 3 lines

This is fine because
we already do that kind of thing with our other HV drivers for QEMU/KVM, UserModeLinux and LXC.

Good to hear.

Quoted 6 lines

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

Nowadays XAPI (the XenServer toolstack) is Open Source and provides a full feature implementation of the API. I think that users that need XenAPI functionalities are probably best served by using XAPI rather than XenD.

#10 lore raw
Quoted 10 lines · Stefano Stabellini
Quoted 3 lines · Daniel P. Berrange

Ok, so basically the mgmt app that is using the libxenlight API is taking the place of XenD. Thus in the new scheme libvirtd would have to handle those kind of events.

Right.
Libxenlight provides all the functions needed to do that and you can find a reference implementation in xl (tools/libxl/xl_cmdimpl.c).

Quoted 5 lines
Quoted 3 lines

This is fine because
we already do that kind of thing with our other HV drivers for QEMU/KVM, UserModeLinux and LXC.

Good to hear.

+1

Quoted 11 lines
Quoted 6 lines

On a related note, where does XenAPI fit into this picture ? Previously XenD would provide (at least some of) the XenAPI functionality in the open source stack, while I understand that the XenEnterprise had a separate impl of XenAPI. It sounds like XenAPI is likely only relevant for XenEnterprise connectivity in the future.

Nowadays XAPI (the XenServer toolstack) is Open Source and provides a full feature implementation of the API. I think that users that need XenAPI functionalities are probably best served by using XAPI rather than XenD.

Yes agreed, in my personal opinion, XenAPI in xend (and perhaps xend itself) has a perilous future.

Gianni

#11 lore raw
In reply to Jim Fehlig
Quoted 22 lines · Jim Fehlig
Quoted 15 lines · Daniel P. Berrange
Quoted 4 lines · Jim Fehlig

I'm looking into creating a driver for the new Xen xl/libxl toolstack (aka libxenlight [1]), set to become the default in upcoming Xen 4.1.0 release.

Quoted 8 lines

My first hurdle is deciding whether this should be a new driver or integrated with existing xen-unified driver. Initially I thought a new driver would be a better approach - a clean break from the old code, similar to the xenapi driver. libxenlight is also stateless (no managed domains), which seems like another good argument for a new driver. But libxenlight is really just another interface into the same hypervisor, so in that regard it should be a xen-unified subdriver.

Quoted 5 lines

Something on the system must be stateful, continually monitoring guests & taking neccessary actions ? eg If XenD isn't used, then what is responsible for restarting guests which crash, or performing core dumps on crashed guests, etc, etc ?

Quoted 3 lines

Good questions. I have just started looking at the new toolstack, and frankly don't yet know how this is handled. Adding xen-devel for comment ...

xenstore is stateful and the hypervisor keeps a state of the system so there is no need for libxenlight to maintain yet another additional state of the system on top of them: it just relies on the informations already available through them.
xl (the minimal C toolstack on top of libxenlight) spawns a daemon per domain to handle domain death events and cdrom events.
I should also mention that one of the design goals of libxenlight is that no libxenlight users (toolstacks like libvirt) should need to use anything else but libxenlight to perform Xen operations. So you shouldn't need to call any xenctrl functions or deal with xenstore directly.

Quoted 1 line
Quoted 1 line

This would have a bearing on how best to design a libvirt driver

I don't know much about libvirt but I would write a brand new libxenlight driver.

Quoted 25 lines
Quoted 15 lines
Quoted 8 lines

There are certainly benefits to the xen-unified subdriver approach, e.g. the existing hypervisor and xenstore subdrivers can be leveraged, the former providing all the capabilities code. But AFAIK, libxenlight and xend should not be used together, so I don't think we would want the xend subdriver activated if libxenlight is detected. Supposedly xl can be used as a direct replacement for xm, allowing unconditional use of that subdriver.

Quoted 6 lines

BTW, Ian Jackson responded [2] to some of my questions regarding compatibility between old and new toolstack if you are interested.

I'd like to hear other's opinions on a new driver vs. a xen-unified subdriver.

Quoted 9 lines

Due to the number of revisions of Xen userspace stack, and the need to talk to so many pieces to get an efficient driver, the current Xen unified driver is rather hairy. Particularly if XenD itself is deprecated as a control mechanism, then I'd go for a new standalone driver, that runs from libvirtd context and leverages the standard libvirt storage/network/inteface drivers for non-HV stuff (which I assume libxenlight doesn't cover).

Quoted 2 lines

Correct. AFAICT, libxenlight does not cover any host storage or network management. A libxenlight driver will be a hypervsisor driver only.

Yep.
Feel free to ask any questions you might have on libxenlight to xen-devel!

#12 lore raw

Stefano Stabellini writes ("Re: [Xen-devel] Re: [libvirt] [RFC] libxenlight driver"):

Quoted 5 lines

I should also mention that one of the design goals of libxenlight is that no libxenlight users (toolstacks like libvirt) should need to use anything else but libxenlight to perform Xen operations. So you shouldn't need to call any xenctrl functions or deal with xenstore directly.

This is quite important. We have tried to do this and we have succeeded for the "xl" command's requirements, at least.

However since we currently have only one user of libxl, "xl" itself, it is very likely that you will find that there are deficiencies in the libxl API which make it difficult to use properly in libvirt.

We would very much like to fix these problems so please report them all to us. We will work with you to make libxl have the API you need so that you can write libvirt properly.

Inevitably this will mean that the libvirt adaptation will need the libxl from Xen 4.2, not the Xen 4.1 version which is currently in freeze. However in Xen 4.1 xend is still supported.

Please also send your libvirt patches to xen-devel for review, etc.

Quoted 2 lines

I don't know much about libvirt but I would write a brand new libxenlight driver.

Yes, absolutely. Having taken a look at the existing code in libvirt for driving xenstore/xen/etc., none of it looks sensibly reuseable.

Ian.