rpms/xen/devel xen-console-log.patch, NONE, 1.1 xen-hvm-save-paths.patch, NONE, 1.1 xen-pvfb-no-hvm.patch, NONE, 1.1 xen.logrotate, NONE, 1.1 xen.modules, NONE, 1.1 xen.sysconfig, NONE, 1.1 xen-initscript.patch, 1.7, 1.8 xen.spec, 1.179, 1.180 xen-remove-vnc-monitor.patch, 1.1, NONE

Daniel P. Berrange (berrange) fedora-extras-commits at redhat.com
Tue Jun 12 13:50:18 UTC 2007


Author: berrange

Update of /cvs/pkgs/rpms/xen/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6704

Modified Files:
	xen-initscript.patch xen.spec 
Added Files:
	xen-console-log.patch xen-hvm-save-paths.patch 
	xen-pvfb-no-hvm.patch xen.logrotate xen.modules xen.sysconfig 
Removed Files:
	xen-remove-vnc-monitor.patch 
Log Message:
Add persistent console logging. Re-write init scripts. Fix HVM save/restore paths. Add logrotate config

xen-console-log.patch:

--- NEW FILE xen-console-log.patch ---
diff -rup xen-3.1.0-src/tools/console/daemon/io.c xen-3.1.0-src.new/tools/console/daemon/io.c
--- xen-3.1.0-src/tools/console/daemon/io.c	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/console/daemon/io.c	2007-06-12 09:32:25.000000000 -0400
@@ -44,6 +44,14 @@
 /* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
 #define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
 
+extern int log_reload;
+extern int log_guest;
+extern int log_hv;
+extern char *log_dir;
+
+static int log_hv_fd = -1;
+static int xc_handle = -1;
+
 struct buffer
 {
 	char *data;
@@ -57,6 +65,7 @@ struct domain
 {
 	int domid;
 	int tty_fd;
+	int log_fd;
 	bool is_dead;
 	struct buffer buffer;
 	struct domain *next;
@@ -103,6 +112,19 @@ static void buffer_append(struct domain 
 	intf->out_cons = cons;
 	xc_evtchn_notify(dom->xce_handle, dom->local_port);
 
+	/* Get the data to the logfile as early as possible because if
+	 * no one is listening on the console pty then it will fill up
+	 * and handle_tty_write will stop being called.
+	 */
+	if (dom->log_fd != -1) {
+		int len = write(dom->log_fd,
+				buffer->data + buffer->size - size,
+				size);
+		if (len < 0)
+			dolog(LOG_ERR, "Write to log failed on domain %d: %d (%s)\n",
+			      dom->domid, errno, strerror(errno));
+	}
+
 	if (buffer->max_capacity &&
 	    buffer->size > buffer->max_capacity) {
 		/* Discard the middle of the data. */
@@ -144,6 +166,53 @@ static bool domain_is_valid(int domid)
 	return ret;
 }
 
+static int create_hv_log(void)
+{
+	char logfile[PATH_MAX];
+	int fd;
+	snprintf(logfile, PATH_MAX-1, "%s/hypervisor.log", log_dir);
+	logfile[PATH_MAX-1] = '\0';
+
+	fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644);
+	if (fd == -1)
+		dolog(LOG_ERR, "Failed to open log %s: %d (%s)",
+		      logfile, errno, strerror(errno));
+	return fd;
+}
+
+static int create_domain_log(struct domain *dom)
+{
+	char logfile[PATH_MAX];
+	char *namepath, *data, *s;
+	int fd, len;
+
+	namepath = xs_get_domain_path(xs, dom->domid);
+	s = realloc(namepath, strlen(namepath) + 6);
+	if (s == NULL) {
+		free(namepath);
+		return -1;
+	}
+	strcat(namepath, "/name");
+	data = xs_read(xs, XBT_NULL, namepath, &len);
+	if (!data)
+		return -1;
+	if (!len) {
+		free(data);
+		return -1;
+	}
+
+	snprintf(logfile, PATH_MAX-1, "%s/guest-%s.log", log_dir, data);
+	free(data);
+	logfile[PATH_MAX-1] = '\0';
+
+	fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0644);
+	if (fd == -1)
+		dolog(LOG_ERR, "Failed to open log %s: %d (%s)",
+		      logfile, errno, strerror(errno));
+	return fd;
+}
+
+
 static int domain_create_tty(struct domain *dom)
 {
 	char *path;
@@ -325,6 +394,9 @@ static int domain_create_ring(struct dom
 		}
 	}
 
+	if (log_guest)
+		dom->log_fd = create_domain_log(dom);
+
  out:
 	return err;
 }
@@ -352,6 +424,7 @@ static bool watch_domain(struct domain *
 	return success;
 }
 
