Hi, I want to start a domain from my C program. But it''s not very clear how to do so. I figured out some things, so far I got: xc_interface_open xc_domain_create xc_linux_build But from here, I must define the partitions, and the network. And then start the domain, right? But, how? :) I want to make /dev/hda3 available read-only as /dev/hda1. And /dev/hda5 available rw as /dev/hda2. In the vbd structures, the device is an unsigned short. Should I shift the device major 8 bits, and add the minor? And about the network, simply setting the parameters in the cmdline (xc_linux_build) will do the job, or do I have to do something else? If there is a place to get C examples, will be of great help. Thanks, Marconi. ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
I made some progress. But not the way I think it should be... There goes the code: #include <xc.h> int main() { int xc_handle; int mem_kb = 16384; char name[32] = "Maquina virtual"; u64 domid; xc_vbdextent_t extent; extent.real_device = 0x0300; extent.start_sector = 53319798; extent.nr_sectors = 1188746; xc_handle = xc_interface_open(); xc_domain_create(xc_handle, mem_kb, name, &domid); xc_linux_build(xc_handle,domid,"/boot/xenolinux.gz","","root=/dev/hda3 ro ip=169.254.1.1:::::eth0:off"); xc_vbd_create(xc_handle,domid,0x0303,0); xc_vbd_setextents(xc_handle,domid,0x0303,1,&extent); xc_domain_start(xc_handle,domid); } With the xen_read_console, I see the system booting correctly. The problem is that the real_device I''m using is hda. Becouse 0x0307 with start_sector 0 didn''t work. So, I made fdisk -lu /dev/hda and got the starting sector of hda7. It will be painfull to do it like this, because of the final complexity (this is just a starting test). The other problem is that I didn''t figure out how to setup the networking. PS: In the previeus message, I said the wrong partitions... What I really want is phy:hda7,hda3. Thanks! ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> I want to start a domain from my C program. But it''s not very clear how to do > so.I wouldn''t advise going down this route: In the xeno-unstable (forthcoming 2.0) your program will need to talk to ''xend'' rather than invoking operations on Xen directly. This is necessary since in the new IO model Xen no longer knows about the state of IO devices etc; information about the state of the whole machine is now held in xend. Xend provides a http interface to enable other programs to issue requests to it. You can see example invocations by looking at the new ''xm'' tool. We anticipate that only xend will use the C libary interface to Xen. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
What was the reasoning behoind going to a userland daemon in Domain-0 to handle tracking of resources? I''m not terribly familiar with the logic behind this method other than instabilities int he daemon keeps you from crashing the kernel. But if you crash the userland daemon, how do you recover the lost information? Another question I had was, why python (I don''t intend to start a flamewar of lang-x vs lang-y). Most system level tools that I have seen in the last 14 years of using unix were written in C. Just curious is all for now. :) Brian On Fri, 18 Jun 2004 23:40:59 +0100 Ian Pratt <Ian.Pratt@cl.cam.ac.uk> said...> I want to start a domain from my C program. But it''s not very clear how to do > so.I wouldn''t advise going down this route: In the xeno-unstable (forthcoming 2.0) your program will need to talk to ''xend'' rather than invoking operations on Xen directly. This is necessary since in the new IO model Xen no longer knows about the state of IO devices etc; information about the state of the whole machine is now held in xend. Xend provides a http interface to enable other programs to issue requests to it. You can see example invocations by looking at the new ''xm'' tool. We anticipate that only xend will use the C libary interface to Xen. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Hi, Can someone tell me how to debug the kernel in Xen? For example, I have a user program running in dom0, how can I step into the Xen code to see what happens inside? I tried to use kdb, but it seems that after I did the patch, the "make menuconfig" in xenolinux-2.4.26 directory doesn''t include the option of kdb. Thanks. Xiaofang ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> What was the reasoning behoind going to a userland daemon in Domain-0 to handle tracking of resources? I''m not terribly familiar with the logic behind this method other than instabilities int he daemon keeps you from crashing the kernel. But if you crash the userland daemon, how do you recover the lost information?The dom0 daemon stores the state of the world in the file system. The daemon is actually restartable: when it starts it checks to see whether the domains it has state for still exist, and if so, readopts them. The control plane software was becoming quite complex, so it was clear to us that we needed to do this in a daemon rather than add a whole lot of extra complexity into Xen. We could have still held all the state in Xen, and have the daemon read it out on reboot. However, in the new IO world Xen simply didn''t know about a domain''s IO configuration. We could have simply copied that information into Xen for safe keeping, but adding extra complexity to Xen didn''t seem to make sense. Storing the state in the dom0 file system seemed like a good compromise, and Mike''s recently added code to make the daemon restartable (which is very useful for debugging anyhow)> Another question I had was, why python (I don''t intend to start a flamewar of lang-x vs lang-y). Most system level tools that I have seen in the last 14 years of using unix were written in C.In my view, It''s pretty hard to justify doing anything userland in C these days. I''d certainly stand by the decision to use python -- we wouldn''t have achieved the same rapid development and decent robustness in C. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> Can someone tell me how to debug the kernel in Xen?If you''ve a second machine, you could use the Xen GDB serial stub. See docs/pdb.txt> I tried to use kdb, but it seems that after I did the patch, the "make > menuconfig" in xenolinux-2.4.26 directory doesn''t include the option of > kdb.I''m guessing that you didn''t modify the patch so that it patched arch/xen rather than arch/i386? (or use fakei386xen) Since a kernel debugger is very intimately architecture dependent it''s unlikely to apply without a fair bit of manual merging. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
*nod* makes sense on the daemon. It''s the same method that LVM used to use vgscan for. It would store stuff in /etc/lvm.d/<vg_name>. Where are you storing things from xend? Would you have any objections to having an extended C library for performing common tasks such as the xc_dom_control, xc_physinfo, and xc_dom_create for inclusin into system management programs that are written in C/C++? Something like say xccontrol lib? If you have an existing procedure of checks and commands in python, it shouldn''t be too hard to then write the same logic in C for people that prefer to have a minimalized system (eg no interpreted languages in Domain_0). Sorry to ask for details instead of hunting them down myself. I''m kind of swamped over the last 3 weeks and the coming 3 weeks due to moving into a new house instead of living in the warehouse. 8-) Brian On Sat, 19 Jun 2004 07:10:42 +0100 Ian Pratt <Ian.Pratt@cl.cam.ac.uk> said...> What was the reasoning behoind going to a userland daemon in Domain-0 to handle tracking of resources? I''m not terribly familiar with the logic behind this method other than instabilities int he daemon keeps you from crashing the kernel. But if you crash the userland daemon, how do you recover the lost information?The dom0 daemon stores the state of the world in the file system. The daemon is actually restartable: when it starts it checks to see whether the domains it has state for still exist, and if so, readopts them. The control plane software was becoming quite complex, so it was clear to us that we needed to do this in a daemon rather than add a whole lot of extra complexity into Xen. We could have still held all the state in Xen, and have the daemon read it out on reboot. However, in the new IO world Xen simply didn''t know about a domain''s IO configuration. We could have simply copied that information into Xen for safe keeping, but adding extra complexity to Xen didn''t seem to make sense. Storing the state in the dom0 file system seemed like a good compromise, and Mike''s recently added code to make the daemon restartable (which is very useful for debugging anyhow)> Another question I had was, why python (I don''t intend to start a flamewar of lang-x vs lang-y). Most system level tools that I have seen in the last 14 years of using unix were written in C.In my view, It''s pretty hard to justify doing anything userland in C these days. I''d certainly stand by the decision to use python -- we wouldn''t have achieved the same rapid development and decent robustness in C. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> *nod* makes sense on the daemon. It''s the same method that LVM used to use vgscan for. It would store stuff in /etc/lvm.d/<vg_name>. > > Where are you storing things from xend?It''s currently under/etc/xen/xend. I wander whether it should be moved under /var ?> Would you have any objections to having an extended C library for performing common tasks such as the xc_dom_control, xc_physinfo, and xc_dom_create for inclusin into system management programs that are written in C/C++? Something like say xccontrol lib? If you have an existing procedure of checks and commands in python, it shouldn''t be too hard to then write the same logic in C for people that prefer to have a minimalized system (eg no interpreted languages in Domain_0).The main way we envisage "3rd party" system management tools controlling a Xen node is via xend''s RPC over HTTP[S] interface. If you''re determined not to have any python in domain 0, it would obviously be possible to write a minimal daemon in C. You should think hard about whether its worth the effort... I''ve just had a look on one of our systems and xend has a resident memory size of just over a megabyte. The python interpreter''s RSS is about half a MB. The virtual memory size is rather bigger, but that doesn''t cost anything. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
It probably should be under /var/run since it is something that is only good for the curent xen kernel boot, and if Domain-0 dies, so does the box (I''m assuming that this is true, and if so, only a temporary situation) Personally I have a bias against interpreted languages. But that''s just me. :) I have this thing about too many dependancies and unused chunks of bloat that aren''t necessary, but are done in the name of "convenience" in final products. But this debate of preference is for another time/place. :) It''s your project, you decide what it uses (deference only, no insult/attude intended). Why is it that everyone wants to use HTTP as a network connectivity base? It seems kind of semi-one-wayish to me. While it can do 2-way communication, it''s stateless, and has a limit of the amount of "sent" data to the httpd without the special method of an uploaded "file" which takes you outside of the protocol itself.... I have to admit I''m no network protocol engineer, so I''m still learning a lot of the why/why-nots here. I''m probably missing out on a bunch of reasoning and well thought out logic. On Sun, 20 Jun 2004 08:02:18 +0100 Ian Pratt <Ian.Pratt@cl.cam.ac.uk> said...> *nod* makes sense on the daemon. It''s the same method that LVM used to use vgscan for. It would store stuff in /etc/lvm.d/<vg_name>. > > Where are you storing things from xend?It''s currently under/etc/xen/xend. I wander whether it should be moved under /var ?> Would you have any objections to having an extended C library for performing common tasks such as the xc_dom_control, xc_physinfo, and xc_dom_create for inclusin into system management programs that are written in C/C++? Something like say xccontrol lib? If you have an existing procedure of checks and commands in python, it shouldn''t be too hard to then write the same logic in C for people that prefer to have a minimalized system (eg no interpreted languages in Domain_0).The main way we envisage "3rd party" system management tools controlling a Xen node is via xend''s RPC over HTTP[S] interface. If you''re determined not to have any python in domain 0, it would obviously be possible to write a minimal daemon in C. You should think hard about whether its worth the effort... I''ve just had a look on one of our systems and xend has a resident memory size of just over a megabyte. The python interpreter''s RSS is about half a MB. The virtual memory size is rather bigger, but that doesn''t cost anything. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
I''ve heard of twisted before. Not certain how it helps to be honest. Anyways, as a general server setup your methods will work great. I''ll continue work on the libxcctl in C. :) Any places you can point me to for documentation would be greatly appreciated. On Sun, 20 Jun 2004 21:14:45 +0100 Ian Pratt <Ian.Pratt@cl.cam.ac.uk> said...> It probably should be under /var/run since it is something that is only good for the curent xen kernel boot, and if Domain-0 dies, so does the box (I''m assuming that this is true, and if so, only a temporary situation)Agreed -- it should move before 2.0. We could in principle have a ''hot standby'' management domain that takes over if domain 0 dies. It probably makes sense for the two management daemons to replicate their state directly rather than transfer information via the filessytem.> Personally I have a bias against interpreted languages. But that''s just me. :) I have this thing about too many dependancies and unused chunks of bloat that aren''t necessary, but are done in the name of "convenience" in final products. But this debate of preference is for another time/place. :) It''s your project, you decide what it uses (deference only, no insult/attude intended).Fair point, but rapid development and stability are our biggest concerns right now. Nothing to stop someone else producing some alternative tools ;-)> Why is it that everyone wants to use HTTP as a network > connectivity base? It seems kind of semi-one-wayish to > me. While it can do 2-way communication, it''s stateless, and > has a limit of the amount of "sent" data to the httpd without > the special method of an uploaded "file" which takes you > outside of the protocol itself....HTTP is a fine for RPC, but I agree it doesn''t work well for notifications. One of the good things about using the Twisted framework is that changing transport protocol is trivial. Ian
> It probably should be under /var/run since it is something that is only good for the curent xen kernel boot, and if Domain-0 dies, so does the box (I''m assuming that this is true, and if so, only a temporary situation)Agreed -- it should move before 2.0. We could in principle have a ''hot standby'' management domain that takes over if domain 0 dies. It probably makes sense for the two management daemons to replicate their state directly rather than transfer information via the filessytem.> Personally I have a bias against interpreted languages. But that''s just me. :) I have this thing about too many dependancies and unused chunks of bloat that aren''t necessary, but are done in the name of "convenience" in final products. But this debate of preference is for another time/place. :) It''s your project, you decide what it uses (deference only, no insult/attude intended).Fair point, but rapid development and stability are our biggest concerns right now. Nothing to stop someone else producing some alternative tools ;-)> Why is it that everyone wants to use HTTP as a network > connectivity base? It seems kind of semi-one-wayish to > me. While it can do 2-way communication, it''s stateless, and > has a limit of the amount of "sent" data to the httpd without > the special method of an uploaded "file" which takes you > outside of the protocol itself....HTTP is a fine for RPC, but I agree it doesn''t work well for notifications. One of the good things about using the Twisted framework is that changing transport protocol is trivial. Ian ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun''s Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel