diff options
author | Alex Williamson <alex.williamson@hp.com> | 2007-09-07 13:56:50 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@hp.com> | 2007-09-07 13:56:50 -0600 |
commit | a3b952728bdd3c11d415dc97cda1cde624fe8c92 (patch) | |
tree | 2c1d5c50ede206287dfbc2755347d274162b4749 /tools | |
parent | e12209779415c9c66688503e97dcc7d6b1d40351 (diff) | |
parent | e94e3f210a6244948e605836fc0f285de3599208 (diff) | |
download | xen-a3b952728bdd3c11d415dc97cda1cde624fe8c92.tar.gz xen-a3b952728bdd3c11d415dc97cda1cde624fe8c92.tar.bz2 xen-a3b952728bdd3c11d415dc97cda1cde624fe8c92.zip |
merge with xen-unstable.hg (staging)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 2 | ||||
-rw-r--r-- | tools/check/Makefile | 4 | ||||
-rwxr-xr-x | tools/check/check_xml2 | 2 | ||||
-rw-r--r-- | tools/ioemu/hw/cirrus_vga.c | 2 | ||||
-rw-r--r-- | tools/ioemu/vl.c | 2 | ||||
-rw-r--r-- | tools/libxc/xc_misc.c | 33 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 8 | ||||
-rw-r--r-- | tools/python/xen/xend/XendDomain.py | 4 | ||||
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 19 | ||||
-rw-r--r-- | tools/python/xen/xend/server/XMLRPCServer.py | 2 | ||||
-rw-r--r-- | tools/python/xen/xm/main.py | 11 | ||||
-rw-r--r-- | tools/security/Makefile | 2 | ||||
-rw-r--r-- | tools/xenfb/xenfb.c | 10 | ||||
-rw-r--r-- | tools/xenstore/xenstored_core.c | 8 |
14 files changed, 77 insertions, 32 deletions
diff --git a/tools/Makefile b/tools/Makefile index c150dbd984..18205ccca8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -10,7 +10,7 @@ SUBDIRS-y += examples SUBDIRS-y += xentrace SUBDIRS-$(CONFIG_XCUTILS) += xcutils SUBDIRS-$(CONFIG_X86) += firmware -SUBDIRS-y += security +SUBDIRS-$(ACM_SECURITY) += security SUBDIRS-y += console SUBDIRS-y += xenmon SUBDIRS-y += guest-headers diff --git a/tools/check/Makefile b/tools/check/Makefile index 98f125f048..abba3d6ab7 100644 --- a/tools/check/Makefile +++ b/tools/check/Makefile @@ -7,7 +7,7 @@ all: build # Check this machine is OK for building on. .PHONY: build build: - XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build + XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ACM_SECURITY=$(ACM_SECURITY) ./chk build # Check this machine is OK for installing on. # DO NOT use this check from 'make install' in the parent @@ -15,7 +15,7 @@ build: # copy rather than actually installing. .PHONY: install install: - XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install + XENFB_TOOLS=$(XENFB_TOOLS) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ACM_SECURITY=$(ACM_SECURITY) ./chk install .PHONY: clean clean: diff --git a/tools/check/check_xml2 b/tools/check/check_xml2 index 782feda39e..e8def042ad 100755 --- a/tools/check/check_xml2 +++ b/tools/check/check_xml2 @@ -1,7 +1,7 @@ #!/bin/sh # CHECK-BUILD CHECK-INSTALL -if [ ! "$LIBXENAPI_BINDINGS" = "y" ] +if [ ! "$LIBXENAPI_BINDINGS" = "y" -a ! "$ACM_SECURITY" = "y" ] then echo -n "unused, " exit 0 diff --git a/tools/ioemu/hw/cirrus_vga.c b/tools/ioemu/hw/cirrus_vga.c index cc73390716..68ec0b392b 100644 --- a/tools/ioemu/hw/cirrus_vga.c +++ b/tools/ioemu/hw/cirrus_vga.c @@ -2565,7 +2565,7 @@ static void *set_vram_mapping(unsigned long begin, unsigned long end) return NULL; } - vram_pointer = xc_map_foreign_batch(xc_handle, domid, + vram_pointer = xc_map_foreign_pages(xc_handle, domid, PROT_READ|PROT_WRITE, extent_start, nr_extents); if (vram_pointer == NULL) { diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c index b1c3cca009..350a1e2e20 100644 --- a/tools/ioemu/vl.c +++ b/tools/ioemu/vl.c @@ -6948,7 +6948,7 @@ static void qemu_remap_bucket(struct map_cache *entry, j = ((i + BITS_PER_LONG) > (MCACHE_BUCKET_SIZE >> PAGE_SHIFT)) ? (MCACHE_BUCKET_SIZE >> PAGE_SHIFT) % BITS_PER_LONG : BITS_PER_LONG; while (j > 0) - word = (word << 1) | !(pfns[i + --j] & 0xF0000000UL); + word = (word << 1) | (((pfns[i + --j] >> 28) & 0xf) != 0xf); entry->valid_mapping[i / BITS_PER_LONG] = word; } } diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 13fa65ff18..ba50866b56 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -226,6 +226,39 @@ int xc_hvm_set_pci_link_route( return rc; } +void *xc_map_foreign_pages(int xc_handle, uint32_t dom, int prot, + const xen_pfn_t *arr, int num) +{ + xen_pfn_t *pfn; + void *res; + int i; + + pfn = malloc(num * sizeof(*pfn)); + if (!pfn) + return NULL; + memcpy(pfn, arr, num * sizeof(*pfn)); + + res = xc_map_foreign_batch(xc_handle, dom, prot, pfn, num); + if (res) { + for (i = 0; i < num; i++) { + if ((pfn[i] & 0xF0000000UL) == 0xF0000000UL) { + /* + * xc_map_foreign_batch() doesn't give us an error + * code, so we have to make one up. May not be the + * appropriate one. + */ + errno = EINVAL; + munmap(res, num * PAGE_SIZE); + res = NULL; + break; + } + } + } + + free(pfn); + return res; +} + /* * Local variables: * mode: C diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 0df9be8e30..8566b518f0 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -646,6 +646,14 @@ void *xc_map_foreign_range(int xc_handle, uint32_t dom, int size, int prot, unsigned long mfn ); +void *xc_map_foreign_pages(int xc_handle, uint32_t dom, int prot, + const xen_pfn_t *arr, int num ); + +/** + * Like xc_map_foreign_pages(), except it can succeeed partially. + * When a page cannot be mapped, its PFN in @arr is or'ed with + * 0xF0000000 to indicate the error. + */ void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot, xen_pfn_t *arr, int num ); diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 9947111a8b..083fd2464d 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -1594,10 +1594,10 @@ class XendDomain: raise VMBadState("Domain '%s' is not started" % domid, POWER_STATE_NAMES[DOM_STATE_RUNNING], POWER_STATE_NAMES[dominfo._stateGet()]) - if trigger_name.lower() in TRIGGER_TYPE: + if trigger_name.lower() in TRIGGER_TYPE.keys(): trigger = TRIGGER_TYPE[trigger_name.lower()] else: - raise XendError("Invalid trigger: %s", trigger_name) + raise XendError("Invalid trigger: %s" % trigger_name) try: return xc.domain_send_trigger(dominfo.getDomid(), trigger, diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 39388f1b48..20009b0760 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -602,16 +602,16 @@ class XendDomainInfo: mac = x[1] break break - dev_info = self.getDeviceInfo_vif(mac) + dev_info = self._getDeviceInfo_vif(mac) else: _, dev_info = sxprs[dev] else: # 'vbd' or 'tap' - dev_info = self.getDeviceInfo_vbd(dev) + dev_info = self._getDeviceInfo_vbd(dev) # To remove the UUID of the device from refs, # deviceClass must be always 'vbd'. deviceClass = 'vbd' if dev_info is None: - return rc + raise XendError("Device %s is not defined" % devid) dev_uuid = sxp.child_value(dev_info, 'uuid') del self.info['devices'][dev_uuid] @@ -632,14 +632,22 @@ class XendDomainInfo: dev_num += 1 return sxprs - def getDeviceInfo_vif(self, mac): + def getBlockDeviceClass(self, devid): + # To get a device number from the devid, + # we temporarily use the device controller of VBD. + dev = self.getDeviceController('vbd').convertToDeviceNumber(devid) + dev_info = self._getDeviceInfo_vbd(dev) + if dev_info: + return dev_info[0] + + def _getDeviceInfo_vif(self, mac): for dev_type, dev_info in self.info.all_devices_sxpr(): if dev_type != 'vif': continue if mac == sxp.child_value(dev_info, 'mac'): return dev_info - def getDeviceInfo_vbd(self, devid): + def _getDeviceInfo_vbd(self, devid): for dev_type, dev_info in self.info.all_devices_sxpr(): if dev_type != 'vbd' and dev_type != 'tap': continue @@ -1309,6 +1317,7 @@ class XendDomainInfo: try: new_dom = XendDomain.instance().domain_create_from_dict( self.info) + new_dom.waitForDevices() new_dom.unpause() rst_cnt = self._readVm('xend/restart_count') rst_cnt = int(rst_cnt) + 1 diff --git a/tools/python/xen/xend/server/XMLRPCServer.py b/tools/python/xen/xend/server/XMLRPCServer.py index 81a799b185..91eb21632d 100644 --- a/tools/python/xen/xend/server/XMLRPCServer.py +++ b/tools/python/xen/xend/server/XMLRPCServer.py @@ -87,7 +87,7 @@ methods = ['device_create', 'device_configure', 'destroyDevice','getDeviceSxprs', 'setMemoryTarget', 'setName', 'setVCpuCount', 'shutdown', 'send_sysrq', 'getVCPUInfo', 'waitForDevices', - 'getRestartCount'] + 'getRestartCount', 'getBlockDeviceClass'] exclude = ['domain_create', 'domain_restore'] diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 3f83e65d05..8473f8bf5b 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -2217,12 +2217,13 @@ def xm_block_detach(args): % (dev,dom)) else: arg_check(args, 'block-detach', 2, 3) - try: + dom = args[0] + dev = args[1] + dc = server.xend.domain.getBlockDeviceClass(dom, dev) + if dc == "tap": + detach(args, 'tap') + else: detach(args, 'vbd') - return - except: - pass - detach(args, 'tap') def xm_network_detach(args): if serverType == SERVER_XEN_API: diff --git a/tools/security/Makefile b/tools/security/Makefile index b31ad41ca7..4a193596d2 100644 --- a/tools/security/Makefile +++ b/tools/security/Makefile @@ -66,7 +66,7 @@ install: all $(ACM_CONFIG_FILE) $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR) $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR) ifndef XEN_PYTHON_NATIVE_INSTALL - python python/setup.py install --home="$(DESTDIR)/usr" --install-lib="$(DESTDIR)$(LIBPATH)/python" + python python/setup.py install --install-lib="$(DESTDIR)$(LIBPATH)/python" else python python/setup.py install --root="$(DESTDIR)" endif diff --git a/tools/xenfb/xenfb.c b/tools/xenfb/xenfb.c index fcc83e6355..e94e01eee4 100644 --- a/tools/xenfb/xenfb.c +++ b/tools/xenfb/xenfb.c @@ -398,21 +398,15 @@ static int xenfb_map_fb(struct xenfb_private *xenfb, int domid) if (!pgmfns || !fbmfns) goto out; - /* - * Bug alert: xc_map_foreign_batch() can fail partly and - * return a non-null value. This is a design flaw. When it - * happens, we happily continue here, and later crash on - * access. - */ xenfb_copy_mfns(mode, n_fbdirs, pgmfns, pd); - map = xc_map_foreign_batch(xenfb->xc, domid, + map = xc_map_foreign_pages(xenfb->xc, domid, PROT_READ, pgmfns, n_fbdirs); if (map == NULL) goto out; xenfb_copy_mfns(mode, n_fbmfns, fbmfns, map); munmap(map, n_fbdirs * XC_PAGE_SIZE); - xenfb->pub.pixels = xc_map_foreign_batch(xenfb->xc, domid, + xenfb->pub.pixels = xc_map_foreign_pages(xenfb->xc, domid, PROT_READ | PROT_WRITE, fbmfns, n_fbmfns); if (xenfb->pub.pixels == NULL) goto out; diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index e68004ad05..1b9b32d67d 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1878,14 +1878,14 @@ int main(int argc, char *argv[]) fflush(stdout); } - /* close stdin/stdout now we're ready to accept connections */ + /* redirect to /dev/null now we're ready to accept connections */ if (dofork) { int devnull = open("/dev/null", O_RDWR); if (devnull == -1) barf_perror("Could not open /dev/null\n"); - close(STDIN_FILENO); dup2(STDIN_FILENO, devnull); - close(STDOUT_FILENO); dup2(STDOUT_FILENO, devnull); - close(STDERR_FILENO); dup2(STDERR_FILENO, devnull); + dup2(devnull, STDIN_FILENO); + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); close(devnull); xprintf = trace; } |