+
 static struct domain *create_domain(int domid)
 {
 	struct domain *dom;
@@ -383,6 +456,8 @@ static struct domain *create_domain(int 
 	strcat(dom->conspath, "/console");
 
 	dom->tty_fd = -1;
+	dom->log_fd = -1;
+
 	dom->is_dead = false;
 	dom->buffer.data = 0;
 	dom->buffer.consumed = 0;
@@ -444,6 +519,10 @@ static void cleanup_domain(struct domain
 		close(d->tty_fd);
 		d->tty_fd = -1;
 	}
+	if (d->log_fd != -1) {
+		close(d->log_fd);
+		d->log_fd = -1;
+	}
 
 	free(d->buffer.data);
 	d->buffer.data = NULL;
@@ -605,13 +684,54 @@ static void handle_xs(void)
 	free(vec);
 }
 
+static void handle_hv_logs(void)
+{
+	char buffer[1024*16];
+	char *bufptr = buffer;
+	unsigned int size = sizeof(buffer);
+	if (xc_readconsolering(xc_handle, &bufptr, &size, 1) == 0) {
+		int len = write(log_hv_fd, buffer, size);
+		if (len < 0)
+			dolog(LOG_ERR, "Failed to write hypervisor log: %d (%s)",
+			      errno, strerror(errno));
+	}
+}
+
+static void handle_log_reload(void)
+{
+	if (log_guest) {
+		struct domain *d;
+		for (d = dom_head; d; d = d->next) {
+			if (d->log_fd != -1)
+				close(d->log_fd);
+			d->log_fd = create_domain_log(d);
+		}
+	}
+
+	if (log_hv) {
+		if (log_hv_fd != -1)
+			close(log_hv_fd);
+		log_hv_fd = create_hv_log();
+	}
+}
+
 void handle_io(void)
 {
 	fd_set readfds, writefds;
 	int ret;
 
-	do {
+	if (log_hv) {
+		xc_handle = xc_interface_open();
+		if (xc_handle == -1)
+			dolog(LOG_ERR, "Failed to open xc handle: %d (%s)",
+			      errno, strerror(errno));
+		else
+			log_hv_fd = create_hv_log();
+	}
+
+	for (;;) {
 		struct domain *d, *n;
+		struct timeval timeout = { 1, 0 }; /* Read HV logs every 1 second */
 		int max_fd = -1;
 
 		FD_ZERO(&readfds);
@@ -637,7 +757,34 @@ void handle_io(void)
 			}
 		}
 
-		ret = select(max_fd + 1, &readfds, &writefds, 0, NULL);
+		/* XXX I wish we didn't have to busy wait for hypervisor logs
+		 * but there's no obvious way to get event channel notifications
+		 * for new HV log data as we can with guest */
+		ret = select(max_fd + 1, &readfds, &writefds, 0, log_hv_fd != -1 ? &timeout : NULL);
+
+		if (log_reload) {
+			handle_log_reload();
+			log_reload = 0;
+		}
+
+		/* Abort if select failed, except for EINTR cases
+		   which indicate a possible log reload */
+		if (ret == -1) {
+			if (errno == EINTR)
+				continue;
+			dolog(LOG_ERR, "Failure in select: %d (%s)",
+			      errno, strerror(errno));
+			break;
+		}
+
+		/* Always process HV logs even if not a timeout */
+		if (log_hv_fd != -1)
+			handle_hv_logs();
+
+		/* Must not check return FDSET if it was a timeout */
+		if (ret == 0) {
+			continue;
+		}
 
 		if (FD_ISSET(xs_fileno(xs), &readfds))
 			handle_xs();
@@ -657,7 +804,16 @@ void handle_io(void)
 			if (d->is_dead)
 				cleanup_domain(d);
 		}
-	} while (ret > -1);
+	}
+
+	if (log_hv_fd != -1) {
+		close(log_hv_fd);
+		log_hv_fd = -1;
+	}
+	if (xc_handle != -1) {
+		xc_interface_close(xc_handle);
+		xc_handle = -1;
+	}
 }
 
 /*
Only in xen-3.1.0-src.new/tools/console/daemon: io.c~
diff -rup xen-3.1.0-src/tools/console/daemon/main.c xen-3.1.0-src.new/tools/console/daemon/main.c
--- xen-3.1.0-src/tools/console/daemon/main.c	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/console/daemon/main.c	2007-06-12 09:32:51.000000000 -0400
@@ -23,6 +23,8 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
+#include <string.h>
+#include <signal.h>
 #include <sys/types.h>
 
 #include "xenctrl.h"
@@ -30,9 +32,19 @@
 #include "utils.h"
 #include "io.h"
 
+int log_reload = 0;
+int log_guest = 0;
+int log_hv = 0;
+char *log_dir = NULL;
+
+static void handle_hup(int sig)
+{
+        log_reload = 1;
+}
+
 static void usage(char *name)
 {
-	printf("Usage: %s [-h] [-V] [-v] [-i]\n", name);
+	printf("Usage: %s [-h] [-V] [-v] [-i] [--log=none|guest|hv|all] [--log-dir=DIR] [--pid-file=PATH]\n", name);
 }
 
 static void version(char *name)
@@ -48,6 +60,9 @@ int main(int argc, char **argv)
 		{ "version", 0, 0, 'V' },
 		{ "verbose", 0, 0, 'v' },
 		{ "interactive", 0, 0, 'i' },
+		{ "log", 1, 0, 'l' },
+		{ "log-dir", 1, 0, 'r' },
+		{ "pid-file", 1, 0, 'p' },
 		{ 0 },
 	};
 	bool is_interactive = false;
@@ -55,6 +70,7 @@ int main(int argc, char **argv)
 	int syslog_option = LOG_CONS;
 	int syslog_mask = LOG_WARNING;
 	int opt_ind = 0;
+	char *pidfile = NULL;
 
 	while ((ch = getopt_long(argc, argv, sopts, lopts, &opt_ind)) != -1) {
 		switch (ch) {
@@ -71,6 +87,22 @@ int main(int argc, char **argv)
 		case 'i':
 			is_interactive = true;
 			break;
+		case 'l':
+		        if (!strcmp(optarg, "all")) {
+			      log_hv = 1;
+			      log_guest = 1;
+			} else if (!strcmp(optarg, "hv")) {
+			      log_hv = 1;
+			} else if (!strcmp(optarg, "guest")) {
+			      log_guest = 1;
+			}
+			break;
+		case 'r':
+		        log_dir = strdup(optarg);
+			break;
+		case 'p':
+		        pidfile = strdup(optarg);
+			break;
 		case '?':
 			fprintf(stderr,
 				"Try `%s --help' for more information\n",
@@ -79,16 +111,22 @@ int main(int argc, char **argv)
 		}
 	}
 
+	if (!log_dir) {
+		log_dir = strdup("/var/log/xen/console");
+	}
+
 	if (geteuid() != 0) {
 		fprintf(stderr, "%s requires root to run.\n", argv[0]);
 		exit(EPERM);
 	}
 
+	signal(SIGHUP, handle_hup);
+
 	openlog("xenconsoled", syslog_option, LOG_DAEMON);
 	setlogmask(syslog_mask);
 
 	if (!is_interactive) {
-		daemonize("/var/run/xenconsoled.pid");
+		daemonize(pidfile ? pidfile : "/var/run/xenconsoled.pid");
 	}
 
 	if (!xen_setup())
@@ -99,6 +137,18 @@ int main(int argc, char **argv)
 	handle_io();
 
 	closelog();
+	free(log_dir);
+	free(pidfile);
 
 	return 0;
 }
+
+/*
+ * Local variables:
+ *  c-file-style: "linux"
+ *  indent-tabs-mode: t
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
Only in xen-3.1.0-src.new/tools/console/daemon: main.c~
diff -rup xen-3.1.0-src/tools/console/daemon/utils.c xen-3.1.0-src.new/tools/console/daemon/utils.c
--- xen-3.1.0-src/tools/console/daemon/utils.c	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/console/daemon/utils.c	2007-06-12 09:28:21.000000000 -0400
@@ -86,7 +86,7 @@ void daemonize(const char *pidfile)
 	if (chdir("/") < 0)
 		exit (1);
 
-	fd = open(pidfile, O_RDWR | O_CREAT);
+	fd = open(pidfile, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR);
 	if (fd == -1) {
 		exit(1);
 	}

xen-hvm-save-paths.patch:

--- NEW FILE xen-hvm-save-paths.patch ---
diff -rup xen-3.1.0-src/tools/ioemu/target-i386-dm/helper2.c xen-3.1.0-src.new/tools/ioemu/target-i386-dm/helper2.c
--- xen-3.1.0-src/tools/ioemu/target-i386-dm/helper2.c	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/ioemu/target-i386-dm/helper2.c	2007-06-11 08:25:16.000000000 -0400
@@ -615,7 +615,7 @@ int main_loop(void)
     extern int suspend_requested;
     CPUState *env = cpu_single_env;
     int evtchn_fd = xc_evtchn_fd(xce_handle);
-    char qemu_file[20];
+    char qemu_file[PATH_MAX];
 
     buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
 				       cpu_single_env);
@@ -637,7 +637,9 @@ int main_loop(void)
     ide_stop_dma_thread();
 
     /* Save the device state */
