RFC: Configuring rumprun-xen application stacks from Xenstore
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Martin Lucina
back in July there was some discussion on configuring rump kernel application stacks:
http://thread.gmane.org/gmane.comp.rumpkernel.user/321Some proposals were made, but no actual implementation work was done. In the mean time, I have implemented the simplest possible mechanism I could think of for rumprun-xen, using Xenstore.
The patches are available for review as PR #12:
https://github.com/rumpkernel/rumprun-xen/pull/12
Thanks Martin, great work!
Quoted 1 line
Following is the high-level description from the Git commit:
Can you also post an example of the usage of your CLI tool? Actually, can you post a rough description of the entire process that a user would have to follow, i.e. compile, configure, run.
Quoted 4 lines
- The rumpconfig module provides
_rumprun_config()and_rumprun_deconfig()functions. These are called before and after the applicationmain()function, and also in the case of deconfig when_exit()is called.
Is deconfig necessary? The rump kernel already automatically e.g. unmounts file systems and releases the dhcp lease when it's halted.
Quoted 11 lines
- The "xr" driver script, currently located in app-tools/. The motivation for this script is twofold:
Firstly, in order to write the configuration to Xenstore the domain must be created in a paused state so that we can retrieve its unique . Only then do we know where in Xenstore to write the configuration data.
Secondly, it is my intention with this work to provide a "docker-alike" interface for running rumprun applications. The "xr" script is therefore the CLI for running such applications.
The user-facing configuration tool was sorely needed. I hate to go into naming, but ... can we call the tool "rumprun"? I think your tool will be the basis for running rumprun stacks beyond Xen, and we should try to avoid the user-visible syntax having any obvious shortcomings.
Quoted 3 lines
Note that in this initial version, only configuring IPv4 network interfaces with DHCP is supported, and only using image files with ffs or cd9660 filesystems for block devices is supported.
Would e.g. IPv6 support take longer than it took to write that paragraph ?-)
- antti
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines
Quoted 1 line
Following is the high-level description from the Git commit:
Can you also post an example of the usage of your CLI tool? Actually, can you post a rough description of the entire process that a user would have to follow, i.e. compile, configure, run.
Running "xr" with no parameters gives a nice command reference :-)
Anyhow:
Simple hello world using tests/hello/hello built as part of buildxen.sh:
# xr run -i tests/hello/hello
Running a webserver:
Get mathopd source from http://mathopd.org/. I used mathopd as it's BSD licensed, non-forking and small. To build and run it:
1. git clone, buildxen.sh
2. Put app-tools at the *END* of your $PATH. There is a bug/interaction with the app-tools ld that breaks things if you put it before the real ld.
3. (in mathopd/src) rumpapp-xen-make
4. You need filesystem images for a stub /etc and /data. I am using cd9660 for these as you can portably generate that anywhere you have genisoimage (ex mkisofs). (see below)
5. Assuming you have those, run the following in the mathopd src directory, as root:
# xr run -i -n inet:dhcp -b etc.iso:/etc -b data.iso:/data mathopd -nt -f /etc/mathopd.conf
This will configure xenif0 using dhcp/ipv4, mount /etc and /data using the respective images and then run "mathopd -nt -f /etc/mathopd.conf". The mathopd options tell it not to fork into the background and to write logs to standard output.
That's all :-)
Next step for me is to add a copy of mathopd as a demo into rumprun-xen. As part of that demo I will add scripts to rebuild the filesystem images, but probably not do that in the default build so as not to introduce a hard dependency on genisoimage.
I then plan to experiment getting a full LAMP stack or similar running across multiple VMs but I need to stabilise the simple case with mathopd serving a static website first, there are still several bugs lurking there.
Quoted 7 lines
Quoted 4 lines
- The rumpconfig module provides
_rumprun_config()and_rumprun_deconfig()functions. These are called before and after the applicationmain()function, and also in the case of deconfig when_exit()is called.Is deconfig necessary? The rump kernel already automatically e.g. unmounts file systems and releases the dhcp lease when it's halted.
It does unmount filesystems (if halted correctly) but afaict it does not do rump_pub_etfs_remove() and the dhcp stuff does not destroy the interface. This is nitpicking, but if you don't do that then the underlying blkfront/netfront does not get "correctly" detached either as you can see from "port X still bound!" messages during minios_stop_kernel().
Quoted 8 lines
Quoted 3 lines
Secondly, it is my intention with this work to provide a "docker-alike" interface for running rumprun applications. The "xr" script is therefore the CLI for running such applications.
The user-facing configuration tool was sorely needed. I hate to go into naming, but ... can we call the tool "rumprun"? I think your tool will be the basis for running rumprun stacks beyond Xen, and we should try to avoid the user-visible syntax having any obvious shortcomings.
Guess so. In my mind there is potentially more the tool can do than just run rumprun stacks, for example:
- manage interaction with the host networking, map host ports to domain:port
- generate or otherwise manage filesystem images (eg we could have a custom DNS server)
- manage stack naming on the host, this is a bit daft at the moment, eg. if you try to run two copies of mathopd it will fall over due to the Xen domain name not being unique
And so on. Maybe this can be layered into separate tools with the 'rumprun' script dealing only with launching. Needs more thought.
Quoted 5 lines
Quoted 3 lines
Note that in this initial version, only configuring IPv4 network interfaces with DHCP is supported, and only using image files with ffs or cd9660 filesystems for block devices is supported.
Would e.g. IPv6 support take longer than it took to write that paragraph ?-)
<taptaptap> ;)
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Martin Lucina
Quoted 5 lines
Quoted 1 line
Following is the high-level description from the Git commit:
Can you also post an example of the usage of your CLI tool? Actually, can you post a rough description of the entire process that a user would have to follow, i.e. compile, configure, run.
Running "xr" with no parameters gives a nice command reference :-)
Sure, but asking everyone to fetch/build/run a tool and dig into the sources to be able to partake in mailing list brainstorming is excessive.
Quoted 1 line
Anyhow:
Anyhow, your list of steps was helpful. Thank you.
Quoted 4 lines
Running a webserver:
Get mathopd source from http://mathopd.org/. I used mathopd as it's BSD licensed, non-forking and small. To build and run it:
Plus I don't think anyone had tried running mathopd on top of a rump kernel before. It's always good to know that more stuff just works out of the box.
Quoted 3 lines
4. You need filesystem images for a stub /etc and /data. I am using cd9660 for these as you can portably generate that anywhere you have genisoimage (ex mkisofs). (see below)
Just to expand on the need for /etc, libc calls such as getservent() and getpwent() access files from /etc and get desperately confused if such files don't exist. The alternative is to modify the application to not use such calls or to modify libc to shortcircuit them instead of trying to access /etc. Not sure what is best long-term, but short-term an easily available or generatable /etc is probably the best way to fly.
Actually, hmm, there's already an image for /etc available. I understood from irc discussion that you needed slight modifications to passwd for mathopd. In case your changes don't conflict with what's already up there, you could just update the existing downloadable /etc image:
https://github.com/rumpkernel/rumprun-xen/tree/master/img
Of course we can't generate the content image for others, but understanding what files need to go in there is straightforward.
Quoted 4 lines
5. Assuming you have those, run the following in the mathopd src directory, as root:
# xr run -i -n inet:dhcp -b etc.iso:/etc -b data.iso:/data mathopd -nt -f /etc/mathopd.conf
Did you try running more than one? You should just be able to run as many domU's as you want and serve different content from each by altering -b, correct?
Quoted 8 lines
Quoted 2 lines
Is deconfig necessary? The rump kernel already automatically e.g. unmounts file systems and releases the dhcp lease when it's halted.
It does unmount filesystems (if halted correctly) but afaict it does not do
rump_pub_etfs_remove()and the dhcp stuff does not destroy the interface. This is nitpicking, but if you don't do that then the underlying blkfront/netfront does not get "correctly" detached either as you can see from "port X still bound!" messages duringminios_stop_kernel().
Ok, so it's a quick workaround. I should fix those in the rump kernel now that I'm aware of them.
Quoted 11 lines
Guess so. In my mind there is potentially more the tool can do than just run rumprun stacks, for example:
- manage interaction with the host networking, map host ports to domain:port
- generate or otherwise manage filesystem images (eg we could have a custom DNS server)
- manage stack naming on the host, this is a bit daft at the moment, eg. if you try to run two copies of mathopd it will fall over due to the Xen domain name not being unique
Quoted 2 lines
And so on. Maybe this can be layered into separate tools with the 'rumprun' script dealing only with launching. Needs more thought.
Agreed. But we should still try to get the foreseeable stuff right.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Note that in this initial version, only configuring IPv4 network interfaces with DHCP is supported, and only using image files with ffs or cd9660 filesystems for block devices is supported.
Would e.g. IPv6 support take longer than it took to write that paragraph ?-)
<taptaptap> ;)
My paragraph was shorter ;)
- antti
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · [email protected] said:
Actually, hmm, there's already an image for /etc available. I understood from irc discussion that you needed slight modifications to passwd for mathopd. In case your changes don't conflict with what's already up there, you could just update the existing downloadable /etc image:
https://github.com/rumpkernel/rumprun-xen/tree/master/img
I'll add in a new image rather than touch the current one, so that it can be cd9660 and read-only rather than ffs. Avoids needing to keep a "clean image" around in case of crashes while developing. The old one can stay until we replace the old demo code.
Also, I'd prefer to call it 'stubetc' rather than 'etc' to make it clearer that it's not supposed to be used as a normal /etc.
This brings up another question; what to do with resolv.conf, for example?
Quoted 3 lines
Did you try running more than one? You should just be able to run as many domU's as you want and serve different content from each by altering -b, correct?
Yes. In the final demo I will move the mathopd configuration file under /data, so that would work fine.
However: Xen requires each domU to have a locally-unique name. At the moment "xr" just uses "rumprun-$APP" which will not be unique for more than one copy of APP. I will add an option allowing you to override that.
In the long run I'd prefer a scheme similar to what Docker does: If you don't specify a name then a locally-unique admin-friendly one is generated for you, eg. (from a test I just ran on my system): boring_hopper, mad_mcclintock, ...
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Martin Lucina
Quoted 6 lines · [email protected] said:
Actually, hmm, there's already an image for /etc available. I understood from irc discussion that you needed slight modifications to passwd for mathopd. In case your changes don't conflict with what's already up there, you could just update the existing downloadable /etc image:
https://github.com/rumpkernel/rumprun-xen/tree/master/img
Quoted 4 lines
I'll add in a new image rather than touch the current one, so that it can be cd9660 and read-only rather than ffs. Avoids needing to keep a "clean image" around in case of crashes while developing. The old one can stay until we replace the old demo code.
Generally speaking, file systems support read-only mounts ...
Quoted 2 lines
Also, I'd prefer to call it 'stubetc' rather than 'etc' to make it clearer that it's not supposed to be used as a normal /etc.
I'd prefer it to be completely hidden from the user. But sure, call it stubetc for now.
Quoted 1 line
This brings up another question; what to do with resolv.conf, for example?
Is resolv.conf an example, i.e. are there other files with similar needs? Or can we figure out how to handle it as a special case?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · [email protected] said:
Quoted 8 lines · Martin Lucina
Quoted 6 lines · [email protected] said:
Actually, hmm, there's already an image for /etc available. I understood from irc discussion that you needed slight modifications to passwd for mathopd. In case your changes don't conflict with what's already up there, you could just update the existing downloadable /etc image:
https://github.com/rumpkernel/rumprun-xen/tree/master/img
Quoted 6 lines
Quoted 4 lines
I'll add in a new image rather than touch the current one, so that it can be cd9660 and read-only rather than ffs. Avoids needing to keep a "clean image" around in case of crashes while developing. The old one can stay until we replace the old demo code.
Generally speaking, file systems support read-only mounts ...
Fair enough, will add in some basic fs options to the relevant parts. cd9660 is still easier to rebuild on non-BSD hosts, it's just "genisoimage -l -r -o file.iso <rootdir>".
Quoted 10 lines
Quoted 2 lines
Also, I'd prefer to call it 'stubetc' rather than 'etc' to make it clearer that it's not supposed to be used as a normal /etc.
I'd prefer it to be completely hidden from the user. But sure, call it stubetc for now.
Quoted 1 line
This brings up another question; what to do with resolv.conf, for example?
Is resolv.conf an example, i.e. are there other files with similar needs? Or can we figure out how to handle it as a special case?
Can't think of any. Went and looked in /etc on my laptop to see if anything of note gets modified regularly and found nothing besides resolv.conf.
If we want to go down the route of not having a user-visible /etc at all (which I think is a good idea) then perhaps we could modify the libc resolver to add an API to set the DNS servers directly, which the rumpconfig and/or dhcp stuff can call.
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Martin Lucina
Quoted 10 lines
Quoted 2 lines
Also, I'd prefer to call it 'stubetc' rather than 'etc' to make it clearer that it's not supposed to be used as a normal /etc.
I'd prefer it to be completely hidden from the user. But sure, call it stubetc for now.
Quoted 1 line
This brings up another question; what to do with resolv.conf, for example?
Is resolv.conf an example, i.e. are there other files with similar needs? Or can we figure out how to handle it as a special case?
Quoted 7 lines
Can't think of any. Went and looked in /etc on my laptop to see if anything of note gets modified regularly and found nothing besides resolv.conf.
If we want to go down the route of not having a user-visible /etc at all (which I think is a good idea) then perhaps we could modify the libc resolver to add an API to set the DNS servers directly, which the rumpconfig and/or dhcp stuff can call.
user-visible != internally visible. We can for example build /etc into the image as data and mount it as a memory file system at runtime or symlink /etc/resolv.conf to /resolv.conf. I'd completely avoid modifying libc until there's a better understanding of the role of /etc with experience from dozens of varying applications. Modifying over upstream is a balancing act, because then we stop getting the *pre-tested* code for free.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Antti Kantee writes ("Re: RFC: Configuring rumprun-xen application stacks from Xenstore"):
Quoted 7 lines
user-visible != internally visible. We can for example build /etc into the image as data and mount it as a memory file system at runtime or symlink
/etc/resolv.confto /resolv.conf. I'd completely avoid modifying libc until there's a better understanding of the role of /etc with experience from dozens of varying applications. Modifying over upstream is a balancing act, because then we stop getting the *pre-tested* code for free.
I agree that having rumprun-xen create a suitable /etc image and feed it to the guest is a very good idea.
I wonder if this mechanism could be used for some or all of the things that you're currently using xenstore for. Specifying which virtual block devices to mount where, or what network configuration to use, are things that other rump kernel runners would want to do. Putting that information in a stunt /etc seems like it might make more commonality.
Another observation I had was: perhaps we can make some of this configuration unnecessary, or at least we could provide sensible defaults. If the guest has been given a single network interface it probably ought to do DHCPv4 and IPv6 autoconf on it, unless it has been told otherwise.
Feel free to tell me I'm wrong about both of the above.
Ian.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · [email protected] said:
I wonder if this mechanism could be used for some or all of the things that you're currently using xenstore for. Specifying which virtual block devices to mount where, or what network configuration to use, are things that other rump kernel runners would want to do. Putting that information in a stunt /etc seems like it might make more commonality.
<brainstorm>
What about embedded platforms with no notion of block devices?
I think that a "key/value store" is a more general abstraction to use. It works equally well for eg. U-Boot environment variables instead of xenstore.
</brainstorm>
Martin
A message that is not in the archive (sent off-list or not yet received): [email protected]
Martin Lucina writes ("Re: RFC: Configuring rumprun-xen application stacks from Xenstore"):
Quoted 2 lines
<brainstorm>
What about embedded platforms with no notion of block devices?
The /etc should be provided as a RAM image then. I did this very successfully in a previous life in a resource-constrained embedded platform. We provided an in-memory cpio archive for a faked-up filesystem containing the bits of /etc (and /dev) that are needed for proper operation of the libc.
The format isn't very important and the data involved is small. The point is that it's much easier to provide the libc with a cardboard cutout /etc that cause the libc to work just like on a `real' system, than to try to fix all the places where it expects /etc/vital.conf.
Ian.
Quoted 33 lines · Martin Lucina
Quoted 5 lines
Quoted 1 line
Following is the high-level description from the Git commit:
Can you also post an example of the usage of your CLI tool? Actually, can you post a rough description of the entire process that a user would have to follow, i.e. compile, configure, run.
Running "xr" with no parameters gives a nice command reference :-)
Anyhow:
Simple hello world using tests/hello/hello built as part of
buildxen.sh:# xr run -i tests/hello/helloRunning a webserver:
Get mathopd source from http://mathopd.org/. I used mathopd as it's BSD licensed, non-forking and small. To build and run it:
1. git clone,
buildxen.sh2. Put app-tools at the *END* of your $PATH. There is a bug/interaction with the app-tools ld that breaks things if you put it before the real ld.
3. (in mathopd/src) rumpapp-xen-make
4. You need filesystem images for a stub /etc and /data. I am using cd9660 for these as you can portably generate that anywhere you have genisoimage (ex mkisofs). (see below)
5. Assuming you have those, run the following in the mathopd src directory, as root:
Quoted 6 lines
# xr run -i -n inet:dhcp -b etc.iso:/etc -b data.iso:/data mathopd -nt -f /etc/mathopd.confThis will configure xenif0 using dhcp/ipv4, mount /etc and /data using the respective images and then run "mathopd -nt -f
/etc/mathopd.conf". The mathopd options tell it not to fork into the background and to write logs to standard output.
I think the network config needs more thought - like disk it needs a host side vs rump side set of options, wg you might want to specify a mac address and bridge to connect to on the xen side, then some options on rump side, eg dhcp, or none (which should just being it up which will do ipv6 anyway). An option to use a config file might be nice too.
Justin