Commit Graph
18 Commits
Author SHA1 Message Date
emellor@leeni.uk.xensource.com 988c0cb02e Cope when the filename returned by losetup for an existing loop device is not
fully qualified.  In this case, the readlink -f call to canonicalise that name
fails.

Closes bug #553.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-03-03 15:32:42 +01:00
emellor@leeni.uk.xensource.com 4749c682b0 Avoid a race between Xend removing the vm entries corresponding to a domain,
and the hotplug scripts checking whether that domain is still alive.  This
triggers the "xenstore-read: couldn't read path /local/domain/107/vm" message
in /var/log/xen-hotplug.log, followed by "Device XYZ is mounted in a guest
domain and so cannot be mounted now".

Closes bug #514.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-03-02 01:59:28 +01:00
emellor@leeni.uk.xensource.com 11d655cef6 Tidy up use of environment variables in xenbus-hotplug interaction.
I've changed this to only write "backend" (xenbus_backend.root) into
XENBUS_BASE_PATH.  After appending XENBUS_TYPE (also exported) you can
construct the "base path" easily in the scripts.  I've completely
removed writing XENBUS_FRONTEND_ID in favour of reading it from the
store at "$XENBUS_PATH/frontend-id".

Avoid re-reading the store over and over for the frontend domain's vm-path.

The patch also fixes a memory leak in backend_bus_id where we
leak the memory referenced by frontend if the function succeeds.

This work is by Christian Limpach.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-07 11:57:26 +00:00
emellor@leeni.uk.xensource.com a4de9a218c Further fix to same_vm check. This fixes intermittent failure of live
localhost migration.

return [ test ] is not valid, simply [ test ] at the end of the function is the
correct syntax.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-07 11:43:43 +00:00
cl349@firebug.cl.cam.ac.uk 79a13ff2fd Fix same_vm test by adding missing '$'.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-12-04 00:51:15 +01:00
emellor@leeni.uk.xensource.com ffa06621c6 Read from the store if the filename reported by losetup has been truncated (the
loop driver stores only the first 64 chars of the filename).  In this case, we
need to read through the store until we find the domain using the device, and
read the configured filename from there instead.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-03 00:51:36 +00:00
emellor@leeni.uk.xensource.com d1dd4f46f5 Fix the block-sharing check for physical devices by using a lock to serialise
the check, reading from the store rather than /sys, and checking whether the
VM for apparently-conflicting uses is actually the same (i.e. this is a
migration or a reboot in progress).

This fixes recent failures in 12_block_attach_shared_domU and recloses bug #331.

This fix includes particularly skanky path slicing inside xenbus_probe, which
it would be nice to remove very soon.

The loopback device check still suffers from the problem that filenames over
64 characters long are truncated.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-02 15:48:44 +00:00
smh22@firebug.cl.cam.ac.uk bb6d2f8575 Disable some over-zealous sanity checking for now (can cause major problems
with live migration to localhost). A proper fix will follow. 

Signed-off-by: Steven Hand <steven@xensource.com>
2005-11-29 17:59:03 +01:00
emellor@leeni.uk.xensource.com 0c63b57930 Tidy and comment use of canonicalise_mode, et al.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-29 15:01:47 +00:00
rread@ubuntu.eng.hq.xensource.com b8ae09f01c The device sharing check races when more than one file backed vbd is
configured. Both of the files pick the same free loop device in the for
loop, and then one fails to losetup.  This patch will now retry if
losetup fails until it succeeds or no more devices are available.

Signed-off-by: Robert Read <robert@xensource.com>
2005-11-28 15:34:00 -07:00
emellor@leeni.uk.xensource.com 9e1ac75bfa Added device-sharing checks for loopback-mounted files. The existing
check_sharing functions have been rejigged slightly so that the file-specific
stuff can share the code therein.  This separates the actual test from the
generation of the error message, and introduces the canonicalise_mode function.

This also restores the broken teardown functionality for file: devices -- the
writing of XENBUS_PATH/node had been removed, but this is required for file
device teardown.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-27 00:56:34 +00:00
emellor@leeni.uk.xensource.com d966085083 Check when using physical devices that the device is not already in use. Using
a device from two guests, or from dom 0 and a guest, can destroy the filesystem,
and this check prevents that.  This should ensure that the xm tests
11_block_attach_shared_dom0 and 12_block_attach_shared_domU should pass.
Closes bug #331.

Devices may be shared only if all uses are read-only.  If anyone has read-write
access to a device, then no sharing is allowed.

The mode in the config file may now have an exclamation mark appended, to
indicate that devices may be shared (i.e. that this new check should be
bypassed).  This supports some network block devices, but is clearly dangerous
and should only be used when you know what you are doing.

The mode specified in the config file is now written explicitly to the store,
To implement this, the blkback driver has been changed to create two entries
in /sys describing each device in use.  This means that we can determine which
devices are in use without crawling through the store.

The physical-device node has been changed to give the major and minor of the
device, separated by a colon.  This means that we do not need to pack these
numbers into one, removing the restriction to 8 bit minors that we had in place
before.

The mode specified in the config file is now written explicitly to the store,
rather than using the presence or absence of a read-only node.  This supports
the write-sharing override above.

If the device is in use, a new hotplug status of "busy" is written to the
store, and a message is written to a new hotplug-error node.  Xend uses these
things for diagnosis.

The block scripts do not need to handle online or offline events, so this
support has been removed.  These scripts can be called twice, depending upon
the hotplug config, so they now identify the second run and do not attempt to
set up the device again.

The device directories in the store are cleaned out before new details are
written there.  This prevents stale information from messing up block device
hotplugging.  This will be one cause of "blkback: changing physical device
not supported" messages.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-25 20:58:07 +00:00
emellor@leeni.uk.xensource.com f6d80a7f57 Reverse accidental commits for changesets 8001 and 7996-7999.
The Mercurial Queues extensions suddenly looks a lot less useful than it first
seemed.
 
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-23 19:37:33 +00:00
emellor@leeni.uk.xensource.com d64896a9f0 Merged. 2005-11-23 19:31:22 +00:00
emellor@leeni.uk.xensource.com c0efb8dc85 Rename the commands inside the hotplug scripts to match those used by hotplug
and udev.  Pass all commands through from xen-backend.agent or
xen-backend.rules rather than second-guessing the individual scripts.  This
should make it easier to tear down devices cleanly, especially the dangling
vifs we are seeing at the moment.

Cope with a missing type node inside the block script, as we don't want to
resurrect a removed node by writing a hotplug error message.

Log failure of iptables command.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-11 18:01:44 +01:00
emellor@leeni.uk.xensource.com a8a1d48e4c Break the write_dev function out from block into new block-common.sh, where it
can also be used by block-enbd and block-nbd.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-26 14:58:13 +01:00
emellor@ewan 56a738f7ff Added error logging to the block hotplug script, and support facilities for
that.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-10 14:42:38 +01:00
kaf24@firebug.cl.cam.ac.uk 44e73911fe Move the block-phy and block-file handling into a common
block script that gets called by the hotplug agent.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
2005-10-07 13:13:58 +01:00