-    sprintf(qemu_file, "/tmp/xen.qemu-dm.%d", domid);
+    snprintf(qemu_file, PATH_MAX-1, "/var/lib/xen/qemu-save.%d", domid);
+    qemu_file[PATH_MAX-1] = '\0';
+
     if (qemu_savevm(qemu_file) < 0)
         fprintf(stderr, "qemu save fail.\n");
 
diff -rup xen-3.1.0-src/tools/python/xen/xend/image.py xen-3.1.0-src.new/tools/python/xen/xend/image.py
--- xen-3.1.0-src/tools/python/xen/xend/image.py	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/python/xen/xend/image.py	2007-06-11 08:24:07.000000000 -0400
@@ -433,7 +433,7 @@ class HVMImageHandler(ImageHandler):
                              (self.getRequiredInitialReservation() / 1024) ])
         args = args + self.dmargs
         if restore:
-            args = args + ([ "-loadvm", "/tmp/xen.qemu-dm.%d" %
+            args = args + ([ "-loadvm", "/var/lib/xen/qemu-save.%d" %
                              self.vm.getDomid() ])
         env = dict(os.environ)
         if self.display:
diff -rup xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py xen-3.1.0-src.new/tools/python/xen/xend/XendCheckpoint.py
--- xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py	2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src.new/tools/python/xen/xend/XendCheckpoint.py	2007-06-11 08:24:07.000000000 -0400
@@ -111,7 +111,8 @@ def save(fd, dominfo, network, live, dst
         # put qemu device model state
         if hvm:
             write_exact(fd, QEMU_SIGNATURE, "could not write qemu signature")
-            qemu_fd = os.open("/tmp/xen.qemu-dm.%d" % dominfo.getDomid(), os.O_RDONLY)
+            qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(),
+                              os.O_RDONLY)
             while True:
                 buf = os.read(qemu_fd, dm_batch)
                 if len(buf):
@@ -119,7 +120,7 @@ def save(fd, dominfo, network, live, dst
                 else:
                     break
             os.close(qemu_fd)
-            os.remove("/tmp/xen.qemu-dm.%d" % dominfo.getDomid())
+            os.remove("/var/lib/xen/qemu-save.%d" % dominfo.getDomid())
 
         if checkpoint:
             dominfo.resumeDomain()
@@ -238,7 +239,7 @@ def restore(xd, fd, dominfo = None, paus
             if qemu_signature != QEMU_SIGNATURE:
                 raise XendError("not a valid device model state: found '%s'" %
                                 qemu_signature)
-            qemu_fd = os.open("/tmp/xen.qemu-dm.%d" % dominfo.getDomid(),
+            qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(),
                               os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
             while True:
                 buf = os.read(fd, dm_batch)

xen-pvfb-no-hvm.patch:

--- NEW FILE xen-pvfb-no-hvm.patch ---
diff -ruNp xen-3.0.3_0-src.orig/tools/python/xen/xm/create.py xen-3.0.3_0-src.new/tools/python/xen/xm/create.py
--- xen-3.0.3_0-src.orig/tools/python/xen/xm/create.py	2007-02-15 08:38:23.000000000 -0500
+++ xen-3.0.3_0-src.new/tools/python/xen/xm/create.py	2007-02-15 09:36:51.000000000 -0500
@@ -558,7 +558,7 @@ def configure_usb(config_devs, vals):
 
 def configure_vfbs(config_devs, vals):
     # old config compatibility
-    if vals.vfb == [] and (vals.sdl or vals.vnc):
+    if vals.vfb == [] and (vals.sdl or vals.vnc) and vals.builder != 'hvm':
         if vals.vnc:
             cfg = 'type=vnc'
             if vals.vncdisplay:


--- NEW FILE xen.logrotate ---
/var/log/xen/xend-debug.log /var/log/xen/xen-hotplug.log
/var/log/xen/domain-builder-ng.log {
    notifempty
    missingok
    copytruncate
}



--- NEW FILE xen.modules ---
#!/bin/sh

test -f /proc/xen/capabilities || exit 0
grep -q "control_d" /proc/xen/capabilities || exit 0

for m in blkbk netbk blktap xenblktap
do
  modprobe $m >/dev/null 2>&1
done


--- NEW FILE xen.sysconfig ---

#XENSTORED_PID="/var/run/xenstore.pid"
#XENSTORED_ARGS=

# Log all hypervisor messages (cf xm dmesg)
#XENCONSOLED_LOG_HYPERVISOR=no

# Log all guest console output (cf xm console)
#XENCONSOLED_LOG_GUESTS=no

# Location to store guest & hypervisor logs
#XENCONSOLED_LOG_DIR=/var/log/xen/console

#XENCONSOLED_ARGS=

#BLKTAPCTRL_ARGS=

xen-initscript.patch:

Index: xen-initscript.patch
===================================================================
RCS file: /cvs/pkgs/rpms/xen/devel/xen-initscript.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- xen-initscript.patch	1 May 2007 02:27:22 -0000	1.7
+++ xen-initscript.patch	12 Jun 2007 13:50:13 -0000	1.8
@@ -1,91 +1,347 @@
-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.
+diff -rup xen-3.1.0-src/tools/examples/init.d/xend xen-3.1.0-src.new/tools/examples/init.d/xend
+--- xen-3.1.0-src/tools/examples/init.d/xend	2007-05-31 12:14:19.000000000 -0400
++++ xen-3.1.0-src.new/tools/examples/init.d/xend	2007-05-31 17:53:29.000000000 -0400
+@@ -19,48 +19,161 @@
+ # Description:       Starts and stops the Xen control daemon.
+ ### END INIT INFO
  
 +# Source function library.
 +. /etc/rc.d/init.d/functions
 +
-+RETVAL=0
 +if [ ! -d /proc/xen ]; then
 +	exit 0
 +fi
  if ! grep -q "control_d" /proc/xen/capabilities ; then
  	exit 0
  fi
-+prog=xend
  
- # Wait for Xend to be up
- function await_daemons_up
- {
- 	i=1
- 	rets=10
+-# Wait for Xend to be up
+-function await_daemons_up
+-{
+-	i=1
+-	rets=10
 -	xend status
-+	/usr/sbin/xend status
- 	while [ $? -ne 0 -a $i -lt $rets ]; do
- 	    sleep 1
- 	    echo -n .
- 	    i=$(($i + 1))
+-	while [ $? -ne 0 -a $i -lt $rets ]; do
+-	    sleep 1
+-	    echo -n .
+-	    i=$(($i + 1))
 -	    xend status
-+	    /usr/sbin/xend status
- 	done
-+	if [ $i -ge $rets ]; then
-+	    RETVAL=-1
-+	    return 1
-+	fi
-+	return 0
+-	done
++# Default config params
++XENSTORED_PID="/var/run/xenstore.pid"
++XENSTORED_ARGS=
++
++XENCONSOLED_LOG_HYPERVISOR=no
++XENCONSOLED_LOG_GUESTS=no
++XENCONSOLED_LOG_DIR=/var/log/xen/console
++XENCONSOLED_ARGS=
++
++BLKTAPCTRL_ARGS=
++
++# User customized params
++test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
++
++XENCONSOLED_LOG=none
++if [ "$XENCONSOLED_LOG_HYPERVISOR" = "yes" ]
++then
++        if [ "$XENCONSOLED_LOG_GUESTS" = "yes" ]
++        then
++                XENCONSOLED_LOG=all
++        else
++                XENCONSOLED_LOG=hv
++        fi
++else
++        if [ "$XENCONSOLED_LOG_GUESTS" = "yes" ]
++        then
++                XENCONSOLED_LOG=guest
++        fi
++fi
++
++start() {
++	echo -n $"Starting xen daemons: "
++
++	echo -n "xenstored "
++        /usr/sbin/xenstored --pid-file $XENSTORED_PID $XENSTORED_ARGS
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	echo -n "blktapctrl "
++        /usr/sbin/blktapctrl $BLKTAPCTRL_ARGS
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	echo -n "xenconsoled "
++        /usr/sbin/xenconsoled --log=$XENCONSOLED_LOG --log-dir=$XENCONSOLED_LOG_DIR $XENCONSOLED_ARGS
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++        echo -n "xend"
++	/usr/sbin/xend
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	test $RETVAL = 0 && echo_success || echo_failure
++        echo
++        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
  }
  
++stop() {
++	echo -n $"Stopping xen daemons: "
++
++	# NB not safe to stop xenstored, or blktapctrl if guests are active
++	# or backend driver modules are loaded, so we skip them
++
++	echo -n "xenconsoled "
++	killproc xenconsoled > /dev/null
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	echo -n "xend "
++	killproc xend > /dev/null
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	test $RETVAL = 0 && echo_success || echo_failure
++        echo
++        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xend
++}
++
++rcstatus() {
++        status xenstored
++        rc=$?
++        test $rc != 0 && RETVAL=$rc
++
++        status blktapctrl
++        rc=$?
++        test $rc != 0 && RETVAL=$rc
++
++        status xenconsoled
++        rc=$?
++        test $rc != 0 && RETVAL=$rc
++
++        status xend
++        rc=$?
++        test $rc != 0 && RETVAL=$rc
++	test $RETVAL = 0 && echo_success || echo_failure
++	echo
++}
++
++reload() {
++	echo -n $"Reloading xen daemons: "
++
++	echo -n "xenconsoled "
++	killproc xenconsoled -HUP > /dev/null
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	echo -n "xend "
++	killproc xend -HUP > /dev/null
++	rc=$?
++	test $rc = 0 || RETVAL=$rc
++
++	test $RETVAL = 0 && echo_success || echo_failure
++        echo
++}
++
++RETVAL=0
  case "$1" in
    start)
 -	xend start
-+	echo -n $"Starting $prog: "
-+	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
+-	await_daemons_up
++        start
  	;;
    stop)
 -	xend stop
-+	echo -n $"Stopping $prog: "
-+	/usr/sbin/xend stop
-+	RETVAL=$?
++        stop
  	;;
    status)
 -	xend status
-+	/usr/sbin/xend status
-+	if [ $? = 0 ] ; then
-+	    echo -n $"$prog is running"
-+	else
-+	    echo -n $"$prog is stopped"
-+	    RETVAL=3
-+	fi
++        rcstatus
  	;;
    reload)
 -        xend reload
-+        /usr/sbin/xend reload
++	reload
          ;;
    restart|force-reload)
 -	xend restart
-+	/usr/sbin/xend restart
- 	await_daemons_up
+-	await_daemons_up
++	stop
++        start
  	;;
++  condrestart)
++        if [ -f /var/lock/subsys/xend ]
++        then
++                stop
++                start
++        fi
++        ;;
    *)
