diff --git a/15157_modified.patch b/15157_modified.patch deleted file mode 100644 index b04a9b7..0000000 --- a/15157_modified.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -ru a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py ---- a/tools/python/xen/xend/XendDomainInfo.py 2007-06-08 11:19:37.000000000 -0600 -+++ b/tools/python/xen/xend/XendDomainInfo.py 2007-06-08 11:23:59.000000000 -0600 -@@ -545,20 +545,17 @@ - - def destroyDevice(self, deviceClass, devid, force = False): - try: -- devid = int(devid) -+ dev = int(devid) - except ValueError: -- # devid is not a number, let's search for it in xenstore. -- devicePath = '%s/device/%s' % (self.dompath, deviceClass) -- for entry in xstransact.List(devicePath): -- backend = xstransact.Read('%s/%s' % (devicePath, entry), -- "backend") -- devName = xstransact.Read(backend, "dev") -- if devName == devid: -- # We found the integer matching our devid, use it instead -- devid = entry -- break -- -- return self.getDeviceController(deviceClass).destroyDevice(devid, force) -+ # devid is not a number but a string containing either device -+ # name (e.g. xvda) or device_type/device_id (e.g. vbd/51728) -+ dev = type(devid) is str and devid.split('/')[-1] or None -+ if dev == None: -+ log.debug("Could not find the device %s", devid) -+ return None -+ -+ log.debug("dev = %s", dev) -+ return self.getDeviceController(deviceClass).destroyDevice(dev, force) - - def getDeviceSxprs(self, deviceClass): - if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): -@@ -1354,20 +1351,19 @@ - self.image.destroy(suspend) - return - -- while True: -- t = xstransact("%s/device" % self.dompath) -- for devclass in XendDevices.valid_devices(): -- for dev in t.list(devclass): -- try: -- t.remove(dev) -- except: -- # Log and swallow any exceptions in removal -- -- # there's nothing more we can do. -- log.exception( -- "Device release failed: %s; %s; %s", -- self.info['name_label'], devclass, dev) -- if t.commit(): -- break -+ t = xstransact("%s/device" % self.dompath) -+ for devclass in XendDevices.valid_devices(): -+ for dev in t.list(devclass): -+ try: -+ log.debug("Removing %s", dev); -+ self.destroyDevice(devclass, dev, False); -+ except: -+ # Log and swallow any exceptions in removal -- -+ # there's nothing more we can do. -+ log.exception("Device release failed: %s; %s; %s", -+ self.info['name_label'], devclass, dev) -+ -+ - - def getDeviceController(self, name): - """Get the device controller for this domain, and if it diff --git a/15157_xend_device_destroy.patch b/15157_xend_device_destroy.patch new file mode 100644 index 0000000..81fd0fe --- /dev/null +++ b/15157_xend_device_destroy.patch @@ -0,0 +1,104 @@ +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1180016489 -3600 +# Node ID 3ef4a4d8213061fe14d905e89594c99d0b9cb605 +# Parent 6a4af9502b4da269388a60416a7cca0ecadb3bb3 +xend: Fix for removing devices at save/destroy domain. + +The function XendDomainInfo:_releaseDevices() is called during the +save/destroy phase of a domain. It made some attempt to clean up the +devices, but wasn't complete, leaving dangling devices in the +xenstore. Not a big problem with normal use of Xen, but a buildup over +a large number of save/destroy instances, it would make the xenstore +database grow quite large, which in turn meant swap-thrashing in Dom0. + +This patch makes use of the destroyDevices() function in +XendDomainInfo. This function needed some re-writing to make it work +correctly - I think it had some old code (not sure how old, as xm +annotate says that it's changeset 12071, but that, I think, is when it +was split out from XendDomain.py, rather than when it was created). + +I have tested this over a few hundred save/restore cycles [two domains +constantly saved/restored with a short sleep to let them process some +work] combined with a loop of "xenstore-ls|wc". The output of the +latter is pretty much constant (it obviously varies a bit depending on +when in the save/restore cycle it hits). Previously, it would increase +by some 10 lines or so per save/restore cycle. + +Signed-off-by: Mats Petersson + +Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -544,20 +544,30 @@ class XendDomainInfo: + self.getDeviceController(devclass).waitForDevices() + + def destroyDevice(self, deviceClass, devid, force = False): ++ found = True # Assume devid is an integer. + try: + devid = int(devid) + except ValueError: + # devid is not a number, let's search for it in xenstore. + devicePath = '%s/device/%s' % (self.dompath, deviceClass) ++ found = False + for entry in xstransact.List(devicePath): ++ log.debug("Attempting to find devid at %s/%s", devicePath, entry) + backend = xstransact.Read('%s/%s' % (devicePath, entry), + "backend") +- devName = xstransact.Read(backend, "dev") +- if devName == devid: +- # We found the integer matching our devid, use it instead +- devid = entry +- break +- ++ if backend != None: ++ devName = '%s/%s' % (deviceClass, entry) ++ log.debug("devName=%s", devName) ++ if devName == devid: ++ # We found the integer matching our devid, use it instead ++ devid = int(entry) ++ found = True ++ break ++ ++ if not found: ++ log.debug("Could not find the device %s", devid) ++ return None ++ log.debug("devid = %s", devid) + return self.getDeviceController(deviceClass).destroyDevice(devid, force) + + def getDeviceSxprs(self, deviceClass): +@@ -1330,20 +1340,19 @@ class XendDomainInfo: + self.image.destroy(suspend) + return + +- while True: +- t = xstransact("%s/device" % self.dompath) +- for devclass in XendDevices.valid_devices(): +- for dev in t.list(devclass): +- try: +- t.remove(dev) +- except: +- # Log and swallow any exceptions in removal -- +- # there's nothing more we can do. +- log.exception( +- "Device release failed: %s; %s; %s", +- self.info['name_label'], devclass, dev) +- if t.commit(): +- break ++ t = xstransact("%s/device" % self.dompath) ++ for devclass in XendDevices.valid_devices(): ++ for dev in t.list(devclass): ++ try: ++ log.debug("Removing %s", dev); ++ self.destroyDevice(devclass, dev, False); ++ except: ++ # Log and swallow any exceptions in removal -- ++ # there's nothing more we can do. ++ log.exception("Device release failed: %s; %s; %s", ++ self.info['name_label'], devclass, dev) ++ ++ + + def getDeviceController(self, name): + """Get the device controller for this domain, and if it diff --git a/15250_xend_device_destroy.patch b/15250_xend_device_destroy.patch new file mode 100644 index 0000000..1b0cfaf --- /dev/null +++ b/15250_xend_device_destroy.patch @@ -0,0 +1,69 @@ +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1181553294 -3600 +# Node ID a43a03d53781e159da41f79d8cc615905b95ab80 +# Parent 93f77a5a8437df0b34919a6987f48e84342b4a43 +xend: Fix xm block-detach regression introduced by c/s 15157. + +Prior to this c/s, user was able to specify device name or id, e.g. + xm block-detach dom xvdb + xm block-detach dom 15728 + +Now, 'xm block-detach dom xvdb' silently fails. xend.log does contain +the following + +[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG +(XendDomainInfo:519) devName=vbd/51712 +[2007-06-07 11:39:18 xend.XendDomainInfo 3775] DEBUG +(XendDomainInfo:527) Could not find the device xvdb + +This patch restores the previous behavior but retains the bugfix +introduced by c/s 15571. + +Signed-off-by: Jim Fehlig + +Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -544,31 +544,18 @@ class XendDomainInfo: + self.getDeviceController(devclass).waitForDevices() + + def destroyDevice(self, deviceClass, devid, force = False): +- found = True # Assume devid is an integer. + try: +- devid = int(devid) ++ dev = int(devid) + except ValueError: +- # devid is not a number, let's search for it in xenstore. +- devicePath = '%s/device/%s' % (self.dompath, deviceClass) +- found = False +- for entry in xstransact.List(devicePath): +- log.debug("Attempting to find devid at %s/%s", devicePath, entry) +- backend = xstransact.Read('%s/%s' % (devicePath, entry), +- "backend") +- if backend != None: +- devName = '%s/%s' % (deviceClass, entry) +- log.debug("devName=%s", devName) +- if devName == devid: +- # We found the integer matching our devid, use it instead +- devid = int(entry) +- found = True +- break ++ # devid is not a number but a string containing either device ++ # name (e.g. xvda) or device_type/device_id (e.g. vbd/51728) ++ dev = type(devid) is str and devid.split('/')[-1] or None ++ if dev == None: ++ log.debug("Could not find the device %s", devid) ++ return None + +- if not found: +- log.debug("Could not find the device %s", devid) +- return None +- log.debug("devid = %s", devid) +- return self.getDeviceController(deviceClass).destroyDevice(devid, force) ++ log.debug("dev = %s", dev) ++ return self.getDeviceController(deviceClass).destroyDevice(dev, force) + + def getDeviceSxprs(self, deviceClass): + if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): diff --git a/15273_libxenapi.patch b/15273_libxenapi.patch new file mode 100644 index 0000000..12bd7be --- /dev/null +++ b/15273_libxenapi.patch @@ -0,0 +1,66 @@ +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1181730428 -3600 +# Node ID 7f9362a8ae3daeb5dc7bc62069eae872c42a5a14 +# Parent 30449e0e0a64618c29e47ed7774cd2b689711319 +xenapi: Fix segfault in libxenapi. + +When calling xen_vbd_set_mode(), libxenapi attempted to convert enum +mode parameter to a string twice - resulting in segfault. Removed +first conversion since conversion is taking place in +marshalling/demarshalling layer. Fixed similar double enum conversion +in other places as well. + +Signed-off-by: Jim Fehlig + +diff -r 30449e0e0a64 -r 7f9362a8ae3d tools/libxen/src/xen_vbd.c +--- a/tools/libxen/src/xen_vbd.c Wed Jun 13 11:13:11 2007 +0100 ++++ b/tools/libxen/src/xen_vbd.c Wed Jun 13 11:27:08 2007 +0100 +@@ -463,7 +463,7 @@ xen_vbd_set_mode(xen_session *session, x + { .type = &abstract_type_string, + .u.string_val = vbd }, + { .type = &xen_vbd_mode_abstract_type_, +- .u.string_val = xen_vbd_mode_to_string(mode) } ++ .u.enum_val = mode } + }; + + xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL); +@@ -479,7 +479,7 @@ xen_vbd_set_type(xen_session *session, x + { .type = &abstract_type_string, + .u.string_val = vbd }, + { .type = &xen_vbd_type_abstract_type_, +- .u.string_val = xen_vbd_type_to_string(type) } ++ .u.enum_val = type } + }; + + xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL); +diff -r 30449e0e0a64 -r 7f9362a8ae3d tools/libxen/src/xen_vm.c +--- a/tools/libxen/src/xen_vm.c Wed Jun 13 11:13:11 2007 +0100 ++++ b/tools/libxen/src/xen_vm.c Wed Jun 13 11:27:08 2007 +0100 +@@ -1142,7 +1142,7 @@ xen_vm_set_actions_after_shutdown(xen_se + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_on_normal_exit_abstract_type_, +- .u.string_val = xen_on_normal_exit_to_string(after_shutdown) } ++ .u.enum_val = after_shutdown } + }; + + xen_call_(session, "VM.set_actions_after_shutdown", param_values, 2, NULL, NULL); +@@ -1158,7 +1158,7 @@ xen_vm_set_actions_after_reboot(xen_sess + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_on_normal_exit_abstract_type_, +- .u.string_val = xen_on_normal_exit_to_string(after_reboot) } ++ .u.enum_val = after_reboot } + }; + + xen_call_(session, "VM.set_actions_after_reboot", param_values, 2, NULL, NULL); +@@ -1174,7 +1174,7 @@ xen_vm_set_actions_after_crash(xen_sessi + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &xen_on_crash_behaviour_abstract_type_, +- .u.string_val = xen_on_crash_behaviour_to_string(after_crash) } ++ .u.enum_val = after_crash } + }; + + xen_call_(session, "VM.set_actions_after_crash", param_values, 2, NULL, NULL); diff --git a/15274_xenapi.patch b/15274_xenapi.patch new file mode 100644 index 0000000..8c49a5e --- /dev/null +++ b/15274_xenapi.patch @@ -0,0 +1,30 @@ +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1181730467 -3600 +# Node ID ffdbe8aebde21710deca4ae84bba95e38f4b089b +# Parent 7f9362a8ae3daeb5dc7bc62069eae872c42a5a14 +xenapi: Implement XenAPI method VBD.set_mode in python. +Signed-off-by: Jim Fehlig + +Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py ++++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py +@@ -1873,6 +1873,17 @@ class XendAPI(object): + xd.managed_config_save(vm) + return xen_api_success_void() + ++ def VBD_set_mode(self, session, vbd_ref, mode): ++ if mode == 'RW': ++ mode = 'w' ++ else: ++ mode = 'r' ++ xd = XendDomain.instance() ++ vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref) ++ vm.set_dev_property('vbd', vbd_ref, 'mode', mode) ++ xd.managed_config_save(vm) ++ return xen_api_success_void() ++ + def VBD_get_all(self, session): + xendom = XendDomain.instance() + vbds = [d.get_vbds() for d in XendDomain.instance().list('all')] diff --git a/15275_xenapi.patch b/15275_xenapi.patch new file mode 100644 index 0000000..97c6f50 --- /dev/null +++ b/15275_xenapi.patch @@ -0,0 +1,27 @@ +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1181730493 -3600 +# Node ID b643179d7452a91cd874ee713c78bf30f8df3d2d +# Parent ffdbe8aebde21710deca4ae84bba95e38f4b089b +xenapi: Implement VM.set_VCPUs_at_startup and VM.set_VCPUs_max XenAPI +methods in xend. + +Signed-off-by: Jim Fehlig + +Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py +=================================================================== +--- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py ++++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py +@@ -1474,6 +1474,12 @@ class XendAPI(object): + else: + return xen_api_success_void() + ++ def VM_set_VCPUs_at_startup(self, session, vm_ref, num): ++ return self.VM_set('VCPUs_at_startup', session, vm_ref, num) ++ ++ def VM_set_VCPUs_max(self, session, vm_ref, num): ++ return self.VM_set('VCPUs_max', session, vm_ref, num) ++ + def VM_set_actions_after_shutdown(self, session, vm_ref, action): + if action not in XEN_API_ON_NORMAL_EXIT: + return xen_api_error(['VM_ON_NORMAL_EXIT_INVALID', vm_ref]) diff --git a/00-domain-restore.patch b/15410-domain-restore.patch similarity index 58% rename from 00-domain-restore.patch rename to 15410-domain-restore.patch index 0a486a9..54d7c4d 100644 --- a/00-domain-restore.patch +++ b/15410-domain-restore.patch @@ -1,6 +1,15 @@ -diff -r c21b18b97a61 tools/libxc/xc_domain_restore.c ---- a/tools/libxc/xc_domain_restore.c Tue Jun 05 17:05:13 2007 +0100 -+++ b/tools/libxc/xc_domain_restore.c Tue Jun 05 17:40:40 2007 +0100 + +# HG changeset patch +# User kfraser@localhost.localdomain +# Date 1182415659 -3600 +# Node ID a83632dfbb28038ec4218e00f92ea220a85b6887 +# Parent 11bf94b2d51a10980a88aa3ee0b3b8c6e14cbfe0 +libxenguest: Add missing range-check on count field read from a domain +save/restore file. +Signed-off-by: Keir Fraser + +--- a/tools/libxc/xc_domain_restore.c Wed Jun 20 19:31:37 2007 +0100 ++++ b/tools/libxc/xc_domain_restore.c Thu Jun 21 09:47:39 2007 +0100 @@ -903,13 +903,14 @@ int xc_domain_restore(int xc_handle, int /* Get the list of PFNs that are not in the psuedo-phys map */ @@ -20,3 +29,4 @@ diff -r c21b18b97a61 tools/libxc/xc_domain_restore.c goto out; } + diff --git a/clear_DF_for_kernel.patch b/clear_DF_for_kernel.patch new file mode 100644 index 0000000..8be3189 --- /dev/null +++ b/clear_DF_for_kernel.patch @@ -0,0 +1,12 @@ +Index: xen-3.1-testing/xen/arch/x86/x86_64/entry.S +=================================================================== +--- xen-3.1-testing.orig/xen/arch/x86/x86_64/entry.S ++++ xen-3.1-testing/xen/arch/x86/x86_64/entry.S +@@ -34,6 +34,7 @@ switch_to_kernel: + jnc 1f + movb $TBF_INTERRUPT,TRAPBOUNCE_flags(%rdx) + 1: call create_bounce_frame ++ andl $~X86_EFLAGS_DF,UREGS_eflags(%rsp) + jmp test_all_events + + /* %rbx: struct vcpu, interrupts disabled */ diff --git a/man-page.diff b/man-page.diff new file mode 100644 index 0000000..dc0dd1a --- /dev/null +++ b/man-page.diff @@ -0,0 +1,742 @@ +Index: xen-3.1-testing/docs/man/xm.pod.1 +=================================================================== +--- xen-3.1-testing.orig/docs/man/xm.pod.1 ++++ xen-3.1-testing/docs/man/xm.pod.1 +@@ -4,7 +4,7 @@ xm - Xen management user interface + + =head1 SYNOPSIS + +-xm [args] ++B I [I] + + =head1 DESCRIPTION + +@@ -13,46 +13,50 @@ domains. The program can be used to crea + domains. It can also be used to list current domains, enable or pin + VCPUs, and attach or detach virtual block devices. + +-The basic structure of every xm command is almost always: ++The basic structure of every B command is almost always: + +- xm [OPTIONS] ++=over 2 + +-Where I is one of the sub commands listed below, I ++B I I [I] ++ ++=back ++ ++Where I is one of the subcommands listed below, I + is the numeric domain id, or the domain name (which will be internally +-translated to domain id), and I are sub command specific ++translated to domain id), and I are subcommand specific + options. There are a few exceptions to this rule in the cases where +-the sub command in question acts on all domains, the entire machine, +-or directly on the xen hypervisor. Those exceptions will be clear for +-each of those sub commands. ++the subcommand in question acts on all domains, the entire machine, ++or directly on the Xen hypervisor. Those exceptions will be clear for ++each of those subcommands. + + =head1 NOTES + + All B operations rely upon the Xen control daemon, aka B. +-For any xm commands to run xend must also be running. For this reason +-you should start xend as a service when your system first boots using +-xen. ++For any B commands to run, xend must also be running. For this ++reason you should start xend as a service when your system first boots ++using Xen. + + Most B commands require root privileges to run due to the + communications channels used to talk to the hypervisor. Running as + non root will return an error. + + Most B commands act asynchronously, so just because the B +-command returned, doesn't mean the action is complete. This is ++command returned doesn't mean the action is complete. This is + important, as many operations on domains, like create and shutdown, + can take considerable time (30 seconds or more) to bring the machine + into a fully compliant state. If you want to know when one of these +-actions has finished you must poll through xm list periodically. ++actions has finished you must poll through B periodically. + + =head1 DOMAIN SUBCOMMANDS + +-The following sub commands manipulate domains directly, as stated +-previously most commands take domain-id as the first parameter. ++The following subcommands manipulate domains directly. As stated ++previously, most commands take I as the first parameter. + + =over 4 + + =item B I + +-Attach to domain domain-id's console. If you've set up your Domains to ++Attach to domain I's console. If you've set up your domains to + have a traditional log in console this will look much like a normal + text log in screen. + +@@ -63,15 +67,15 @@ The attached console will perform much l + so running curses based interfaces over the console B. Vi tends to get very odd when using it over this interface. + +-=item B I<[-c]> I I<[name=value]>.. ++=item B [B<-c>] I [I=I].. + +-The create sub command requires a configfile and can optional take a ++The create sub command requires a config file and can optionally take a + series of name value pairs that add to or override variables defined + in the config file. See L for full details of that file + format, and possible options used in either the configfile or +-Name=Value combinations. ++I=I combinations. + +-Configfile can either be an absolute path to a file, or a relative ++I can either be an absolute path to a file, or a relative + path to a file located in /etc/xen. + + Create will return B as the domain is started. This B I + +-Immediately terminate the domain domain-id. This doesn't give the domain +-OS any chance to react, and it the equivalent of ripping the power +-cord out on a physical machine. In most cases you will want to use +-the B command instead. ++Immediately terminate the domain I. This doesn't give the ++domain OS any chance to react, and is the equivalent of ripping the ++power cord out on a physical machine. In most cases you will want to ++use the B command instead. + + =item B I + +@@ -129,14 +133,14 @@ Converts a domain name to a domain id us + + Converts a domain id to a domain name using xend's internal mapping. + +-=item B I<[--long]> ++=item B [B<--long>] + + Displays the short help message (i.e. common commands). + +-The I<--long> option prints out the complete set of B subcommands, ++The B<--long> option prints out the complete set of B subcommands, + grouped by function. + +-=item B I<[--long | --label]> I<[domain-id, ...]> ++=item B [B<--long> | B<--label>] [I ...] + + Prints information about one or more domains. If no domains are + specified it prints out information about all domains. +@@ -151,21 +155,23 @@ An example format for the list is as fol + Mandrake10.2 167 128 1 ------ 2.5 + Suse9.2 168 100 1 ------ 1.8 + +-Name is the name of the domain. ID the domain numeric id. Mem is the +-size of the memory allocated to the domain. VCPUS is the number of +-VCPUS allocated to domain. State is the run state (see below). Time +-is the total run time of the domain as accounted for by Xen. ++Name is the name of the domain. ID the numeric domain id. Mem is the ++desired amount of memory to allocate to the domain (although it may ++not be the currently allocated amount). VCPUs is the number of ++virtual CPUs allocated to the domain. State is the run state (see ++below). Time is the total run time of the domain as accounted for by ++Xen. + + B + + =over 4 + +-The State field lists 6 states for a Xen Domain, and which ones the +-current Domain is in. ++The State field lists 6 states for a Xen domain, and which ones the ++current domain is in. + + =item B + +-The domain is currently running on a CPU ++The domain is currently running on a CPU. + + =item B + +@@ -203,12 +209,12 @@ B + + =over 4 + +-If I<--long> is specified, the output for xm list is not the table ++If B<--long> is specified, the output for B is not the table + view shown above, but instead is an S-Expression representing all + information known about all domains asked for. This is mostly only + useful for external programs to parse the data. + +-B there is no stable guarantees on the format of this data. ++B There is no stable guarantees on the format of this data. + Use at your own risk. + + =back +@@ -217,10 +223,10 @@ B