xen/block-iscsi
Charles Arnold 5a49a4e63b - Upstream patch for python 2.7 compatibility
22045-python27-compat.patch 

Thu Nov  11 18:44:48 CST 2010 - cyliu@novell.com
- bnc#641144 - FV Xen VM running windows or linux cannot write to
  virtual floppy drive
  bdrv_default_rwflag.patch

- fate#310510 - fix xenpaging
  xenpaging.optimize_p2m_mem_paging_populate.patch
  xenpaging.HVMCOPY_gfn_paged_out.patch

- bnc#649864 - automatic numa cpu placement of xen conflicts with
  cpupools
  22326-cpu-pools-numa-placement.patch

- fate#310510 - fix xenpaging
  xenpaging.populate_only_if_paged.patch
  - revert logic, populate needs to happen unconditionally
  xenpaging.p2m_mem_paging_populate_if_p2m_ram_paged.patch
  - invalidate current mfn only if gfn is not in flight or done
  xenpaging.mem_event_check_ring-free_requests.patch
  - print info only if 1 instead of 2 slots are free
  xenpaging.guest_remove_page.patch
  - check mfn before usage in resume function
  xenpaging.machine_to_phys_mapping.patch
  - check mfn before usage in resume function

- bnc#552115 - Remove target discovery in block-iscsi

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=82
2010-11-12 17:55:23 +00:00

77 lines
2.1 KiB
Bash

#!/bin/bash
# Usage: block-iscsi [add tgtname | remove dev]
#
# This assumes you're running a correctly configured
# iscsi target (server) at the other end!
# Note that we assume that the passwords for discovery (if needed)
# are in /etc/iscsid.conf
# and the node session passwords (if required) in the
# open-iscsi database below /var/lib/open-iscsi/node.db
#
# (c) Kurt Garloff <kurt@garloff.de>, 2006-09-04, GNU GPL
# Contributors: Jim Fehlig <jfehlig@novell.com>
# Stefan de Konink <skinkie@xs4all.nl>
dir=$(dirname "$0")
. "$dir/block-common.sh"
# echo "DBG:xen/scripts/block-iscsi $1 $2 XENBUS_PATH=$XENBUS_PATH $par $node"
find_sdev()
{
unset dev
for session in /sys/class/iscsi_session/session*; do
if [ "$1" = "`cat $session/targetname 2>/dev/null`" ]; then
dev=`basename $session/device/target*/*:0:*/block*/*`
return
fi
done
}
find_sdev_rev()
{
unset tgt
for session in /sys/class/iscsi_session/session*; do
dev=`basename $session/device/target*/*:0:*/block*/*`
if [ "$dev" = "$1" ]; then
tgt=`cat $session/targetname 2>/dev/null`
return
fi
done
}
case "$command" in
add)
# load modules and start iscsid
/etc/init.d/open-iscsi status >/dev/null 2>&1 ||
{ /etc/init.d/open-iscsi start >/dev/null 2>&1; sleep 1; }
par=`xenstore-read $XENBUS_PATH/params` || true
TGTID=`echo $par | sed "s/\/\///g"`
while read rec uuid; do
if [ "$uuid" = "$TGTID" ]; then
find_sdev $TGTID
if [ -z "$dev" ]; then
/sbin/iscsiadm -m node -T $uuid -p $rec --login || exit 2
sleep 4
find_sdev $TGTID
fi
xenstore-write $XENBUS_PATH/node /dev/$dev
write_dev /dev/$dev
exit 0
fi
done < <(/sbin/iscsiadm -m node)
exit 1
;;
remove)
node=`xenstore-read $XENBUS_PATH/node` || true
dev=$node; dev=${dev#/dev/}
find_sdev_rev $dev
if [ -x /sbin/blockdev -a -n "$node" ]; then blockdev --flushbufs "$node"; fi
test -z "$tgt" && exit 2
/sbin/iscsiadm -m node -T $tgt --logout
exit 1
;;
esac