-@@ -50,5 +76,12 @@ case "$1" in
+-	# do not advertise unreasonable commands that there is no reason
+-	# to use with this device
+-	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
++	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
  	exit 1
  esac
  
 -exit $?
-+if [ $RETVAL = 0 ] ; then
-+    echo_success
-+    echo
-+else
-+    echo_failure
-+    echo
-+fi
 +exit $RETVAL
  
+diff -rup xen-3.1.0-src/tools/misc/xend xen-3.1.0-src.new/tools/misc/xend
+--- xen-3.1.0-src/tools/misc/xend	2007-05-31 13:10:49.000000000 -0400
++++ xen-3.1.0-src.new/tools/misc/xend	2007-05-31 13:44:14.000000000 -0400
+@@ -8,123 +8,16 @@
+ """Xen management daemon.
+    Provides console server and HTTP management api.
+ 
+-   Run:
+-   xend start
+-
+-   Restart:
+-   xend restart
+-
+-   The daemon is stopped with:
+-   xend stop
+-
+    The daemon should reconnect to device control interfaces
+    and recover its state when restarted.
+-
+-   On Solaris, the daemons are SMF managed, and you should not attempt
+-   to start xend by hand.
+ """
+-import os
+-import os.path
+ import sys
+-import socket
+-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):
+-    pass
+-
+-def hline():
+-    print >>sys.stderr, "*" * 70
+-
+-def msg(message):
+-    print >>sys.stderr, "*" * 3, message
+-
+-def check_logging():
+-    """Check python logging is installed and raise an error if not.
+-    Logging is standard from Python 2.3 on.
+-    """
+-    try:
+-        import logging
+-    except ImportError:
+-        hline()
+-        msg("Python logging is not installed.")
+-        msg("Use 'make install-logging' at the xen root to install.")
+-        msg("")
+-        msg("Alternatively download and install from")
+-        msg("http://www.red-dove.com/python_logging.html")
+-        hline()
+-        raise CheckError("logging is not installed")
+-
+-def check_user():
+-    """Check that the effective user id is 0 (root).
+-    """
+-    if os.geteuid() != 0:
+-        hline()
+-        msg("Xend must be run as root.")
+-        hline()
+-        raise CheckError("invalid user")
+-
+-def start_xenstored():
+-    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
+-    cmd = "xenstored --pid-file /var/run/xenstore.pid"
+-    if XENSTORED_TRACE:
+-        cmd += " -T /var/log/xen/xenstored-trace.log"
+-    s,o = commands.getstatusoutput(cmd)
+-
+-def start_consoled():
+-    if os.fork() == 0:
+-        os.execvp('xenconsoled', ['xenconsoled'])
+-
+-def start_blktapctrl():
+-    if os.fork() == 0:
+-        os.execvp('blktapctrl', ['blktapctrl'])
+-            
+ def main():
+-    try:
+-        check_logging()
+-        check_user()
+-    except CheckError:
+-        sys.exit(1)
+-    
+     daemon = SrvDaemon.instance()
+-    if not sys.argv[1:]:
+-        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
+-    elif sys.argv[1] == 'start':
+-        if os.uname()[0] != "SunOS":
+-            start_xenstored()
+-            start_consoled()
+-            start_blktapctrl()
+-        return daemon.start()
+-    elif sys.argv[1] == 'trace_start':
+-        start_xenstored()
+-        start_consoled()
+-        start_blktapctrl()
+-        return daemon.start(trace=1)
+-    elif sys.argv[1] == 'stop':
+-        return daemon.stop()
+-    elif sys.argv[1] == 'reload':
+-        return daemon.reloadConfig()
+-    elif sys.argv[1] == 'restart':
+-        start_xenstored()
+-        start_consoled()
+-        start_blktapctrl()
+-        return daemon.stop() or daemon.start()
+-    elif sys.argv[1] == 'status':
+-        return daemon.status()
+-    else:
+-        print 'not an option:', sys.argv[1]
+-    return 1
++    return daemon.start()
+ 
+ if __name__ == '__main__':
+     sys.exit(main())
+diff -rup xen-3.1.0-src/tools/python/xen/xend/osdep.py xen-3.1.0-src.new/tools/python/xen/xend/osdep.py
+--- xen-3.1.0-src/tools/python/xen/xend/osdep.py	2007-05-18 10:45:21.000000000 -0400
++++ xen-3.1.0-src.new/tools/python/xen/xend/osdep.py	2007-05-31 13:13:07.000000000 -0400
+@@ -25,7 +25,7 @@ _scripts_dir = {
+ }
+ 
+ _xend_autorestart = {
+-    "Linux": True,
++    "Linux": False,
+     "SunOS": False,
+ }
+ 
+diff -rup xen-3.1.0-src/tools/python/xen/xend/server/SrvDaemon.py xen-3.1.0-src.new/tools/python/xen/xend/server/SrvDaemon.py
+--- xen-3.1.0-src/tools/python/xen/xend/server/SrvDaemon.py	2007-05-18 10:45:21.000000000 -0400
++++ xen-3.1.0-src.new/tools/python/xen/xend/server/SrvDaemon.py	2007-05-31 14:36:23.000000000 -0400
+@@ -109,7 +109,14 @@ class Daemon:
+         # Fork, this allows the group leader to exit,
+         # which means the child can never again regain control of the
+         # terminal
+-        if os.fork():
++        child = os.fork()
++        if child:
++            if not osdep.xend_autorestart:
++                pidfile = open(XEND_PID_FILE, 'w')
++                try:
++                    pidfile.write(str(child))
++                finally:
++                    pidfile.close()
+             os._exit(0)
+ 
+         # Detach from standard file descriptors, and redirect them to


