From 096de1e97b8793c9fe457ad33582578457ef7587 Mon Sep 17 00:00:00 2001 From: Daniel P. Berrange Date: May 01 2007 02:27:22 +0000 Subject: Updated to xen 3.0.5-rc4 --- diff --git a/xen-blktap-error-returns.patch b/xen-blktap-error-returns.patch index 01c630d..aea023a 100644 --- a/xen-blktap-error-returns.patch +++ b/xen-blktap-error-returns.patch @@ -1,6 +1,6 @@ -diff -rup xen-3.0.4_1-src/tools/blktap/drivers/blktapctrl.c xen-3.0.4_1-src-new/tools/blktap/drivers/blktapctrl.c ---- xen-3.0.4_1-src/tools/blktap/drivers/blktapctrl.c 2007-01-08 10:00:46.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/blktap/drivers/blktapctrl.c 2007-01-11 10:47:55.000000000 -0500 +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/blktapctrl.c xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/blktapctrl.c +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/blktapctrl.c 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/blktapctrl.c 2007-04-13 11:32:14.000000000 -0400 @@ -673,7 +673,10 @@ int main(int argc, char *argv[]) __init_blkif(); snprintf(buf, sizeof(buf), "BLKTAPCTRL[%d]", getpid()); @@ -13,44 +13,45 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/blktapctrl.c xen-3.0.4_1-src-new/ print_drivers(); init_driver_list(); -Only in xen-3.0.4_1-src-new/tools/blktap/drivers: blktapctrl.c~ -diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-aio.c xen-3.0.4_1-src-new/tools/blktap/drivers/block-aio.c ---- xen-3.0.4_1-src/tools/blktap/drivers/block-aio.c 2007-01-11 10:40:51.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/blktap/drivers/block-aio.c 2007-01-11 10:56:53.000000000 -0500 -@@ -188,13 +188,27 @@ int tdaio_open (struct td_state *s, cons +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-aio.c xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-aio.c +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-aio.c 2007-04-13 11:32:01.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-aio.c 2007-04-13 11:33:22.000000000 -0400 +@@ -203,13 +203,27 @@ int tdaio_open (struct disk_driver *dd, prv->fd = fd; - pipe(prv->command_fd); - pipe(prv->completion_fd); -+ if ((ret = pipe(prv->command_fd)) < 0) { -+ DPRINTF("Unable to create command pipe\n"); -+ goto done; -+ } -+ if ((ret = pipe(prv->completion_fd)) < 0) { -+ DPRINTF("Unable to create completion pipe\n"); -+ goto done; -+ } - -- ret = pthread_create(&prv->aio_thread, NULL, +- +- ret = pthread_create(&prv->aio_thread, NULL, - tdaio_completion_thread, prv); -+ if ((ret = pthread_create(&prv->aio_thread, NULL, -+ tdaio_completion_thread, prv)) != 0) { -+ ret = -1; -+ DPRINTF("Unable to create completion thread\n"); -+ goto done; -+ } - ret = 0; +- ret = 0; - write(prv->command_fd[1], &ret, sizeof(ret)); -+ if (write(prv->command_fd[1], &ret, sizeof(ret)) < 0) { -+ ret = -1; -+ DPRINTF("Cannot initialize command pipe\n"); -+ goto done; -+ } ++ if ((ret = pipe(prv->command_fd)) < 0) { ++ DPRINTF("Unable to create command pipe\n"); ++ goto done; ++ } ++ if ((ret = pipe(prv->completion_fd)) < 0) { ++ DPRINTF("Unable to create completion pipe\n"); ++ goto done; ++ } ++ ++ if ((ret = pthread_create(&prv->aio_thread, NULL, ++ tdaio_completion_thread, prv)) != 0) { ++ ret = -1; ++ DPRINTF("Unable to create completion thread\n"); ++ goto done; ++ } ++ ret = 0; ++ if (write(prv->command_fd[1], &ret, sizeof(ret)) < 0) { ++ ret = -1; ++ DPRINTF("Cannot initialize command pipe\n"); ++ goto done; ++ } - + init_fds(dd); ret = get_image_info(s, fd); -@@ -371,7 +385,10 @@ repeat: +@@ -382,7 +396,10 @@ repeat: goto repeat; } @@ -62,25 +63,10 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-aio.c xen-3.0.4_1-src-new/t return rsp; } -Only in xen-3.0.4_1-src-new/tools/blktap/drivers: block-aio.c~ -diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-qcow.c xen-3.0.4_1-src-new/tools/blktap/drivers/block-qcow.c ---- xen-3.0.4_1-src/tools/blktap/drivers/block-qcow.c 2007-01-08 10:00:46.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/blktap/drivers/block-qcow.c 2007-01-11 11:15:35.000000000 -0500 -@@ -441,8 +441,11 @@ static int qtruncate(int fd, off_t lengt - return -1; - } - -- } else if(sparse && (st.st_size > length)) -- ftruncate(fd, length); -+ } else if(sparse && (st.st_size > length)) { -+ if (ftruncate(fd, length) < 0) { -+ return -1; -+ } -+ } - - return 1; - } -@@ -669,7 +672,10 @@ found: +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-qcow.c xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-qcow.c +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-qcow.c 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-qcow.c 2007-04-13 11:36:55.000000000 -0400 +@@ -707,7 +707,10 @@ found: } memcpy(tmp_ptr2, l2_ptr, 4096); lseek(s->fd, l2_offset + (l2_sector << 12), SEEK_SET); @@ -92,9 +78,9 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-qcow.c xen-3.0.4_1-src-new/ free(tmp_ptr2); } return cluster_offset; -@@ -1149,20 +1155,25 @@ int tdqcow_close(struct td_state *bs) +@@ -1112,20 +1115,26 @@ int tdqcow_close(struct disk_driver *dd) { - struct tdqcow_state *s = (struct tdqcow_state *)bs->private; + struct tdqcow_state *s = (struct tdqcow_state *)dd->private; uint32_t cksum, out; - int fd, offset; + int fd, offset, ret = 0; @@ -102,27 +88,27 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-qcow.c xen-3.0.4_1-src-new/ /*Update the hdr cksum*/ if(s->min_cluster_alloc == s->l2_size) { cksum = gen_cksum((char *)s->l1_table, s->l1_size * sizeof(uint64_t)); -- printf("Writing cksum: %d",cksum); + printf("Writing cksum: %d",cksum); - fd = open(s->name, O_WRONLY | O_LARGEFILE); /*Open without O_DIRECT*/ -+ if ((fd = open(s->name, O_WRONLY | O_LARGEFILE)) < 0) { /*Open without O_DIRECT*/ -+ ret = -1; -+ goto cleanup; -+ } ++ if ((fd = open(s->name, O_WRONLY | O_LARGEFILE)) < 0) { /*Open without O_DIRECT*/ ++ ret = -1; ++ goto cleanup; ++ } offset = sizeof(QCowHeader) + sizeof(uint32_t); lseek(fd, offset, SEEK_SET); out = cpu_to_be32(cksum); - write(fd, &out, sizeof(uint32_t)); -+ if ((ret = write(fd, &out, sizeof(uint32_t))) < 0) { -+ ret = -1; -+ } ++ if ((ret = write(fd, &out, sizeof(uint32_t))) < 0) { ++ ret = -1; ++ } close(fd); } -+ cleanup: ++ cleanup: + io_destroy(s->aio_ctx); free(s->name); free(s->l1_table); - free(s->l2_cache); -@@ -1249,7 +1260,9 @@ int qcow_create(const char *filename, ui +@@ -1212,7 +1221,9 @@ int qcow_create(const char *filename, ui strncpy(backing_filename, backing_file, sizeof(backing_filename)); } else { @@ -133,11 +119,10 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-qcow.c xen-3.0.4_1-src-new/ if (stat(backing_filename, &st) != 0) { return -1; } -Only in xen-3.0.4_1-src-new/tools/blktap/drivers: block-qcow.c~ -diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-vmdk.c xen-3.0.4_1-src-new/tools/blktap/drivers/block-vmdk.c ---- xen-3.0.4_1-src/tools/blktap/drivers/block-vmdk.c 2007-01-08 10:00:47.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/blktap/drivers/block-vmdk.c 2007-01-11 11:02:07.000000000 -0500 -@@ -268,8 +268,10 @@ static uint64_t get_cluster_offset(struc +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-vmdk.c xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-vmdk.c +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-vmdk.c 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-vmdk.c 2007-04-13 11:32:14.000000000 -0400 +@@ -283,8 +283,10 @@ static uint64_t get_cluster_offset(struc if (!allocate) return 0; cluster_offset = lseek(prv->fd, 0, SEEK_END); @@ -150,4 +135,3 @@ diff -rup xen-3.0.4_1-src/tools/blktap/drivers/block-vmdk.c xen-3.0.4_1-src-new/ cluster_offset >>= 9; /* update L2 table */ tmp = cpu_to_le32(cluster_offset); -Only in xen-3.0.4_1-src-new/tools/blktap/drivers: block-vmdk.c~ diff --git a/xen-blktap-no-aio-epoll.patch b/xen-blktap-no-aio-epoll.patch index 453be98..4cb09fb 100644 --- a/xen-blktap-no-aio-epoll.patch +++ b/xen-blktap-no-aio-epoll.patch @@ -1,13 +1,7 @@ ---- a/tools/blktap/drivers/block-aio.c 2006-09-21 13:45:44.000000000 +0100 -+++ b/tools/blktap/drivers/block-aio.c 2006-09-21 19:58:18.000000000 +0100 -@@ -38,20 +38,13 @@ - #include - #include - #include -+#include - #include - #include - #include +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-aio.c xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-aio.c +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/blktap/drivers/block-aio.c 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/blktap/drivers/block-aio.c 2007-04-13 11:17:08.000000000 -0400 +@@ -44,14 +44,6 @@ #include #include "tapdisk.h" @@ -22,17 +16,17 @@ #define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ) struct pending_aio { -@@ -71,19 +64,24 @@ +@@ -72,12 +64,18 @@ struct tdaio_state { int iocb_free_count; struct iocb *iocb_queue[MAX_AIO_REQS]; int iocb_queued; - int poll_fd; /* NB: we require aio_poll support */ struct io_event aio_events[MAX_AIO_REQS]; + -+ pthread_t aio_thread; ++ pthread_t aio_thread; + /* pipe fds for communication with the aio completion thread */ -+ int command_fd[2]; -+ int completion_fd[2]; ++ int command_fd[2]; ++ int completion_fd[2]; }; #define IOCB_IDX(_s, _io) ((_io) - (_s)->iocb_list) @@ -42,14 +36,7 @@ /*Get Image size, secsize*/ static int get_image_info(struct td_state *s, int fd) { - int ret; - long size; - unsigned long total_size; -- struct statvfs statBuf; - struct stat stat; - - ret = fstat(fd, &stat); -@@ -108,7 +106,6 @@ +@@ -109,7 +107,6 @@ static int get_image_info(struct td_stat /*Get the sector size*/ #if defined(BLKSSZGET) { @@ -57,7 +44,16 @@ s->sector_size = DEFAULT_SECTOR_SIZE; ioctl(fd, BLKSSZGET, &s->sector_size); -@@ -151,11 +148,10 @@ +@@ -148,7 +145,7 @@ static inline void init_fds(struct disk_ + for(i = 0; i < MAX_IOFD; i++) + dd->io_fd[i] = 0; + +- dd->io_fd[0] = prv->poll_fd; ++ dd->io_fd[0] = prv->completion_fd[0]; + } + + /* Open the disk file and initialize aio state. */ +@@ -163,11 +160,10 @@ int tdaio_open (struct disk_driver *dd, prv->iocb_free_count = MAX_AIO_REQS; prv->iocb_queued = 0; @@ -72,60 +68,50 @@ if (ret == -EAGAIN) { DPRINTF("Couldn't setup AIO context. If you are " "trying to concurrently use a large number " -@@ -164,9 +160,7 @@ +@@ -176,9 +172,7 @@ int tdaio_open (struct disk_driver *dd, "(e.g. 'echo echo 1048576 > /proc/sys/fs/" "aio-max-nr')\n"); } else { - DPRINTF("Couldn't get fd for AIO poll support. This " - "is probably because your kernel does not " - "have the aio-poll patch applied.\n"); -+ DPRINTF("Couldn't setup AIO context.\n"); ++ DPRINTF("Couldn't setup AIO context.\n"); } goto done; } -@@ -194,6 +188,15 @@ +@@ -209,6 +203,14 @@ int tdaio_open (struct disk_driver *dd, prv->fd = fd; + pipe(prv->command_fd); + pipe(prv->completion_fd); -+ -+ ret = pthread_create(&prv->aio_thread, NULL, ++ ++ ret = pthread_create(&prv->aio_thread, NULL, + tdaio_completion_thread, prv); + ret = 0; + write(prv->command_fd[1], &ret, sizeof(ret)); + -+ + init_fds(dd); ret = get_image_info(s, fd); - done: - return ret; -@@ -281,7 +284,7 @@ - /*initialise the FD array*/ - for(i=0;ipoll_fd; -+ fds[0] = prv->completion_fd[0]; - return fds; - } -@@ -296,17 +299,61 @@ +@@ -306,17 +308,62 @@ int tdaio_close(struct disk_driver *dd) return 0; } -+/* ++/* + * We don't have any way to do epoll on aio events in a normal kernel, so -+ * wait for aio events in a separate thread and return completion status ++ * wait for aio events in a separate thread and return completion status + * that via a pipe that can be waited on normally. -+ * ++ * + * To keep locking problems between the completion thread and the submit + * thread to a minimum, there's a handshake which allows only one thread + * to be doing work on the completion queue at a time: -+ * ++ * + * 1) main thread sends completion thread a command via the command pipe; -+ * 2) completion thread waits for aio events and returns the number ++ * 2) completion thread waits for aio events and returns the number + * received on the completion pipe + * 3) main thread processes the received prv->aio_events events -+ * 4) loop back to 1) to let the completion thread refill the aio_events ++ * 4) loop back to 1) to let the completion thread refill the aio_events + * buffer. + * + * This workaround needs to disappear once the kernel provides a single @@ -134,34 +120,35 @@ + +static void *tdaio_completion_thread(void *arg) +{ -+ struct tdaio_state *prv = (struct tdaio_state *) arg; -+ int command; -+ int nr_events; -+ int rc; -+ -+ while (1) { -+ rc = read(prv->command_fd[0], &command, sizeof(command)); ++ struct tdaio_state *prv = (struct tdaio_state *) arg; ++ int command; ++ int nr_events; ++ int rc; + -+ do { -+ /* Non-blocking test for completed io. */ -+ rc = io_getevents(prv->aio_ctx, 0, -+ MAX_AIO_REQS, prv->aio_events, -+ NULL); -+ if (rc) { -+ nr_events = rc; -+ rc = write(prv->completion_fd[1], &nr_events, -+ sizeof(nr_events)); -+ } -+ } while (!rc); -+ } ++ while (1) { ++ rc = read(prv->command_fd[0], &command, sizeof(command)); ++ ++ do { ++ /* Non-blocking test for completed io. */ ++ rc = io_getevents(prv->aio_ctx, 1, ++ MAX_AIO_REQS, prv->aio_events, ++ NULL); ++ if (rc) { ++ nr_events = rc; ++ rc = write(prv->completion_fd[1], &nr_events, ++ sizeof(nr_events)); ++ } ++ } while (!rc); ++ } +} + - int tdaio_do_callbacks(struct td_state *s, int sid) ++ + int tdaio_do_callbacks(struct disk_driver *dd, int sid) { - int ret, i, rsp = 0; + int ret, i, nr_events, rsp = 0; struct io_event *ep; - struct tdaio_state *prv = (struct tdaio_state *)s->private; + struct tdaio_state *prv = (struct tdaio_state *)dd->private; /* Non-blocking test for completed io. */ - ret = io_getevents(prv->aio_ctx, 0, MAX_AIO_REQS, prv->aio_events, @@ -170,18 +157,18 @@ - for (ep=prv->aio_events,i=ret; i-->0; ep++) { + ret = read(prv->completion_fd[0], &nr_events, sizeof(nr_events)); + -+repeat: ++repeat: + for (ep=prv->aio_events,i=nr_events; i-->0; ep++) { struct iocb *io = ep->obj; struct pending_aio *pio; -@@ -320,6 +367,16 @@ +@@ -327,6 +374,16 @@ int tdaio_do_callbacks(struct disk_drive prv->iocb_free[prv->iocb_free_count++] = io; } + + if (nr_events) { -+ nr_events = io_getevents(prv->aio_ctx, 0, ++ nr_events = io_getevents(prv->aio_ctx, 0, + MAX_AIO_REQS, prv->aio_events, + NULL); + goto repeat; @@ -191,15 +178,4 @@ + return rsp; } - ---- xen-unstable-11539/tools/blktap/drivers/block-aio.c.~1~ 2006-09-25 19:27:39.000000000 +0100 -+++ xen-unstable-11539/tools/blktap/drivers/block-aio.c 2006-09-25 20:00:24.000000000 +0100 -@@ -331,7 +331,7 @@ - do { - /* Non-blocking test for completed io. */ -- rc = io_getevents(prv->aio_ctx, 0, -+ rc = io_getevents(prv->aio_ctx, 1, - MAX_AIO_REQS, prv->aio_events, - NULL); - if (rc) { diff --git a/xen-dumpdir.patch b/xen-dumpdir.patch index 5d58cd9..03c34d4 100644 --- a/xen-dumpdir.patch +++ b/xen-dumpdir.patch @@ -1,7 +1,7 @@ -diff -ru xen-3.0.4_1-src/tools/debugger/gdb/README xen-3.0.4_1-src-new/tools/debugger/gdb/README ---- xen-3.0.4_1-src/tools/debugger/gdb/README 2007-01-08 10:00:47.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/debugger/gdb/README 2007-01-22 11:28:33.000000000 -0500 -@@ -33,6 +33,6 @@ +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/debugger/gdb/README xen-unstable.hg-3.0.5-pre-14797.new/tools/debugger/gdb/README +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/debugger/gdb/README 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/debugger/gdb/README 2007-04-13 10:37:35.000000000 -0400 +@@ -33,6 +33,6 @@ To debug a crashed domU guest: 1. Add '(enable-dump yes)' to /etc/xen/xend-config.sxp before starting xend. 2. When the domain crashes, a core file is written to @@ -9,22 +9,22 @@ diff -ru xen-3.0.4_1-src/tools/debugger/gdb/README xen-3.0.4_1-src-new/tools/deb + '/var/lib/xen/dump/..core'. 3. Run 'gdbserver-xen 127.0.0.1:9999 --file '. 4. Connect to the server as for a running guest. -diff -ru xen-3.0.4_1-src/tools/Makefile xen-3.0.4_1-src-new/tools/Makefile ---- xen-3.0.4_1-src/tools/Makefile 2007-01-08 10:00:46.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/Makefile 2007-01-22 11:28:13.000000000 -0500 -@@ -41,7 +41,7 @@ +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/Makefile xen-unstable.hg-3.0.5-pre-14797.new/tools/Makefile +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/Makefile 2007-04-11 19:10:30.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/Makefile 2007-04-13 10:37:59.000000000 -0400 +@@ -41,7 +41,7 @@ install: check $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemuinstall -- $(INSTALL_DIR) -p $(DESTDIR)/var/xen/dump -+ $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xen/dump - $(INSTALL_DIR) -p $(DESTDIR)/var/log/xen +- $(INSTALL_DIR) $(DESTDIR)/var/xen/dump ++ $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/dump + $(INSTALL_DIR) $(DESTDIR)/var/log/xen .PHONY: clean -diff -ru xen-3.0.4_1-src/tools/python/xen/xend/XendDomainInfo.py xen-3.0.4_1-src-new/tools/python/xen/xend/XendDomainInfo.py ---- xen-3.0.4_1-src/tools/python/xen/xend/XendDomainInfo.py 2007-01-08 10:00:50.000000000 -0500 -+++ xen-3.0.4_1-src-new/tools/python/xen/xend/XendDomainInfo.py 2007-01-22 11:29:03.000000000 -0500 -@@ -1151,7 +1151,7 @@ +diff -rupN xen-unstable.hg-3.0.5-pre-14797.orig/tools/python/xen/xend/XendDomainInfo.py xen-unstable.hg-3.0.5-pre-14797.new/tools/python/xen/xend/XendDomainInfo.py +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/python/xen/xend/XendDomainInfo.py 2007-04-11 19:10:36.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/python/xen/xend/XendDomainInfo.py 2007-04-13 10:37:35.000000000 -0400 +@@ -1269,7 +1269,7 @@ class XendDomainInfo: try: if not corefile: this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime()) diff --git a/xen-initscript.patch b/xen-initscript.patch index 0547400..9988239 100644 --- a/xen-initscript.patch +++ b/xen-initscript.patch @@ -1,6 +1,6 @@ -diff -ruN xen-3.0.4_1-src.orig/tools/examples/init.d/xend xen-3.0.4_1-src.new/tools/examples/init.d/xend ---- xen-3.0.4_1-src.orig/tools/examples/init.d/xend 2007-01-08 10:00:48.000000000 -0500 -+++ xen-3.0.4_1-src.new/tools/examples/init.d/xend 2007-01-18 12:41:07.000000000 -0500 +diff -rup xen-3.0.5-testing.hg-rc3-14934/tools/examples/init.d/xend xen-3.0.5-testing.hg-rc3-14934.new/tools/examples/init.d/xend +--- xen-3.0.5-testing.hg-rc3-14934/tools/examples/init.d/xend 2007-04-26 19:31:46.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc3-14934.new/tools/examples/init.d/xend 2007-04-26 19:32:47.000000000 -0400 @@ -7,40 +7,66 @@ # chkconfig: 2345 98 01 # description: Starts and stops the Xen control daemon. @@ -42,10 +42,10 @@ diff -ruN xen-3.0.4_1-src.orig/tools/examples/init.d/xend xen-3.0.4_1-src.new/to start) - xend start + echo -n $"Starting $prog: " -+ modprobe blkbk -+ modprobe blktap -+ modprobe netbk -+ modprobe netloop ++ modprobe blkbk 2>/dev/null ++ modprobe blktap 2>/dev/null ++ modprobe xenblktap 2>/dev/null ++ modprobe netbk 2>/dev/null + /usr/sbin/xend start await_daemons_up ;; @@ -75,7 +75,7 @@ diff -ruN xen-3.0.4_1-src.orig/tools/examples/init.d/xend xen-3.0.4_1-src.new/to await_daemons_up ;; *) -@@ -50,5 +76,12 @@ +@@ -50,5 +76,12 @@ case "$1" in exit 1 esac diff --git a/xen-mem-pre-balloon.patch b/xen-mem-pre-balloon.patch new file mode 100644 index 0000000..71a0fc3 --- /dev/null +++ b/xen-mem-pre-balloon.patch @@ -0,0 +1,16 @@ +diff -rup xen-3.0.5-testing.hg-rc4/tools/python/xen/xend/XendDomainInfo.py xen-3.0.5-testing.hg-rc4.new/tools/python/xen/xend/XendDomainInfo.py +--- xen-3.0.5-testing.hg-rc4/tools/python/xen/xend/XendDomainInfo.py 2007-04-30 16:03:09.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc4.new/tools/python/xen/xend/XendDomainInfo.py 2007-04-30 16:02:05.000000000 -0400 +@@ -1468,9 +1468,9 @@ class XendDomainInfo: + raise VmError("HVM guest support is unavailable: is VT/AMD-V " + "supported by your CPU and enabled in your " + "BIOS?") +- # Hack to pre-reserve some memory for HVM setup. +- # Needed because Xen allocates 1MB by default immediately. +- balloon.free(2*1024) # 2MB should be plenty ++ # Hack to pre-reserve some memory for domain setup. ++ # Needed because Xen allocates 1MB by default immediately. ++ balloon.free(2*1024) # 2MB should be plenty + + self.domid = xc.domain_create( + domid = 0, diff --git a/xen-net-bridge.patch b/xen-net-bridge.patch new file mode 100644 index 0000000..dfd6c6f --- /dev/null +++ b/xen-net-bridge.patch @@ -0,0 +1,405 @@ +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/examples/network-bridge xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/network-bridge +--- xen-3.0.5-testing.hg-rc2-14889/tools/examples/network-bridge 2007-04-23 19:21:23.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/network-bridge 2007-04-26 11:14:10.000000000 -0400 +@@ -5,9 +5,10 @@ + # The script name to use is defined in /etc/xen/xend-config.sxp + # in the network-script field. + # +-# This script creates a bridge (default xenbr${vifnum}), adds a device +-# (default eth${vifnum}) to it, copies the IP addresses from the device +-# to the bridge and adjusts the routes accordingly. ++# This script creates a bridge (default ${netdev}), adds a device ++# (defaults to the device on the default gateway route) to it, copies ++# the IP addresses from the device to the bridge and adjusts the routes ++# accordingly. + # + # If all goes well, this should ensure that networking stays up. + # However, some configurations are upset by this, especially +@@ -20,31 +21,27 @@ + # + # Vars: + # +-# vifnum Virtual device number to use (default 0). Numbers >=8 +-# require the netback driver to have nloopbacks set to a +-# higher value than its default of 8. +-# bridge The bridge to use (default xenbr${vifnum}). +-# netdev The interface to add to the bridge (default eth${vifnum}). ++# bridge The bridge to use (default ${netdev}). ++# netdev The interface to add to the bridge (default gateway device). + # antispoof Whether to use iptables to prevent spoofing (default no). + # + # Internal Vars: + # pdev="p${netdev}" +-# vdev="veth${vifnum}" +-# vif0="vif0.${vifnum}" ++# tdev=tmpbridge + # + # start: +-# Creates the bridge +-# Copies the IP and MAC addresses from netdev to vdev ++# Creates the bridge as tdev ++# Copies the IP and MAC addresses from pdev to bridge + # Renames netdev to be pdev +-# Renames vdev to be netdev +-# Enslaves pdev, vdev to bridge ++# Renames tdev to bridge ++# Enslaves pdev to bridge + # + # stop: +-# Removes netdev from the bridge +-# Transfers addresses, routes from netdev to pdev +-# Renames netdev to vdev ++# Removes pdev from the bridge ++# Transfers addresses, routes from bridge to pdev ++# Renames bridge to tdev + # Renames pdev to netdev +-# Deletes bridge ++# Deletes tdev + # + # status: + # Print addresses, interfaces, routes +@@ -59,15 +56,13 @@ dir=$(dirname "$0") + findCommand "$@" + evalVariables "$@" + +-vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')} +-vifnum=${vifnum:-0} +-bridge=${bridge:-xenbr${vifnum}} +-netdev=${netdev:-eth${vifnum}} ++netdev=${netdev:-$(ip route list | awk '/^default / { print $NF }' | ++ sed 's/.* dev //')} ++bridge=${bridge:-${netdev}} + antispoof=${antispoof:-no} + + pdev="p${netdev}" +-vdev="veth${vifnum}" +-vif0="vif0.${vifnum}" ++tdev=tmpbridge + + get_ip_info() { + addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'` +@@ -157,7 +152,6 @@ antispoofing () { + iptables -P FORWARD DROP + iptables -F FORWARD + iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT +- iptables -A FORWARD -m physdev --physdev-in ${vif0} -j ACCEPT + } + + # Usage: show_status dev bridge +@@ -184,53 +178,27 @@ op_start () { + fi + + if link_exists "$pdev"; then +- # The device is already up. +- return +- fi +- if link_exists veth0 && ! link_exists "$vdev"; then +- echo " +-Link $vdev is missing. +-This may be because you have reached the limit of the number of interfaces +-that the loopback driver supports. If the loopback driver is a module, you +-may raise this limit by passing it as a parameter (nloopbacks=); if the +-driver is compiled statically into the kernel, then you may set the parameter +-using netloop.nloopbacks= on the domain 0 kernel command line. +-" >&2 +- exit 1 ++ # The device is already up. ++ return + fi + +- create_bridge ${bridge} ++ create_bridge ${tdev} + +- if link_exists "$vdev"; then +- mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` +- preiftransfer ${netdev} +- transfer_addrs ${netdev} ${vdev} +- if ! ifdown ${netdev}; then +- # If ifdown fails, remember the IP details. +- get_ip_info ${netdev} +- ip link set ${netdev} down +- ip addr flush ${netdev} +- fi +- ip link set ${netdev} name ${pdev} +- ip link set ${vdev} name ${netdev} +- +- setup_bridge_port ${pdev} +- setup_bridge_port ${vif0} +- ip link set ${netdev} addr ${mac} arp on +- +- ip link set ${bridge} up +- add_to_bridge ${bridge} ${vif0} +- add_to_bridge2 ${bridge} ${pdev} +- do_ifup ${netdev} +- else +- ip link set ${bridge} arp on +- ip link set ${bridge} multicast on +- # old style without ${vdev} +- transfer_addrs ${netdev} ${bridge} +- transfer_routes ${netdev} ${bridge} +- # Attach the real interface to the bridge. +- add_to_bridge ${bridge} ${netdev} ++ preiftransfer ${netdev} ++ transfer_addrs ${netdev} ${tdev} ++ if ! ifdown ${netdev}; then ++ # If ifdown fails, remember the IP details. ++ get_ip_info ${netdev} ++ ip link set ${netdev} down ++ ip addr flush ${netdev} + fi ++ ip link set ${netdev} name ${pdev} ++ ip link set ${tdev} name ${bridge} ++ ++ setup_bridge_port ${pdev} ++ ++ add_to_bridge2 ${bridge} ${pdev} ++ do_ifup ${bridge} + + if [ ${antispoof} = 'yes' ] ; then + antispoofing +@@ -245,31 +213,21 @@ op_stop () { + return + fi + +- if link_exists "$pdev"; then +- ip link set dev ${vif0} down +- mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` +- transfer_addrs ${netdev} ${pdev} +- if ! ifdown ${netdev}; then +- get_ip_info ${netdev} +- fi +- ip link set ${netdev} down arp off +- ip link set ${netdev} addr fe:ff:ff:ff:ff:ff +- ip link set ${pdev} down +- ip addr flush ${netdev} +- ip link set ${pdev} addr ${mac} arp on +- +- brctl delif ${bridge} ${pdev} +- brctl delif ${bridge} ${vif0} +- ip link set ${bridge} down +- +- ip link set ${netdev} name ${vdev} +- ip link set ${pdev} name ${netdev} +- do_ifup ${netdev} +- else +- transfer_routes ${bridge} ${netdev} +- ip link set ${bridge} down ++ transfer_addrs ${bridge} ${pdev} ++ if ! ifdown ${bridge}; then ++ get_ip_info ${bridge} + fi +- brctl delbr ${bridge} ++ ip link set ${pdev} down ++ ip addr flush ${bridge} ++ ++ brctl delif ${bridge} ${pdev} ++ ip link set ${bridge} down ++ ++ ip link set ${bridge} name ${tdev} ++ ip link set ${pdev} name ${netdev} ++ do_ifup ${netdev} ++ ++ brctl delbr ${tdev} + } + + # adds $dev to $bridge but waits for $dev to be in running state first +Only in xen-3.0.5-testing.hg-rc2-14889.new/tools/examples: network-bridge~ +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/examples/vif-bridge xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/vif-bridge +--- xen-3.0.5-testing.hg-rc2-14889/tools/examples/vif-bridge 2007-04-23 19:21:23.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/vif-bridge 2007-04-26 11:06:37.000000000 -0400 +@@ -44,6 +44,32 @@ then + then + fatal "Could not find bridge, and none was specified" + fi ++else ++ # ++ # Old style bridge setup with netloop, used to have a bridge name ++ # of xenbrX, enslaving pethX and vif0.X, and then configuring ++ # eth0. ++ # ++ # New style bridge setup does not use netloop, so the bridge name ++ # is ethX and the physical device is enslaved pethX ++ # ++ # So if... ++ # ++ # - User asks for xenbrX ++ # - AND xenbrX doesn't exist ++ # - AND there is a ethX device which is a bridge ++ # ++ # ..then we translate xenbrX to ethX ++ # ++ # This lets old config files work without modification ++ # ++ if [ ! -e "/sys/class/net/$bridge" ] && [ "${bridge:0:5}" == "xenbr" ] ++ then ++ if [ -e "/sys/class/net/eth${bridge:5}/bridge" ] ++ then ++ bridge="eth${bridge:5}" ++ fi ++ fi + fi + + RET=0 +@@ -65,10 +91,8 @@ case "$command" in + ;; + esac + +-handle_iptable +- + log debug "Successful vif-bridge $command for $vif, bridge $bridge." +-if [ "$command" = "online" ] ++if [ "$command" == "online" ] + then + success + fi +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/examples/xend-config.sxp xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/xend-config.sxp +--- xen-3.0.5-testing.hg-rc2-14889/tools/examples/xend-config.sxp 2007-04-26 11:06:17.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/xend-config.sxp 2007-04-26 11:06:37.000000000 -0400 +@@ -118,9 +118,7 @@ + ## + # To bridge network traffic, like this: + # +-# dom0: fake eth0 -> vif0.0 -+ +-# | +-# bridge -> real eth0 -> the network ++# dom0: ----------------- bridge -> real eth0 -> the network + # | + # domU: fake eth0 -> vifN.0 -+ + # +@@ -143,6 +141,13 @@ + # yourself a wrapper script, and call network-bridge from it, as appropriate. + # + (network-script network-bridge) ++#### LAPTOP USERS ! ##### ++# For laptops, or machines where network interfaces come/go on-the-fly, ++# or are otherwise managed by NetworkManager, comment out the above line. ++# Then, uncomment the line below, and use libvirt's virtual networking ++# capability which sets up a isolated bridge + NAT forwarding ++#(network-script /bin/true) ++#### LAPTOP USERS ! ##### + + # The script used to control virtual interfaces. This can be overridden on a + # per-vif basis when creating a domain or a configuring a new vif. The +@@ -162,12 +167,14 @@ + + ## Use the following if network traffic is routed, as an alternative to the + # settings for bridged networking given above. ++# NB: Obsolete. See note above for LAPTOP USERS + #(network-script network-route) + #(vif-script vif-route) + + + ## Use the following if network traffic is routed with NAT, as an alternative + # to the settings for bridged networking given above. ++# NB: Obsolete. See note above for LAPTOP USERS + #(network-script network-nat) + #(vif-script vif-nat) + +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/examples/xen-network-common.sh xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/xen-network-common.sh +--- xen-3.0.5-testing.hg-rc2-14889/tools/examples/xen-network-common.sh 2007-04-23 19:21:23.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/examples/xen-network-common.sh 2007-04-26 11:06:37.000000000 -0400 +@@ -90,8 +90,6 @@ find_dhcpd_init_file() + } + + # configure interfaces which act as pure bridge ports: +-# - make quiet: no arp, no multicast (ipv6 autoconf) +-# - set mac address to fe:ff:ff:ff:ff:ff + setup_bridge_port() { + local dev="$1" + +@@ -99,9 +97,6 @@ setup_bridge_port() { + ip link set ${dev} down + + # ... and configure it +- ip link set ${dev} arp off +- ip link set ${dev} multicast off +- ip link set ${dev} addr fe:ff:ff:ff:ff:ff + ip addr flush ${dev} + } + +@@ -114,15 +109,14 @@ create_bridge () { + brctl addbr ${bridge} + brctl stp ${bridge} off + brctl setfd ${bridge} 0 +- ip link set ${bridge} arp off +- ip link set ${bridge} multicast off ++ # Setting these to zero stops guest<->LAN traffic ++ # traversing the bridge from hitting the *tables ++ # rulesets. guest<->host traffic still gets processed ++ # by the host's iptables rules so this isn't a hole ++ sysctl -q -w "net.bridge.bridge-nf-call-arptables=0" ++ sysctl -q -w "net.bridge.bridge-nf-call-ip6tables=0" ++ sysctl -q -w "net.bridge.bridge-nf-call-iptables=0" + fi +- +- # A small MTU disables IPv6 (and therefore IPv6 addrconf). +- mtu=$(ip link show ${bridge} | sed -n 's/.* mtu \([0-9]\+\).*/\1/p') +- ip link set ${bridge} mtu 68 +- ip link set ${bridge} up +- ip link set ${bridge} mtu ${mtu:-1500} + } + + # Usage: add_to_bridge bridge dev +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/ioemu/patches/qemu-target-i386-dm xen-3.0.5-testing.hg-rc2-14889.new/tools/ioemu/patches/qemu-target-i386-dm +--- xen-3.0.5-testing.hg-rc2-14889/tools/ioemu/patches/qemu-target-i386-dm 2007-04-23 19:21:23.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/ioemu/patches/qemu-target-i386-dm 2007-04-26 11:06:37.000000000 -0400 +@@ -1353,7 +1353,7 @@ Index: ioemu/target-i386-dm/qemu-ifup + =================================================================== + --- /dev/null 1970-01-01 00:00:00.000000000 +0000 + +++ ioemu/target-i386-dm/qemu-ifup 2006-12-08 01:41:11.000000000 +0000 +-@@ -0,0 +1,10 @@ ++@@ -0,0 +1,16 @@ + +#!/bin/sh + + + +#. /etc/rc.d/init.d/functions +@@ -1362,5 +1362,11 @@ Index: ioemu/target-i386-dm/qemu-ifup + +echo -c 'config qemu network with xen bridge for ' + +echo $* + + +++bridge=$2 +++ +++if [ ! -e /sys/class/net/$bridge ]; then +++ bridge=$(brctl show | sed -n '2s/[[:blank:]].*//p') +++fi +++ + +ifconfig $1 0.0.0.0 up +-+brctl addif $2 $1 +++brctl addif $bridge $1 +diff -rup xen-3.0.5-testing.hg-rc2-14889/tools/ioemu/target-i386-dm/qemu-ifup xen-3.0.5-testing.hg-rc2-14889.new/tools/ioemu/target-i386-dm/qemu-ifup +--- xen-3.0.5-testing.hg-rc2-14889/tools/ioemu/target-i386-dm/qemu-ifup 2007-04-23 19:21:23.000000000 -0400 ++++ xen-3.0.5-testing.hg-rc2-14889.new/tools/ioemu/target-i386-dm/qemu-ifup 2007-04-26 11:06:37.000000000 -0400 +@@ -5,5 +5,33 @@ + + echo 'config qemu network with xen bridge for ' $* + ++bridge=$2 ++ ++# ++# Old style bridge setup with netloop, used to have a bridge name ++# of xenbrX, enslaving pethX and vif0.X, and then configuring ++# eth0. ++# ++# New style bridge setup does not use netloop, so the bridge name ++# is ethX and the physical device is enslaved pethX ++# ++# So if... ++# ++# - User asks for xenbrX ++# - AND xenbrX doesn't exist ++# - AND there is a ethX device which is a bridge ++# ++# ..then we translate xenbrX to ethX ++# ++# This lets old config files work without modification ++# ++if [ ! -e "/sys/class/net/$bridge" ] && [ "${bridge:0:5}" == "xenbr" ] ++then ++ if [ -e "/sys/class/net/eth${bridge:5}/bridge" ] ++ then ++ bridge="eth${bridge:5}" ++ fi ++fi ++ + ifconfig $1 0.0.0.0 up +-brctl addif $2 $1 ++brctl addif $bridge $1 diff --git a/xen-pvfb-compat.patch b/xen-pvfb-compat.patch index 126de34..9284a08 100644 --- a/xen-pvfb-compat.patch +++ b/xen-pvfb-compat.patch @@ -1,9 +1,10 @@ diff -r a2618d3912e7 tools/python/xen/xend/server/vfbif.py --- a/tools/python/xen/xend/server/vfbif.py Mon Dec 04 19:13:55 2006 +0000 +++ b/tools/python/xen/xend/server/vfbif.py Tue Dec 05 10:29:17 2006 +0100 -@@ -37,5 +37,8 @@ class VfbifController(DevController): - def createDevice(self, config): - DevController.createDevice(self, config) +@@ -50,6 +50,9 @@ class VfbifController(DevController): + # is HVM, so qemu-dm will handle the vfb. + return + + # old frontend compatibility + self.vm._writeDom("console/use_graphics", "1") + # /old @@ -44,12 +45,12 @@ diff -r a2618d3912e7 tools/xenfb/Makefile @@ -13,12 +17,14 @@ all: build .PHONY: build - build: mk-symlinks + build: - $(MAKE) vncfb sdlfb + $(MAKE) vncfb sdlfb vncfbo sdlfbo install: all - $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)/xen/bin + $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)/xen/bin $(INSTALL_PROG) vncfb $(DESTDIR)/usr/$(LIBDIR)/xen/bin/xen-vncfb $(INSTALL_PROG) sdlfb $(DESTDIR)/usr/$(LIBDIR)/xen/bin/xen-sdlfb + $(INSTALL_PROG) vncfbo $(DESTDIR)/usr/$(LIBDIR)/xen/bin/xen-vncfbo diff --git a/xen-remove-python-path-check.patch b/xen-remove-python-path-check.patch new file mode 100644 index 0000000..ee36dcc --- /dev/null +++ b/xen-remove-python-path-check.patch @@ -0,0 +1,18 @@ +diff -rup xen-unstable.hg-3.0.5-pre-14797.orig/tools/misc/xend xen-unstable.hg-3.0.5-pre-14797.new/tools/misc/xend +--- xen-unstable.hg-3.0.5-pre-14797.orig/tools/misc/xend 2007-04-11 19:10:35.000000000 -0400 ++++ xen-unstable.hg-3.0.5-pre-14797.new/tools/misc/xend 2007-04-11 19:12:38.000000000 -0400 +@@ -31,14 +31,6 @@ import signal + import time + import commands + +-result = commands.getstatusoutput(os.path.join(os.path.dirname(sys.argv[0]), +- 'xen-python-path')) +-if result[0] != 0: +- print >>sys.stderr, result[1] +- sys.exit(1) +- +-sys.path.append(result[1]) +- + from xen.xend.server import SrvDaemon + + class CheckError(ValueError): diff --git a/xen-xs-transactions.patch b/xen-xs-transactions.patch new file mode 100644 index 0000000..dd3955b --- /dev/null +++ b/xen-xs-transactions.patch @@ -0,0 +1,420 @@ +diff -r 8ca89a9e54a7 tools/python/xen/xend/XendConfig.py +--- a/tools/python/xen/xend/XendConfig.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/XendConfig.py Wed Apr 25 12:52:29 2007 -0400 +@@ -26,6 +26,7 @@ from xen.xend.XendDevices import XendDev + from xen.xend.XendDevices import XendDevices + from xen.xend.PrettyPrint import prettyprintstring + from xen.xend.XendConstants import DOM_STATE_HALTED ++from xen.xend.xenstore.xstransact import xstransact + + log = logging.getLogger("xend.XendConfig") + log.setLevel(logging.WARN) +@@ -884,36 +885,43 @@ class XendConfig(dict): + + # Marshall devices (running or from configuration) + if not ignore_devices: +- for cls in XendDevices.valid_devices(): +- found = False ++ txn = xstransact() ++ try: ++ for cls in XendDevices.valid_devices(): ++ found = False + +- # figure if there is a dev controller is valid and running +- if domain and domain.getDomid() != None: +- try: +- controller = domain.getDeviceController(cls) +- configs = controller.configurations() +- for config in configs: +- if sxp.name(config) in ('vbd', 'tap'): +- # The bootable flag is never written to the +- # store as part of the device config. +- dev_uuid = sxp.child_value(config, 'uuid') +- dev_type, dev_cfg = self['devices'][dev_uuid] +- is_bootable = dev_cfg.get('bootable', 0) +- config.append(['bootable', int(is_bootable)]) +- +- sxpr.append(['device', config]) +- +- found = True +- except: +- log.exception("dumping sxp from device controllers") +- pass ++ # figure if there is a dev controller is valid and running ++ if domain and domain.getDomid() != None: ++ try: ++ controller = domain.getDeviceController(cls) ++ configs = controller.configurations(txn) ++ for config in configs: ++ if sxp.name(config) in ('vbd', 'tap'): ++ # The bootable flag is never written to the ++ # store as part of the device config. ++ dev_uuid = sxp.child_value(config, 'uuid') ++ dev_type, dev_cfg = self['devices'][dev_uuid] ++ is_bootable = dev_cfg.get('bootable', 0) ++ config.append(['bootable', int(is_bootable)]) ++ ++ sxpr.append(['device', config]) ++ ++ found = True ++ except: ++ log.exception("dumping sxp from device controllers") ++ pass + +- # if we didn't find that device, check the existing config +- # for a device in the same class +- if not found: +- for dev_type, dev_info in self.all_devices_sxpr(): +- if dev_type == cls: +- sxpr.append(['device', dev_info]) ++ # if we didn't find that device, check the existing config ++ # for a device in the same class ++ if not found: ++ for dev_type, dev_info in self.all_devices_sxpr(): ++ if dev_type == cls: ++ sxpr.append(['device', dev_info]) ++ ++ txn.commit() ++ except: ++ txn.abort() ++ raise + + return sxpr + +diff -r 8ca89a9e54a7 tools/python/xen/xend/XendDomain.py +--- a/tools/python/xen/xend/XendDomain.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/XendDomain.py Wed Apr 25 12:53:38 2007 -0400 +@@ -391,13 +391,22 @@ class XendDomain: + @rtype: None + """ + ++ txn = xstransact() ++ try: ++ self._refreshTxn(txn, refresh_shutdown) ++ txn.commit() ++ except: ++ txn.abort() ++ raise ++ ++ def _refreshTxn(self, transaction, refresh_shutdown): + running = self._running_domains() + # Add domains that are not already tracked but running in Xen, + # and update domain state for those that are running and tracked. + for dom in running: + domid = dom['domid'] + if domid in self.domains: +- self.domains[domid].update(dom, refresh_shutdown) ++ self.domains[domid].update(dom, refresh_shutdown, transaction) + elif domid not in self.domains and dom['dying'] != 1: + try: + new_dom = XendDomainInfo.recreate(dom, False) +diff -r 8ca89a9e54a7 tools/python/xen/xend/XendDomainInfo.py +--- a/tools/python/xen/xend/XendDomainInfo.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/XendDomainInfo.py Wed Apr 25 12:55:05 2007 -0400 +@@ -704,12 +704,15 @@ class XendDomainInfo: + + self._update_consoles() + +- def _update_consoles(self): ++ def _update_consoles(self, transaction = None): + if self.domid == None or self.domid == 0: + return + + # Update VT100 port if it exists +- self.console_port = self.readDom('console/port') ++ if transaction is None: ++ self.console_port = self.readDom('console/port') ++ else: ++ self.console_port = self.readDomTxn(transaction, 'console/port') + if self.console_port is not None: + serial_consoles = self.info.console_get_all('vt100') + if not serial_consoles: +@@ -722,7 +725,10 @@ class XendDomainInfo: + + + # Update VNC port if it exists and write to xenstore +- vnc_port = self.readDom('console/vnc-port') ++ if transaction is None: ++ vnc_port = self.readDom('console/vnc-port') ++ else: ++ vnc_port = self.readDomTxn(transaction, 'console/vnc-port') + if vnc_port is not None: + for dev_uuid, (dev_type, dev_info) in self.info['devices'].items(): + if dev_type == 'vfb': +@@ -757,6 +763,27 @@ class XendDomainInfo: + def storeVm(self, *args): + return xstransact.Store(self.vmpath, *args) + ++ ++ def _readVmTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.read(*paths) ++ ++ def _writeVmTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.write(*paths) ++ ++ def _removeVmTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.remove(*paths) ++ ++ def _gatherVmTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.gather(paths) ++ ++ def storeVmTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.store(*paths) ++ + # + # Function to update xenstore /dom/* + # +@@ -775,6 +802,28 @@ class XendDomainInfo: + + def storeDom(self, *args): + return xstransact.Store(self.dompath, *args) ++ ++ ++ def readDomTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.read(*paths) ++ ++ def gatherDomTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.gather(*paths) ++ ++ def _writeDomTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.write(*paths) ++ ++ def _removeDomTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.remove(*paths) ++ ++ def storeDomTxn(self, transaction, *args): ++ paths = map(lambda x: self.vmpath + "/" + x, args) ++ return transaction.store(*paths) ++ + + def _recreateDom(self): + complete(self.dompath, lambda t: self._recreateDomFunc(t)) +@@ -2062,7 +2111,7 @@ class XendDomainInfo: + (" as domain %s" % str(dom.domid)) or "")) + + +- def update(self, info = None, refresh = True): ++ def update(self, info = None, refresh = True, transaction = None): + """Update with info from xc.domain_getinfo(). + """ + log.trace("XendDomainInfo.update(%s) on domain %s", info, +@@ -2094,7 +2143,7 @@ class XendDomainInfo: + # TODO: we should eventually get rid of old_dom_states + + self.info.update_config(info) +- self._update_consoles() ++ self._update_consoles(transaction) + + if refresh: + self.refreshShutdown(info) +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/ConsoleController.py +--- a/tools/python/xen/xend/server/ConsoleController.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/ConsoleController.py Wed Apr 25 12:57:05 2007 -0400 +@@ -19,9 +19,12 @@ class ConsoleController(DevController): + return (self.allocateDeviceID(), back, {}) + + +- def getDeviceConfiguration(self, devid): +- result = DevController.getDeviceConfiguration(self, devid) +- devinfo = self.readBackend(devid, *self.valid_cfg) ++ def getDeviceConfiguration(self, devid, transaction = None): ++ result = DevController.getDeviceConfiguration(self, devid, transaction) ++ if transaction is None: ++ devinfo = self.readBackend(devid, *self.valid_cfg) ++ else: ++ devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg) + config = dict(zip(self.valid_cfg, devinfo)) + config = dict([(key, val) for key, val in config.items() + if val != None]) +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/DevController.py +--- a/tools/python/xen/xend/server/DevController.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/DevController.py Wed Apr 25 12:57:05 2007 -0400 +@@ -225,15 +225,15 @@ class DevController: + + self.vm._removeVm("device/%s/%d" % (self.deviceClass, devid)) + +- def configurations(self): +- return map(self.configuration, self.deviceIDs()) +- +- +- def configuration(self, devid): ++ def configurations(self, transaction = None): ++ return map(lambda x: self.configuration(x, transaction), self.deviceIDs(transaction)) ++ ++ ++ def configuration(self, devid, transaction = None): + """@return an s-expression giving the current configuration of the + specified device. This would be suitable for giving to {@link + #createDevice} in order to recreate that device.""" +- configDict = self.getDeviceConfiguration(devid) ++ configDict = self.getDeviceConfiguration(devid, transaction) + sxpr = [self.deviceClass] + for key, val in configDict.items(): + if isinstance(val, (types.ListType, types.TupleType)): +@@ -259,13 +259,16 @@ class DevController: + 'id', devid]] + + +- def getDeviceConfiguration(self, devid): ++ def getDeviceConfiguration(self, devid, transaction = None): + """Returns the configuration of a device. + + @note: Similar to L{configuration} except it returns a dict. + @return: dict + """ +- backdomid = xstransact.Read(self.frontendPath(devid), "backend-id") ++ if transaction is None: ++ backdomid = xstransact.Read(self.frontendPath(devid), "backend-id") ++ else: ++ backdomid = transaction.read(self.frontendPath(devid) + "/backend-id") + if backdomid is None: + raise VmError("Device %s not connected" % devid) + +@@ -393,14 +396,28 @@ class DevController: + else: + raise VmError("Device %s not connected" % devid) + ++ def readBackendTxn(self, transaction, devid, *args): ++ frontpath = self.frontendPath(devid) ++ backpath = transaction.read(frontpath + "/backend") ++ if backpath: ++ paths = map(lambda x: backpath + "/" + x, args) ++ return transaction.read(*paths) ++ else: ++ raise VmError("Device %s not connected" % devid) ++ + def readFrontend(self, devid, *args): + return xstransact.Read(self.frontendPath(devid), *args) ++ ++ def readFrontendTxn(self, transaction, devid, *args): ++ paths = map(lambda x: self.frontendPath(devid) + "/" + x, args) ++ return transaction.read(*paths) + + def deviceIDs(self, transaction = None): + """@return The IDs of each of the devices currently configured for + this instance's deviceClass. + """ + fe = self.backendRoot() ++ + if transaction: + return map(lambda x: int(x.split('/')[-1]), transaction.list(fe)) + else: +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/blkif.py +--- a/tools/python/xen/xend/server/blkif.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/blkif.py Wed Apr 25 12:57:05 2007 -0400 +@@ -107,19 +107,26 @@ class BlkifController(DevController): + (self.deviceClass, devid, config)) + + +- def getDeviceConfiguration(self, devid): ++ def getDeviceConfiguration(self, devid, transaction = None): + """Returns the configuration of a device. + + @note: Similar to L{configuration} except it returns a dict. + @return: dict + """ +- config = DevController.getDeviceConfiguration(self, devid) +- devinfo = self.readBackend(devid, 'dev', 'type', 'params', 'mode', +- 'uuid') ++ config = DevController.getDeviceConfiguration(self, devid, transaction) ++ if transaction is None: ++ devinfo = self.readBackend(devid, 'dev', 'type', 'params', 'mode', ++ 'uuid') ++ else: ++ devinfo = self.readBackendTxn(transaction, devid, ++ 'dev', 'type', 'params', 'mode', 'uuid') + dev, typ, params, mode, uuid = devinfo + + if dev: +- dev_type = self.readFrontend(devid, 'device-type') ++ if transaction is None: ++ dev_type = self.readFrontend(devid, 'device-type') ++ else: ++ dev_type = self.readFrontendTxn(transaction, devid, 'device-type') + if dev_type: + dev += ':' + dev_type + config['dev'] = dev +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/netif.py +--- a/tools/python/xen/xend/server/netif.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/netif.py Wed Apr 25 12:57:05 2007 -0400 +@@ -149,16 +149,19 @@ class NetifController(DevController): + return (devid, back, front) + + +- def getDeviceConfiguration(self, devid): ++ def getDeviceConfiguration(self, devid, transaction = None): + """@see DevController.configuration""" + +- result = DevController.getDeviceConfiguration(self, devid) ++ result = DevController.getDeviceConfiguration(self, devid, transaction) + + config_path = "device/%s/%d/" % (self.deviceClass, devid) + devinfo = () + for x in ( 'script', 'ip', 'bridge', 'mac', + 'type', 'vifname', 'rate', 'uuid', 'model' ): +- y = self.vm._readVm(config_path + x) ++ if transaction is None: ++ y = self.vm._readVm(config_path + x) ++ else: ++ y = self.vm._readVmTxn(transaction, config_path + x) + devinfo += (y,) + (script, ip, bridge, mac, typ, vifname, rate, uuid, model) = devinfo + +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/pciif.py +--- a/tools/python/xen/xend/server/pciif.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/pciif.py Wed Apr 25 12:57:05 2007 -0400 +@@ -78,8 +78,8 @@ class PciController(DevController): + back['uuid'] = config.get('uuid','') + return (0, back, {}) + +- def getDeviceConfiguration(self, devid): +- result = DevController.getDeviceConfiguration(self, devid) ++ def getDeviceConfiguration(self, devid, transaction = None): ++ result = DevController.getDeviceConfiguration(self, devid, transaction) + num_devs = self.readBackend(devid, 'num_devs') + pci_devs = [] + +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/tpmif.py +--- a/tools/python/xen/xend/server/tpmif.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/tpmif.py Wed Apr 25 12:57:05 2007 -0400 +@@ -67,9 +67,9 @@ class TPMifController(DevController): + + return (devid, back, front) + +- def getDeviceConfiguration(self, devid): ++ def getDeviceConfiguration(self, devid, transaction = None): + """Returns the configuration of a device""" +- result = DevController.getDeviceConfiguration(self, devid) ++ result = DevController.getDeviceConfiguration(self, devid, transaction) + + (instance, uuid, type) = \ + self.readBackend(devid, 'instance', +diff -r 8ca89a9e54a7 tools/python/xen/xend/server/vfbif.py +--- a/tools/python/xen/xend/server/vfbif.py Wed Apr 25 09:44:20 2007 +0100 ++++ b/tools/python/xen/xend/server/vfbif.py Wed Apr 25 12:57:05 2007 -0400 +@@ -35,10 +35,13 @@ class VfbifController(DevController): + return (devid, back, {}) + + +- def getDeviceConfiguration(self, devid): +- result = DevController.getDeviceConfiguration(self, devid) ++ def getDeviceConfiguration(self, devid, transaction = None): ++ result = DevController.getDeviceConfiguration(self, devid, transaction) + +- devinfo = self.readBackend(devid, *CONFIG_ENTRIES) ++ if transaction is None: ++ devinfo = self.readBackend(devid, *CONFIG_ENTRIES) ++ else: ++ devinfo = self.readBackendTxn(transaction, devid, *CONFIG_ENTRIES) + return dict([(CONFIG_ENTRIES[i], devinfo[i]) + for i in range(len(CONFIG_ENTRIES)) + if devinfo[i] is not None]) diff --git a/xen.spec b/xen.spec index 8821f2b..327f2ca 100644 --- a/xen.spec +++ b/xen.spec @@ -2,26 +2,23 @@ Summary: Xen is a virtual machine monitor Name: xen -Version: 3.0.4 -Release: 9%{dist} +Version: 3.0.5 +Release: 0.rc4.1%{dist} Group: Development/Libraries License: GPL URL: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html -Source0: http://bits.xensource.com/oss-xen/release/3.0.4-1/src.tgz/xen-3.0.4_1-src.tgz +Source0: xen-3.0.5-testing.hg-rc4.tar.gz Source1: http://download.sf.net/libvncserver/LibVNCServer-0.8.2.tar.gz Patch1: xen-initscript.patch +Patch2: xen-remove-python-path-check.patch Patch3: xen-compile-fixes.patch -Patch6: xen-network-iptables-bridge.patch +Patch6: xen-net-bridge.patch +Patch7: xen-mem-pre-balloon.patch Patch13: xen-dumpdir.patch -Patch14: xen-pygrub-memcorruption.patch -Patch15: xen-vnclisten-config.patch -Patch16: xen-hotplug-error-reporting.patch -Patch17: xen-vnc-mouse-buttons.patch Patch18: xen-block-readonly.patch + Patch20: xen-blktap-no-aio-epoll.patch Patch21: xen-blktap-error-returns.patch -Patch22: xen-boot-raw-tap.patch -Patch23: xen-qemu-close-fds.patch Patch24: xen-remove-vnc-monitor.patch # Patches to modify the default config of xend @@ -32,11 +29,12 @@ Patch103: xen-3.0.2-config-disable-reloc.patch # Hack to support guest kernels using old PVFB protocol # from FC5/6 days. Can kill off once FC6 is EOL'd Patch150: xen-pvfb-compat.patch -Patch151: xen-pvfb-compat-nohvm.patch -Patch152: xen-pvfb-terminate.patch Patch251: pygrub-manykernels.patch +# Performance fix for listing domains +Patch280: xen-xs-transactions.patch + # libVNCserver patches Patch300: vnc-thread-fixes.patch @@ -95,22 +93,18 @@ This package contains what's needed to develop applications to manage Xen virtual machines. %prep -%setup -q -n xen-3.0.4_1-src -a 1 +%setup -q -n xen-3.0.5-testing.hg-rc4 -a 1 %patch1 -p1 -b .init +%patch2 -p1 %patch3 -p1 -b .compile %patch6 -p1 +%patch7 -p1 %patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 %patch18 -p1 # blktap patches %patch20 -p1 %patch21 -p1 -%patch22 -p1 -%patch23 -p1 %patch24 -p1 # config patches @@ -120,12 +114,13 @@ virtual machines. # pvfb compat %patch150 -p1 -%patch151 -p0 -%patch152 -p1 # upstream patches %patch251 -p1 +# performance patch +%patch280 -p1 + # libVNCserver patches pushd LibVNCServer-0.8.2 # thread locking fixes @@ -185,6 +180,8 @@ mkdir -p %{buildroot}/var/lib/xen/images # avoid conflicting with qemu (#199759) rm -f %{buildroot}/%{_mandir}/man*/qemu* +#find_lang xen-xm + %post /sbin/chkconfig --add xend /sbin/chkconfig --add xendomains @@ -198,6 +195,7 @@ fi %clean rm -rf $RPM_BUILD_ROOT +#files -f xen-xm.lang %files %defattr(-,root,root) %doc COPYING README @@ -215,7 +213,10 @@ rm -rf $RPM_BUILD_ROOT %dir /usr/lib/xen/boot /usr/lib/xen/boot/hvmloader %endif +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/*.dtd %dir %{_datadir}/%{name}/qemu +%dir %{_datadir}/%{name}/qemu/keymaps %{_datadir}/%{name}/qemu/keymaps/* %dir %{_localstatedir}/lib/%{name} %{_localstatedir}/lib/%{name}/* @@ -226,7 +227,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/sysconfig/xendomains %dir %{_localstatedir}/lib/xenstored %dir %{_localstatedir}/run/xenstored -%dir %{_localstatedir}/run/xend +%dir %attr(0700,root,root) %{_localstatedir}/run/xend %dir %attr(0700,root,root) /var/log/xen %files libs @@ -243,6 +244,28 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.a %changelog +* Mon Apr 30 2007 Daniel P. Berrange - 3.0.5-0.rc4.1.fc7 +- Updated to 3.0.5 rc4, changeset 14993 +- Reduce number of xenstore transactions used for listing domains +- Hack to pre-balloon 2 MB for PV guests as well as HVM + +* Thu Apr 26 2007 Daniel P. Berrange - 3.0.5-0.rc3.14934.2.fc7 +- Fixed display of bootloader menu with xm create -c +- Added modprobe for both xenblktap & blktap to deal with rename issues +- Hack to pre-balloon 10 MB for HVM guests + +* Thu Apr 26 2007 Daniel P. Berrange - 3.0.5-0.rc3.14934.1.fc7 +- Updated to 3.0.5 rc3, changeset 14934 +- Fixed networking for service xend restart & minor IPv6 tweak + +* Tue Apr 24 2007 Daniel P. Berrange - 3.0.5-0.rc2.14889.2.fc7 +- Fixed vfb/vkbd device startup race + +* Tue Apr 24 2007 Daniel P. Berrange - 3.0.5-0.rc2.14889.1.fc7 +- Updated to xen 3.0.5 rc2, changeset 14889 +- Remove use of netloop from network-bridge script +- Add backcompat support to vif-bridge script to translate xenbrN to ethN + * Wed Mar 14 2007 Daniel P. Berrange - 3.0.4-9.fc7 - Disable access to QEMU monitor over VNC (CVE-2007-0998, bz 230295)