rpms/xen/FC-5 xen-blchanges.patch, NONE, 1.1 xen-check-returns.patch, NONE, 1.1 xen-config-allow-http.patch, NONE, 1.1 .cvsignore, 1.15, 1.16 sources, 1.30, 1.31 xen.spec, 1.107, 1.108 xenguest-install.py, 1.13, 1.14
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Apr 28 17:40:45 UTC 2006
Author: katzj
Update of /cvs/dist/rpms/xen/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv29683
Modified Files:
.cvsignore sources xen.spec xenguest-install.py
Added Files:
xen-blchanges.patch xen-check-returns.patch
xen-config-allow-http.patch
Log Message:
* Fri Apr 28 2006 Jeremy Katz <katzj at redhat.com> - 3.0.2-0.FC5
- update to 3.0.2-2
- add patches for bootloader to run on all domain creations
- make xenguest-install create a persistent uuid
- use libvirt for paravirt domain creation in xenguest-install
xen-blchanges.patch:
xend/XendBootloader.py | 10 ++--------
xend/XendDomainInfo.py | 23 ++++++++++++++---------
xend/image.py | 6 ++----
xm/create.py | 4 +---
4 files changed, 19 insertions(+), 24 deletions(-)
--- NEW FILE xen-blchanges.patch ---
--- xen-3.0.2-2/tools/python/xen/xend/XendDomainInfo.py.blchanges 2006-04-28 13:23:09.000000000 -0400
+++ xen-3.0.2-2/tools/python/xen/xend/XendDomainInfo.py 2006-04-28 13:24:45.000000000 -0400
@@ -1195,6 +1195,11 @@
self.domid,
self.info['cpu_weight'])
+ # if we have a boot loader but no image, then we need to set things
+ # up by running the boot loader non-interactively
+ if self.infoIsSet('bootloader') and not self.infoIsSet('image'):
+ self.configure_bootloader()
+
if not self.infoIsSet('image'):
raise VmError('Missing image in configuration')
@@ -1548,24 +1553,24 @@
def configure_bootloader(self):
+ """Run the bootloader if we're configured to do so."""
if not self.info['bootloader']:
return
- # if we're restarting with a bootloader, we need to run it
blcfg = None
- config = self.sxpr()
- # FIXME: this assumes that we want to use the first disk
- for dev in sxp.children(config, "device"):
- disk = sxp.child(dev, "vbd")
+ # FIXME: this assumes that we want to use the first disk device
+ for (n,c) in self.info['device']:
+ if not n or not c or n != "vbd":
+ continue
+ disk = sxp.child_value(c, "uname")
if disk is None:
continue
- fn = blkdev_uname_to_file(sxp.child_value(disk, "uname"))
- blcfg = bootloader(self.info['bootloader'], fn, 1,
- self.info['vcpus'])
+ fn = blkdev_uname_to_file(disk)
+ blcfg = bootloader(self.info['bootloader'], fn, 1)
if blcfg is None:
msg = "Had a bootloader specified, but can't find disk"
log.error(msg)
raise VmError(msg)
- self.info['image'] = sxp.to_string(blcfg)
+ self.info['image'] = blcfg
def send_sysrq(self, key):
--- xen-3.0.2-2/tools/python/xen/xend/XendBootloader.py.blchanges 2006-04-13 13:48:39.000000000 -0400
+++ xen-3.0.2-2/tools/python/xen/xend/XendBootloader.py 2006-04-28 13:23:09.000000000 -0400
@@ -19,13 +19,12 @@
from XendLogging import log
from XendError import VmError
-def bootloader(blexec, disk, quiet = 0, vcpus = None, entry = None):
+def bootloader(blexec, disk, quiet = 0, entry = None):
"""Run the boot loader executable on the given disk and return a
config image.
@param blexec Binary to use as the boot loader
@param disk Disk to run the boot loader on.
@param quiet Run in non-interactive mode, just booting the default.
- @param vcpus Number of vcpus for the domain.
@param entry Default entry to boot."""
if not os.access(blexec, os.X_OK):
@@ -87,9 +86,4 @@
pin = sxp.Parser()
pin.input(ret)
pin.input_eof()
-
- config_image = pin.val
- if vcpus and sxp.child_value(config_image, "vcpus") is None:
- config_image.append(['vcpus', vcpus])
-
- return config_image
+ return pin.val
--- xen-3.0.2-2/tools/python/xen/xend/image.py.blchanges 2006-04-13 13:48:39.000000000 -0400
+++ xen-3.0.2-2/tools/python/xen/xend/image.py 2006-04-28 13:23:09.000000000 -0400
@@ -68,7 +68,6 @@
self.kernel = None
self.ramdisk = None
self.cmdline = None
- self.features = None
self.configure(imageConfig, deviceConfig)
@@ -90,7 +89,6 @@
if args:
self.cmdline += " " + args
self.ramdisk = get_cfg("ramdisk", '')
- self.features = get_cfg("features", '')
self.vm.storeVm(("image/ostype", self.ostype),
("image/kernel", self.kernel),
@@ -177,7 +175,7 @@
log.debug("cmdline = %s", self.cmdline)
log.debug("ramdisk = %s", self.ramdisk)
log.debug("vcpus = %d", self.vm.getVCpuCount())
- log.debug("features = %s", self.features)
+ log.debug("features = %s", self.vm.getFeatures())
return xc.linux_build(dom = self.vm.getDomid(),
image = self.kernel,
@@ -185,7 +183,7 @@
console_evtchn = console_evtchn,
cmdline = self.cmdline,
ramdisk = self.ramdisk,
- features = self.features)
+ features = self.vm.getFeatures())
class HVMImageHandler(ImageHandler):
--- xen-3.0.2-2/tools/python/xen/xm/create.py.blchanges 2006-04-13 13:48:39.000000000 -0400
+++ xen-3.0.2-2/tools/python/xen/xm/create.py 2006-04-28 13:23:09.000000000 -0400
@@ -451,8 +451,6 @@
config_image.append(['root', cmdline_root])
if vals.extra:
config_image.append(['args', vals.extra])
- if vals.features:
- config_image.append(['features', vals.features])
if vals.builder == 'hvm':
configure_hvm(config_image, vals)
@@ -596,7 +594,7 @@
config.append([n, v])
map(add_conf, ['name', 'memory', 'ssidref', 'maxmem', 'restart',
- 'on_poweroff', 'on_reboot', 'on_crash', 'vcpus'])
+ 'on_poweroff', 'on_reboot', 'on_crash', 'vcpus', 'features'])
if vals.uuid is not None:
config.append(['uuid', vals.uuid])
xen-check-returns.patch:
xenstored_core.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
--- NEW FILE xen-check-returns.patch ---
--- xen-unstable.hg/tools/xenstore/xenstored_core.c.unused 2006-04-25 22:06:11.000000000 -0400
+++ xen-unstable.hg/tools/xenstore/xenstored_core.c 2006-04-25 22:11:22.000000000 -0400
@@ -173,7 +173,7 @@
va_list arglist;
char *str;
char sbuf[1024];
- int ret;
+ int ret, dummy;
if (tracefd < 0)
return;
@@ -184,7 +184,7 @@
va_end(arglist);
if (ret <= 1024) {
- write(tracefd, sbuf, ret);
+ dummy = write(tracefd, sbuf, ret);
return;
}
@@ -192,7 +192,7 @@
va_start(arglist, fmt);
str = talloc_vasprintf(NULL, fmt, arglist);
va_end(arglist);
- write(tracefd, str, strlen(str));
+ dummy = write(tracefd, str, strlen(str));
talloc_free(str);
}
@@ -238,7 +238,8 @@
static void trigger_reopen_log(int signal __attribute__((unused)))
{
char c = 'A';
- write(reopen_log_pipe[1], &c, 1);
+ int dummy;
+ dummy = write(reopen_log_pipe[1], &c, 1);
}
@@ -1678,7 +1679,8 @@
exit(0);
len = sprintf(buf, "%d\n", getpid());
- write(fd, buf, len);
+ if (write(fd, buf, len) != len)
+ barf_perror("Writing pid file %s", pidfile);
}
/* Stevens. */
@@ -1703,7 +1705,8 @@
#ifndef TESTING /* Relative paths for socket names */
/* Move off any mount points we might be in. */
- chdir("/");
+ if (chdir("/") == -1)
+ barf_perror("Failed to chdir");
#endif
/* Discard our parent's old-fashioned umask prejudices. */
umask(0);
@@ -1900,7 +1903,8 @@
if (FD_ISSET(reopen_log_pipe[0], &inset)) {
char c;
- read(reopen_log_pipe[0], &c, 1);
+ if (read(reopen_log_pipe[0], &c, 1) != 1)
+ barf_perror("read failed");
reopen_log();
}
xen-config-allow-http.patch:
xend-config.sxp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
--- NEW FILE xen-config-allow-http.patch ---
--- xen-unstable.hg/tools/examples/xend-config.sxp.http 2006-04-25 21:57:10.000000000 -0400
+++ xen-unstable.hg/tools/examples/xend-config.sxp 2006-04-25 21:57:35.000000000 -0400
@@ -14,7 +14,7 @@
#(logfile /var/log/xend.log)
#(loglevel DEBUG)
-#(xend-http-server no)
+(xend-http-server yes)
#(xend-unix-server no)
#(xend-tcp-xmlrpc-server no)
#(xend-unix-xmlrpc-server yes)
@@ -35,7 +35,7 @@
# Specifying 'localhost' prevents remote connections.
# Specifying the empty string '' (the default) allows all connections.
#(xend-address '')
-#(xend-address localhost)
+(xend-address localhost)
# Address xend should listen on for relocation-socket connections, if
# xend-relocation-server is set.
Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/xen/FC-5/.cvsignore,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- .cvsignore 1 Mar 2006 23:04:59 -0000 1.15
+++ .cvsignore 28 Apr 2006 17:40:42 -0000 1.16
@@ -1,2 +1,2 @@
LibVNCServer-0.7.1.tar.gz
-xen-3.0.1-20060301.tar.bz2
+xen-3.0.2-src.tgz
Index: sources
===================================================================
RCS file: /cvs/dist/rpms/xen/FC-5/sources,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- sources 1 Mar 2006 23:04:59 -0000 1.30
+++ sources 28 Apr 2006 17:40:42 -0000 1.31
@@ -1,2 +1,2 @@
54110288b3171551c03467cd60976d55 LibVNCServer-0.7.1.tar.gz
-b6de980106e996ef5fdb845022c69bca xen-3.0.1-20060301.tar.bz2
+ae26a3f51b2d94aca17fbe4df68fdc1d xen-3.0.2-src.tgz
Index: xen.spec
===================================================================
RCS file: /cvs/dist/rpms/xen/FC-5/xen.spec,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- xen.spec 18 Apr 2006 17:10:09 -0000 1.107
+++ xen.spec 28 Apr 2006 17:40:42 -0000 1.108
@@ -4,13 +4,12 @@
Summary: Xen is a virtual machine monitor
Name: xen
-Version: 3.0.1
-Release: 5.FC5
+Version: 3.0.2
+Release: 0.FC5
Group: Development/Libraries
License: GPL
URL: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html
-# xen-unstable cs 9022
-Source0: xen-3.0.1-20060301.tar.bz2
+Source0: xen-3.0.2-src.tgz
Source1: http://download.sf.net/libvncserver/LibVNCServer-%{libvncver}.tar.gz
Source2: xenguest-install.py
Source3: xen-udev.rules
@@ -21,10 +20,12 @@
Patch4: xen-compile-fixes.patch
Patch6: xen-network-iptables-bridge.patch
Patch8: xen-vmxballoon-hack.patch
-Patch9: xen-3.0.1-config-allow-http.patch
+Patch9: xen-config-allow-http.patch
Patch10: xen-3.0.1-m64.patch
Patch11: xen-3.0.1-cloexec.patch
Patch12: xen-3.0.1-tempdir.patch
+Patch13: xen-blchanges.patch
+Patch14: xen-check-returns.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: transfig libidn-devel zlib-devel texi2html SDL-devel curl-devel
BuildRequires: libX11-devel python-devel ghostscript tetex-latex
@@ -38,6 +39,7 @@
Requires: bridge-utils
Requires: python-abi = %(%{__python} -c "import sys ; print sys.version[:3]")
Requires: udev >= 059
+Requires: libvirt-python
Prereq: chkconfig
ExclusiveArch: i386 x86_64
@@ -55,18 +57,20 @@
or makes fun of you in front of your friends.
%prep
-%setup -q -n xen-3.0.1 -a 1
-%patch0 -p1 -b .misc
+%setup -q -n xen-3.0.2-2 -a 1
+#patch0 -p1 -b .misc
%patch1 -p1 -b .init
-%patch2 -p1 -b .kva-mmap
+#patch2 -p1 -b .kva-mmap
%patch3 -p1 -b .mem-min
%patch4 -p1 -b .compile
%patch6 -p1
%patch8 -p1
%patch9 -p1
-%patch10 -p1 -b .m64
+#patch10 -p1 -b .m64
%patch11 -p1 -b .cloexec
%patch12 -p1 -b .tempdir
+%patch13 -p1 -b .blchanges
+%patch14 -p1
cp %{SOURCE2} .
@@ -165,6 +169,12 @@
%dir %{_localstatedir}/run/xenstored
%changelog
+* Fri Apr 28 2006 Jeremy Katz <katzj at redhat.com> - 3.0.2-0.FC5
+- update to 3.0.2-2
+- add patches for bootloader to run on all domain creations
+- make xenguest-install create a persistent uuid
+- use libvirt for paravirt domain creation in xenguest-install
+
* Tue Apr 18 2006 Daniel Veillard <veillard at redhat.com> - 3.0.1-5.FC5
- augment the close on exec patch with the fix for #188361
Index: xenguest-install.py
===================================================================
RCS file: /cvs/dist/rpms/xen/FC-5/xenguest-install.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- xenguest-install.py 9 Mar 2006 05:09:29 -0000 1.13
+++ xenguest-install.py 28 Apr 2006 17:40:42 -0000 1.14
@@ -20,6 +20,8 @@
import random
from optparse import OptionParser
+import libvirt
+
XENCONFIGPATH="/etc/xen/"
# stolen directly from xend/server/netif.py
@@ -41,6 +43,17 @@
random.randint(0x00, 0xff) ]
return ':'.join(map(lambda x: "%02x" % x, mac))
+# ... and stolen from xend/uuid.py
+def randomUUID():
+ """Generate a random UUID."""
+
+ return [ random.randint(0, 255) for _ in range(0, 16) ]
+
+def uuidToString(u):
+ return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2,
+ "%02x" * 6]) % tuple(u)
+
+
def yes_or_no(s):
s = s.lower()
if s in ("y", "yes", "1", "true", "t"):
@@ -93,6 +106,11 @@
return disk
+def get_uuid(options):
+ if options.uuid:
+ return options.uuid
+ return uuidToString(randomUUID())
+
def get_mac(options):
if options.mac:
return options.mac
@@ -128,7 +146,7 @@
cdrom = sys.stdin.readline().strip()
return cdrom
-def start_hvm_guest(name, ram, disk, mac, cdrom):
+def start_hvm_guest(name, ram, disk, mac, uuid, cdrom):
if os.uname()[4] in ("x86_64"):
qemu = "/usr/lib64/xen/bin/qemu-dm"
else:
@@ -151,6 +169,7 @@
name = "%(name)s"
builder = "hvm"
memory = "%(ram)s"
+uuid = "%(uuid)s"
disk = [ '%(type)s:%(disk)s,ioemu:hda,w' ]
vif = [ 'type=ioemu,bridge=xenbr0,mac=%(mac)s' ]
on_reboot = 'restart'
@@ -163,7 +182,7 @@
nographic = %(noX)d # don't use graphics
serial='pty' # enable serial console
""" % {'name': name, 'ram': ram, 'disk': disk, 'mac': mac, 'devmodel': qemu,
- 'hasX': hasX, 'noX': not hasX, 'type': type }
+ 'hasX': hasX, 'noX': not hasX, 'type': type, 'uuid': uuid }
f.write(buf)
f.close()
@@ -246,65 +265,115 @@
print "What is the install location? ",
src = sys.stdin.readline().strip()
-def start_paravirt_install(name, ram, disk, mac, src, extra = ""):
+def start_paravirt_install(name, ram, disk, mac, uuid, src, extra = ""):
+ def writeConfig(cfgdict):
+ cfg = "%s%s" %(XENCONFIGPATH, cfgdict['name'])
+ f = open(cfg, "w+")
+ buf = """# Automatically generated xen config file
+name = "%(name)s"
+memory = "%(ram)s"
+disk = [ '%(disktype)s:%(disk)s,xvda,w' ]
+vif = [ 'mac=%(mac)s' ]
+uuid = "%(uuid)s"
+bootloader="/usr/bin/pygrub"
+
+on_reboot = 'destroy'
+on_crash = 'destroy'
+""" % cfgdict
+ f.write(buf)
+ f.close()
+
(kfn, ifn) = get_paravirt_install_image(src)
if stat.S_ISBLK(os.stat(disk)[stat.ST_MODE]):
type = "phy"
else:
type = "file"
-
- cfg = "%s%s" %(XENCONFIGPATH, name)
- f = open(cfg, "w+")
- buf = """# Automatically generated xen config file
-name = "%(name)s"
-memory = "%(ram)s"
-disk = [ '%(type)s:%(disk)s,xvda,w' ]
-vif = [ 'mac=%(mac)s' ]
-#bootloader="/usr/bin/pygrub"
-on_reboot = 'destroy'
-on_crash = 'destroy'
-""" % {'name': name, 'ram': ram, 'disk': disk, 'mac': mac, 'type': type }
- f.write(buf)
- f.close()
+ cfgdict = {'name': name, 'ram': ram, 'ramkb': int(ram) * 1024, 'disk': disk, 'mac': mac, 'disktype': type, 'uuid': uuid, 'kernel': kfn, 'initrd': ifn, 'src': src, 'extra': extra }
- print "\n\nStarting install..."
+ # FIXME: there's a hack sticking a root= in here because libvirt requires
+ cfgxml = """<domain type='xen'>
+ <name>%(name)s</name>
+ <os>
+ <type>linux</type>
+ <kernel>%(kernel)s</kernel>
+ <initrd>%(initrd)s</initrd>
+ <cmdline> root=/dev/xvd method=%(src)s %(extra)s</cmdline>
+ </os>
+ <memory>%(ramkb)s</memory>
+ <vcpu>1</vcpu>
+ <uuid>%(uuid)s</uuid>
+ <on_reboot>destroy</on_reboot>
+ <on_poweroff>destroy</on_poweroff>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='%(disktype)s'>
+ <source file='%(disk)s'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='%(mac)s'/>
+ <script path='/etc/xen/scripts/vif-bridge'/>
+ </interface>
+ </devices>
+</domain>
+""" % cfgdict
+
+ conn = libvirt.openReadOnly(None)
+ if conn == None:
+ print >> sys.stderr, "Unable to connect to hypervisor, aborting installation"
+ sys.exit(1)
- # this is kind of lame. we call xm create, then change our
- # guest config file to use a boot loader instead of the passed kernel
- cmd = ["/usr/sbin/xm", "create", "-c", "kernel=%s" %(kfn,),
- "ramdisk=%s" %(ifn,),
- "extra=method=%s %s" %(src,extra),
- cfg]
+
+ print "\n\nStarting install..."
+ dom = conn.createLinux(cfgxml, 0)
+ if dom == None:
+ print >> sys.stderr, "Unable to create domain for guest, aborting installation"
+ sys.exit(2)
+
+ # *sigh* would be nice to have a python version of xmconsole I guess...
+ # and probably not much work at all to throw together, but this will
+ # do for now
+ cmd = ["/usr/sbin/xm", "console", "%s" %(dom.ID(),)]
child = os.fork()
if (not child):
os.execvp(cmd[0], cmd)
os._exit(1)
time.sleep(5)
- f = open(cfg, "r")
- buf = f.read()
- f.close()
os.unlink(kfn)
os.unlink(ifn)
-
- buf = buf.replace("#bootloader", "bootloader")
- buf = buf.replace("'destroy'", "'restart'")
- f = open(cfg, "w+")
- f.write(buf)
- f.close()
+ # FIXME: if the domain doesn't exist now, it almost certainly crashed.
+ # it'd be nice to know that for certain...
+ try:
+ d = conn.lookupByID(dom.ID())
+ except libvirt.libvirtError:
+ print ("\n\nIt appears that your installation has crashed. You should\n"
+ "be able to find more information in the Xen logs")
+ sys.exit(3)
+ writeConfig(cfgdict)
+
status = -1
try:
(pid, status) = os.waitpid(child, 0)
except OSError, (errno, msg):
print __name__, "waitpid:", msg
- print ("If your install has exited, you can restart your guest by running\n"
- "'xm create -c %s'. Otherwise, you can reconnect to the console\n"
- "by running 'xm console %s'" %(name, name))
+ # ensure there's time for the domain to finish destroying if the
+ # install has finished or the guest crashed
+ time.sleep(1)
+ try:
+ d = conn.lookupByID(dom.ID())
+ except libvirt.libvirtError:
+ print ("If your install completed successfully, you can restart your\n"
+ "guest by running 'xm create -c %s'." %(name,))
+ else:
+ print ("You can reconnect to the console of your guest by running\n"
+ "'xm console %s'" %(name,))
def parse_args():
@@ -319,6 +388,8 @@
help="Memory to allocate for guest instance in megabytes")
parser.add_option("-m", "--mac", type="string", dest="mac",
help="Fixed MAC address for the guest; if none is given a random address will be used")
+ parser.add_option("-u", "--uuid", type="string", dest="uuid",
+ help="UUID for the guest; if none is given a random UUID will be generated")
# vmx/svm options
if is_hvm_capable():
@@ -370,19 +441,20 @@
ram = get_ram(options)
disk = get_disk(options)
mac = get_mac(options)
+ uuid = get_uuid(options)
if is_hvm_capable():
hvm = get_full_virt(options)
if not hvm:
src = get_paravirt_install(options)
- start_paravirt_install(name, ram, disk, mac, src, options.extra)
+ start_paravirt_install(name, ram, disk, mac, uuid, src, options.extra)
else:
if get_virt_cdboot(options):
cdrom = get_virt_cdrom(options)
else:
cdrom = None
- start_hvm_guest(name, ram, disk, mac, cdrom)
+ start_hvm_guest(name, ram, disk, mac, uuid, cdrom)
if __name__ == "__main__":
main()
More information about the fedora-cvs-commits
mailing list