Index: xen.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xen/devel/xen.spec,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- xen.spec	25 May 2007 14:55:45 -0000	1.179
+++ xen.spec	12 Jun 2007 13:50:13 -0000	1.180
@@ -3,14 +3,16 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 3.1.0
-Release: 1%{dist}
+Release: 2%{?dist}
 Group:   Development/Libraries
 License: GPL
 URL:     http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html
 Source0: %{name}-%{version}-src.tgz
 Source1: http://download.sf.net/libvncserver/LibVNCServer-0.8.2.tar.gz
+Source2: %{name}.modules
+Source3: %{name}.sysconfig
+Source4: %{name}.logrotate
 Patch1: xen-initscript.patch
-Patch2: xen-remove-python-path-check.patch
 Patch3: xen-compile-fixes.patch
 Patch6: xen-net-bridge.patch
 Patch13: xen-dumpdir.patch
@@ -19,8 +21,9 @@
 
 Patch20: xen-blktap-no-aio-epoll.patch
 Patch21: xen-blktap-error-returns.patch
-Patch24: xen-remove-vnc-monitor.patch
 Patch25: xen-qemu-vnc-delete.patch
+Patch26: xen-hvm-save-paths.patch
+Patch27: xen-console-log.patch
 
 # Patches to modify the default config of xend
 Patch100: xen-config-dom0-minmem.patch
