Commit Graph
6022 Commits
Author SHA1 Message Date
Keir Fraser 9bb7f7e2ac tools: disable lomount and miniterm by default
lomount is a tool which reads and parses a partition table in a disk
image block device and then uses mount -o ...offset=... to mount it.
This is not an ideal approach.  For example, if the intended
filesystem has corrupted metadata the kernel's filesystem driver may
start to write outside of the intended region.  This might even be
exploitable in some perverse circumstances.

Nowadays people wanting to do this should use kpartx, which uses
devmapper to create appropriate range mappings.  So lomount should be
disabled.

miniterm may well be useful but it is a clone-and-hack of an upstream
project and is currently built but not installed by default, partly
because it doesn't make sense to install on the dom0 which it might be
trying to debug.

It is probably useful to retain these two programs in the source tree
but IMO they should no longer be built by default.

The attached patch does these things:
 * CONFIG_LOMOUNT and CONFIG_MINITERM in Config.mk
   can enable and disable these programs
 * They are disabled by default
 * If CONFIG_MINITERM=y it is still built but not installed.
   make -C tools/misc/miniterm install  will install it.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-17 15:18:38 +00:00
Keir Fraser d2477385df tools: LDFLAGS in link lines
LDFLAGS is not honoured by a couple of link lines in tools/*, but
should be.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-17 15:17:22 +00:00
Keir Fraser db13a968f5 network scripts: SUSE has sensible use of ifup nowadays
While wading through the patches made to Xen by OpenSUSE in their
[s]rpm, I found that they have removed various special casing for ifup
on ther distribution.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-17 15:14:17 +00:00
Keir Fraser aac518b954 tools/docs: Fix example and default IP addresses.
In various places in documentation and code, IP addresses are provided
as examples, defaults, or dummy configuration.  In general the
specific IP addresses used in Xen are not always appropriate.  (For
example, 1.2.3.4 is used in a few places!)

The following addresses should be used:
 * For examples and documentation, 192.0.2.0/24.  (See RFC3330.)
 * For defaults for private networks, a random network from RFC1918.
   I have randomly selected 172.30.206.0/24 for this purpose and
   documented this in at the only registry I know of,
   www.ucam.org/cam-grin.  This network should henceforth be used for
   default configurations of local bridges, test networks, etc. in
   Xen tools.

The following addresses should NOT be used:
 * 10.0.*.*, 10.1.*.*, 192.168.0.*, 192.168.1.*, etc.  Using these
   addresses gives greatly increased likelihood of collision, as
   ignorant network administrators and reckless middlebox vendors
   often pick networks from the bottom of 10/8 and 192.168/16.
 * 169.254.*.*.  These are reserved for zeroconf (ad-hoc networking)
   and should not be used for Xen private networks, bridges, etc.,
   etc.  Use of these addresses by Xen scripts causes trouble on hosts
   (eg laptops) which find themselves in ad-hoc networking
   environments.  I think this is not hypothetical (!) since at least
   one Linux distribution have specific code to detect this case and
   cause Xen startup to fail iff the host already has an external
   zeroconf address.
 * 1.2.3.4.  WTF !?

I have also used 127.0.255.255 in one place where apparently a dummy
address is needed (some Linux kernels won't accept a lack of an NFS
server address).  If 127.0.255.255 is mistakenly used it is unlikely
to do any damage to real traffic even if it does escape into the
network at large.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-17 15:13:40 +00:00
Keir Fraser 5564364efa libxen: Avoid declarations-after-statement (C++ coding style).
Signed-off-by: Andre Przywara <andre.przywara@amd.com>

libxen: Use build-system CFLAGS and LDFLAGS.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-01-17 15:11:22 +00:00
Keir Fraser e0413522fd hvm: Allocate an unmapped guard page to separate ordinary low RAM
from special pages (ioreq, xenstore, etc). This will stop some probe
functions (e.g., embedded in memtest) from stomping on the special
pages.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-01-17 12:59:10 +00:00
Keir Fraser 889be060b8 xenconsoled: Make slave pty raw during initialization.
(This avoids echo).

Signed-off-by: Tristan Gingold <tgingold@free.fr>
2008-01-16 13:44:18 +00:00
Keir Fraser dd8dc9533b libxen: Fix function prototype.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-15 18:48:32 +00:00
Keir Fraser 49c14d4312 xend: Remove hardcoded (and apparently unused) xend version.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2008-01-15 14:24:05 +00:00
Keir Fraser 136beff178 hvm, x86: Add QEMU BIOS menu for choosing boot device.
The attached patch implements a mini BIOS menu for choosing a
non-default
boot device. When a guest starts it'll display

   'Press F10 to select boot device'

And wait 3 seconds, before continuing with the normal boot device. If
they press the F10 key, a menu is shown allowing a choice between
floppy, harddisk, cdrom and network (PXE).

I can't take credit for this originally - Jeremy Katz wrote it for
KVM, I merely re-diffed the patch to work against Xen's QEMU/BIOS code
tree. It has been tested in Fedora successfully against 3.1.x and 3.2.x

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
CC: Jeremy Katz <katzj@redhat.com>

If more than one boot device has been selected, the currently selected
number displayed in the menu is wrong.

Signed-off-by: Stefano Stabellini <stefano.stabellini@citrix.com>
2008-01-15 14:22:50 +00:00
Keir Fraser 6aef553b66 blktap: factor out linux specific code
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-01-15 14:17:22 +00:00
Keir Fraser 9eb143df00 vmxassist: Emulate CLTS.
Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-01-11 10:59:48 +00:00
Keir Fraser 8c1b80e42d Fix network-bridge shell quoting.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-10 15:30:46 +00:00
Keir Fraser ecd285a056 [Xend] Fix 2 problems related to SR class
This fixes two problems related to the SR class:
- get_PBDs() was not implemented
- get_physical_size did not work

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-01-08 09:54:06 +00:00
Keir Fraser 83501deecf Handle netdev secondary addresses and labels
Fix the network-bridge logic to correctly transfer secondary IP
address from $netdev to $bridge.

e.g. if you add an secondary address/label/alias with:

  $> ip addr add 172.31.0.200/24 dev eth0 label eth0:00

then, "ip addr show dev eth0" gives e.g.:

  inet 172.31.0.10/24 brd 172.31.0.255 scope global eth0
  inet 172.31.0.200/24 scope global secondary eth0:00

and transfer_addrs() tries to execute:

  ip addr add 172.31.0.10/24 brd 172.31.0.255 scope global dev tmpbridge
  ip addr add 172.31.0.200/24 scope global secondary dev tmpbridge:00

which causes the sript to fail because:

  1) The device tmpbridge:00 doesn't exist
  2) The "secondary" flag isn't valid

This patch fixes the sed commands to instead give:

  ip addr add 172.31.0.10/24 brd 172.31.0.255 scope global dev tmpbridge label tmpbridge
  ip addr add 172.31.0.200/24 scope global dev tmpbridge label tmpbridge:00

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2008-01-08 09:43:44 +00:00
Keir Fraser 24895b5f9b HVM vif without bridge.
When using xen without a bridge but NAT or routing, HVM domains can't
boot, and qemu-dm-n.log contains:

config qemu network with xen bridge for  tap0 xenbr0
bridge xenbr0 does not exist!

That's because the qemu-ifup script always tries to add the vif to
a default-named xenbr0 bridge. On the contrary, PV domains just work
fine with the same configuration file except HVM parameters.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2008-01-08 09:40:33 +00:00
Keir Fraser 86d2ef9f49 vtpm: Fix GetCapabilityOwner function
GetCapabilityOwner function's behavior is different from that of a
real tpm device. By the difference, a TPM Manager in an HVM domain
could not detect whether TPM device has an owner or not.

Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>
2007-12-29 17:52:34 +00:00
Keir Fraser 0f8fcbcca3 xentrace bug fix: data format of hvmtrace is changed.
Signed-off-by: Disheng Su <disheng.su@intel.com>
2007-12-28 15:27:53 +00:00
Keir Fraser f8dc2a2051 x86, hvm, rombios: INT13 LBA48 support for disks bigger than 128GB.
The new limit should be 2TB.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-12-27 13:00:40 +00:00
Keir Fraser dc5719607e Fix pygrub handling of many kernels
If there are a large number of kernel images configured in grub.conf
there will be too many to fit in the limited size pygrub display. This
patch fixes this so that the list of kernels scrolls as needed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-12-27 12:56:32 +00:00
Keir Fraser e2d6a0473b libxc: Fix xc_domain_bind_pt_irq().
Signed-off-by: Guy Zana <guy@neocleus.com>
2007-12-27 12:30:44 +00:00
Keir Fraser fa7a56b7fa tapaio check return value from read()
In tools/blktap/drivers/tapaio.c there is a call to read(2) whose
return value is not checked.  The attached patch attempts to do
something vaguely sensible in cases of error.

Fully comprehensive error handling in this area would be quite tough
to introduce now but at least with this change when things go wrong
you stand a chance of getting some information about what happened.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-27 12:28:58 +00:00
Keir Fraser 819571016f Fix xend xenstore handling.
xend can get into a situation where two processes are attempting to
interact with the xenstore socket, with disastrous results. Fix the
two bad users of xstransact, add a big warning, and fix the destructor
so future mistakes will be detected earlier.

Signed-off-by: John Levon <john.levon@sun.com>
2007-12-27 12:27:34 +00:00
Keir Fraser 3a50e363b4 [qemu-dm] Fix debugging output in tpm tis model
This fixes the debugging output.
Also I am tweaking on the code trying to establish a connection with
the external vTPM.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-12-20 16:52:44 +00:00
Keir Fraser 1f7f827c82 Xend: don't check for device reuse if the device has no uname.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2007-12-20 13:48:27 +00:00
Keir Fraser 53f48ca221 Fix some build system error handling.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-20 13:16:21 +00:00
Keir Fraser b8af4123ed hvm: Fix TPMD and QEMU connection
In HVM domain, MA_Transmit function in tcgbios sometimes become an
error (TCG_NO_RESPONSE). The cause of the error is not to make
connection of QEMU and TPMD instance within a timeout of MA_Transmit
function.

Before the MA_Transmit function was called, the attached patch
corrected so that connection of QEMU and TPMD might be completed.

Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>
2007-12-20 10:43:06 +00:00
Keir Fraser bbe568ca78 ioemu: Do not close slave half of a pty.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-12-20 10:35:22 +00:00
Keir Fraser db9b8625cc tools/examples/block better use of losetup -r
Use losetup -r when the vbd is specified to be readonly, but only if
-r is supported (rather than always creating a writeable losetup
mapping if possible).

This was inspired by (but not derived from) a diff from the Fedora 8
patchset which uses -r iff the vbd is specified as readonly.  We need
to be cleverer upstream because not all systems have losetup -r.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-19 15:05:15 +00:00
Keir Fraser f28baafaaf xend: Fix device duplicate check.
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2007-12-19 14:51:02 +00:00
Keir Fraser add89911d2 xend: Fix PCI Device Configuration
Xend doesn't correctly work after restart, when there is a domU which
owns a pci device (driver domain). This patch fixes the problem.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2007-12-19 14:50:37 +00:00
Keir Fraser 25d73306ec Fix master/slave handling in xenconsoled and qemu
Fix a number of problems with the pty handling:

- make openpty() implementation work on Solaris
- set raw on the slave fd, not the master, as the master doesn't
  have a line discipline pushed on Solaris
- make sure we don't leak the slave fd returned from openpty()
- don't use the 'name' argument of openpty() as it's a security risk
- note behaviour of a zero read of the master on Solaris
- remove pointless tcget/setattr

Signed-off-by: John Levon <john.levon@sun.com>
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
2007-12-19 14:45:45 +00:00
Keir Fraser 2578655c64 xend: Indicate a resume operation
Indicate that the domain is created as part of a resume operation
rather than a 'create'.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-12-19 14:45:04 +00:00
Keir Fraser 9d379685d6 xend: Prevent XenD touching externally managed bridges
With current XenD 3.0.4 or later try the following:

    brctl addbr demo
    ifconfig demo up

    /etc/init.d/xend start
    /etc/init.d/xend stop

    ifconfig demo down
    brctl delbr demo

Now, start XenD again....

    /etc/init.d/xend start

And watch in horror as it re-creates your 'demo' bridge.

The problem is that the 'XendNetwork' class does not distinguish
between bridge devices that it is managing (ie those created via
XenAPI) and those which it does not manage (ie those created by OS
distro init scripts, or by apps like  libvirt).

While initially I thought I could just make XenD ignore
externally-managed bridges completely, it seems to needs to know about
them otherwise it can't hook up guest VIFs to them correctly. So the
attached patch adds a 'managed' flag to the XendNetwork
class. Externally managed bridges have this set to False. At startup
XenD will now only re-create bridge devices which have the 'managed'
flag set to 'True'  - ie those created via XenAPI.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-12-15 18:26:52 +00:00
Alex Williamson 0cc375e055 merge with xen-unstable.hg (staging) 2007-12-14 10:12:40 -07:00
Keir Fraser 80197aaf42 acm, xend: Serialize the execution of external scripts.
Instead of starting a thread per script, run a single thread and send
orders to it. This serializes the execution of the scripts.

Signed-off-by: Stefan Berger <stefanB@us.ibm.com>
2007-12-14 10:26:11 +00:00
Keir Fraser 8b1031d446 xsm: Implement missing functions in XSM dummy module
I am implementing some missing interface functions in the XSM dummy
module. Also deactivating some debugging output.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-12-14 10:17:50 +00:00
Keir Fraser 891143e321 tools: Some fixes for 'make clean'.
Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com>
2007-12-14 10:16:52 +00:00
Keir Fraser 625a82b59c xenstore size limits
* Documents the existing 4kby size limit on xenstore message payloads
 * Causes xs.c in libxenstore to fail locally rather than violating
   said limit (which is good because xenstored kills the client
   connection if it's exceeded).
 * Introduces some limits on path lengths in xenstored.  I trust
   no-one is using path lengths >2kby.  This is good because currently
   a domain client can create a 4kby relative path that the dom0 tools
   cannot access since they'd have to specify the somewhat longer
   absolute path.
 * Removes uses of the host's PATH_MAX (!)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-14 10:15:00 +00:00
Alex Williamson c647421aa8 [IA64] Fix XenITP build
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
2007-12-13 09:07:55 -07:00
Keir Fraser 2d9284c4a5 ioemu/qemu vga: save and restore vram buffer (take 2)
The existing stdvga driver from xen-unstable tools/ioemu/hw/vga* does
not save the emulated VGA memory contents.  The symptoms include video
malfunction after restore, including black screen (which can often be
fixed by asking the guest to redraw) but also missing font setup etc.
The attached patch fixes this by saving the entire VGA memory buffer,
just like the Xen ioemu Cirrus emulator does.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-12 12:02:01 +00:00
Keir Fraser 8e7e63dc88 Revert 16579:0884e0a5ecc33afac8d60ea09652cf436d1a33ce. 2007-12-12 12:00:46 +00:00
Keir Fraser aa54a5e57e Fix build after I removed test_assign_device from domctl union.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2007-12-12 10:38:14 +00:00
Keir Fraser 239ad70fb2 vt-d: Test device assignability in xend, but defer actual assignment to qemu-dm.
Signed-off-by: Weidong Han <weidong.han@intel.com>
2007-12-12 10:29:35 +00:00
Keir Fraser 05fcdea668 ia64, xend: Close nvram file when rebooting HVM domain
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2007-12-12 10:08:54 +00:00
Keir Fraser 1a0a31cbc6 xend: Fix cleanup_domains() for suspending managed domains
When unmanaged domains with on_xend_stop="suspend" exist, managed
domains are not suspended by xend stop command.  The processing of
cleanup_domains() is aborted by exception. This patch keeps suspending
managed domains even if unmanaged domains exist.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2007-12-12 10:08:14 +00:00
Keir Fraser c3711577c1 tools: Fix distutils installation of xsview.
Distutils won't install xsview unless it has an __init__.py.  This
patch adds an empty one, which is all that is required.

Signed-off-by: Mark Williamson <mark.williamson@cl.cam.ac.uk>
2007-12-12 10:05:53 +00:00
Keir Fraser 9b64cdda45 tools: Use os.system instead of exec to start xentop.
This makes no difference to the visible behaviour of "xm top" but
avoids the whole of xm from quitting if you're in "xm shell".  This
provides the more intuitive behaviour of returning to the xm shell
interface after leaving xm top.

Signed-off-by: Mark Williamson <mark.williamson@cl.cam.ac.uk>
2007-12-12 10:04:29 +00:00
Keir Fraser 012e2baf87 tools: Remove references to USB paravirt driver. Doesn't affect qemu usb args.
Some relics in the control tools still refer to the USB paravirt
driver.  Remove this as it's dead code and is in the history for
anyone really interested. The Qemu device model has its own USB
configuration, which should still work.

Signed-off-by: Mark Williamson <mark.williamson@cl.cam.ac.uk>
2007-12-12 10:03:32 +00:00
Keir Fraser 7d6b2ecfac xend, acm: Extend Xen-API with function to reset the policy
This patch extends the Xen-API and the legacy XML-RPC interface with a
function to reset the policy on the system (through an update with the
default policy). I adapted the code in 'xm resetpolicy' to use this
now.

This patch also extends libxen and the documentation to reflect the
new function.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-12-12 09:57:55 +00:00