@@ -31,6 +34,7 @@
 # from FC5/6 days. Can kill off once FC6 is EOL'd
 Patch150: xen-pvfb-compat.patch
 Patch151: xen-pvfb-terminate.patch
+Patch152: xen-pvfb-no-hvm.patch
 
 Patch251: pygrub-manykernels.patch
 
@@ -64,7 +68,7 @@
 # installs xen.
 Requires: kpartx
 Prereq: chkconfig
-ExclusiveArch: i386 x86_64 ia64
+ExclusiveArch: i386 i686 x86_64 ia64
 
 %description
 This package contains the Xen hypervisor and Xen tools, needed to
@@ -98,7 +102,6 @@
 %prep
 %setup -q -n %{name}-%{version}-src -a 1
 %patch1 -p1 -b .init
-%patch2 -p1
 %patch3 -p1 -b .compile
 %patch6 -p1
 %patch13 -p1
@@ -107,8 +110,9 @@
 
 %patch20 -p1
 %patch21 -p1
-%patch24 -p1
 %patch25 -p1
+%patch26 -p1
+%patch27 -p1
 
 # config patches
 %patch100 -p1
@@ -118,6 +122,7 @@
 # pvfb compat
 %patch150 -p1
 %patch151 -p1
+%patch152 -p1
 
 # upstream patches
 %patch251 -p1
@@ -155,7 +160,6 @@
 mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/xend-db/migrate
 mkdir -p %{buildroot}%{_localstatedir}/lib/xenstored
 mkdir -p %{buildroot}%{_localstatedir}/run/xenstored
-rm -rf %{buildroot}%{_datadir}/doc/qemu
 
 rm -rf %{buildroot}%{_sysconfdir}/hotplug
 
@@ -166,20 +170,29 @@
 install -m 644 xen/include/public/hvm/*.h %{buildroot}%{_includedir}/xen/hvm
 install -m 644 xen/include/public/arch-x86/*.h %{buildroot}%{_includedir}/xen/arch-x86
 install -m 644 xen/include/public/*.h %{buildroot}%{_includedir}/xen/
-install -m 644 xen/include/public/COPYING %{buildroot}%{_includedir}/xen/
 
 ### fixing start-script dir
-mkdir -p %{buildroot}/etc/rc.d
-mv -f %{buildroot}/etc/init.d %{buildroot}/etc/rc.d/
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d
+mv -f %{buildroot}%{_sysconfdir}/init.d %{buildroot}%{_sysconfdir}/rc.d/
+
+mv -f %{buildroot}%{_sysconfdir}/udev/xen-backend.rules %{buildroot}%{_sysconfdir}/udev/rules.d/
 
-mv -f %{buildroot}/etc/udev/xen-backend.rules %{buildroot}/etc/udev/rules.d/
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig/modules
+install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/modules/%{name}.modules
+install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/xend
+
+mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/
+install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
 
 # silly doc dir fun
-rm -fr %{buildroot}/%{_datadir}/doc/xen/
+rm -fr %{buildroot}%{_datadir}/doc/xen
+rm -rf %{buildroot}%{_datadir}/doc/qemu
 
 # create dirs in /var/run so that selinux contexts are right (#195952)
-mkdir -p %{buildroot}/var/run/xend %{buildroot}/var/log/xen
-mkdir -p %{buildroot}/var/lib/xen/images
+mkdir -p %{buildroot}%{_localstatedir}/run/xend
+mkdir -p %{buildroot}%{_localstatedir}/log/xen
+mkdir -p %{buildroot}%{_localstatedir}/log/xen/console
+mkdir -p %{buildroot}%{_localstatedir}/lib/xen/images
 
 # avoid conflicting with qemu (#199759)
 rm -f %{buildroot}/%{_mandir}/man*/qemu*
@@ -190,6 +203,10 @@
 /sbin/chkconfig --add xend
 /sbin/chkconfig --add xendomains
 
+if [ $1 != 0 ]; then
+  service xend condrestart
+fi
+
 %preun
 if [ $1 = 0 ]; then
   /sbin/chkconfig --del xend
@@ -228,11 +245,15 @@
 %{_sysconfdir}/udev/rules.d/*
 %dir %attr(0700,root,root) %{_sysconfdir}/%{name}
 %config(noreplace) %{_sysconfdir}/%{name}/*
+%config(noreplace) %{_sysconfdir}/sysconfig/xend
 %config(noreplace) %{_sysconfdir}/sysconfig/xendomains
+%config(noreplace) %{_sysconfdir}/logrotate.d/xen
+%attr(0755,root,root) %{_sysconfdir}/sysconfig/modules/%{name}.modules
 %dir %{_localstatedir}/lib/xenstored
 %dir %{_localstatedir}/run/xenstored
 %dir %attr(0700,root,root) %{_localstatedir}/run/xend
-%dir %attr(0700,root,root) /var/log/xen
+%dir %attr(0700,root,root) %{_localstatedir}/log/xen
+%dir %attr(0700,root,root) %{_localstatedir}/log/xen/console
 
 %files libs
 %defattr(-,root,root)
@@ -248,6 +269,15 @@
 %{_libdir}/*.a
 
 %changelog
+* Tue Jun 12 2007 Daniel P. Berrange <berrange at redhat.com> - 3.1.0-2.fc8
+- Remove patch which kills VNC monitor
+- Fix HVM save/restore file path to be /var/lib/xen instead of /tmp
+- Don't spawn a bogus xen-vncfb daemon for HVM guests
+- Add persistent logging of hypervisor & guest consoles
+- Add /etc/sysconfig/xen to allow admin choice of logging options
+- Re-write Xen startup to use standard init script functions
+- Add logrotate configuration for all xen related logs
+
 * Fri May 25 2007 Daniel P. Berrange <berrange at redhat.com> - 3.1.0-1.fc8
 - Updated to official 3.1.0 tar.gz
 - Fixed data corruption from VNC client disconnect (bz 241303)


--- xen-remove-vnc-monitor.patch DELETED ---




More information about the fedora-extras-commits mailing list