diff --git a/block-npiv b/block-npiv new file mode 100644 index 0000000..6d11784 --- /dev/null +++ b/block-npiv @@ -0,0 +1,107 @@ +#!/bin/bash + +# Usage: block-npiv [add npiv | remove dev] + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +#set -x +#command=$1 + +# Find first alive non-VHOST +find_qla() +{ + unset qla + for qla in /proc/scsi/qla2xxx/*; do + if grep -q "" $qla; then + continue + fi + if grep -q "VHOST index" $qla; then + continue + fi + return + done +} + +# Find dev for NPIV +find_sdev() +{ + unset dev + for host in /proc/scsi/qla2xxx/*; do + if grep -q $1 $host; then + h=${host##*/} + dev=`readlink /sys/class/scsi_device/$h*:0/device/block*` + dev=${dev##*/} + return + fi + done +} + +# Find host for NPIV +find_host() +{ + unset host + for host in /proc/scsi/qla2xxx/*; do + if grep -q $1 $host; then + host=${host##*/} + return + fi + done +} + +# Find NPIV for dev +find_sdev_rev() +{ + unset npiv + for host in /proc/scsi/qla2xxx/*; do + h=${host##*/} + if test ! -L /sys/class/scsi_device/$h*:0/device/block*; then + continue + fi + dev=`readlink /sys/class/scsi_device/$h*:0/device/block*` + dev=${dev##*/} + if test $dev = $1; then + npiv=`grep adapter-port= $host` + npiv=${npiv##*=} + npiv=${npiv%;} + return + fi + done +} + +find_qla +test -z "$qla" && exit 2 + +case "$command" in + add) + par=`xenstore-read $XENBUS_PATH/params` || true + #par=$2 + NPIV=$par + find_sdev $NPIV + if test -z "$dev"; then + echo "scsi-qlavportc=$NPIV" > $qla + sleep 8 + find_host $NPIV + # echo "/sys/class/scsi_host/host$host/scan" + echo "- - -" > /sys/class/scsi_host/host$host/scan + sleep 1 + find_sdev $NPIV + xenstore-write $XENBUS_PATH/node /dev/$dev + write_dev /dev/$dev + exit 0 + fi + exit 1 + ;; + remove) + node=`xenstore-read $XENBUS_PATH/node` || true + #node=$2 + dev=$node; dev=${dev#/dev/} + find_sdev_rev $dev + if test -x /sbin/blockdev -a -n "$node"; then blockdev --flushbufs $node; fi + test -z "$npiv" && exit 2 + # echo "scsi-qlavportd" > $qla + echo "scsi-qlavportd=$npiv" > $qla + sleep 4 + exit 0 + ;; +esac diff --git a/xen-warnings.diff b/xen-warnings.diff index c209055..ef85db1 100644 --- a/xen-warnings.diff +++ b/xen-warnings.diff @@ -404,3 +404,31 @@ Index: xen-3.1-testing/tools/blktap/drivers/tapdisk.c tap_fd = open(devname, O_RDWR); if (tap_fd == -1) { +Index: xen-3.1-testing/tools/libxc/xc_core.c +=================================================================== +--- xen-3.1-testing.orig/tools/libxc/xc_core.c ++++ xen-3.1-testing/tools/libxc/xc_core.c +@@ -156,7 +156,7 @@ struct xc_core_section_headers { + Elf64_Shdr *shdrs; + }; + #define SHDR_INIT 16 +-#define SHDR_INC 4 ++#define SHDR_INC 4U + + static struct xc_core_section_headers* + xc_core_shdr_init(void) +Index: xen-3.1-testing/tools/libxc/xc_dom_elfloader.c +=================================================================== +--- xen-3.1-testing.orig/tools/libxc/xc_dom_elfloader.c ++++ xen-3.1-testing/tools/libxc/xc_dom_elfloader.c +@@ -195,8 +195,9 @@ static int xc_dom_load_elf_symtab(struct + + if ( load ) + { ++ void * dst = (void*)elf_section_start(&syms, shdr); + shdr2 = elf_shdr_by_index(elf, h); +- memcpy((void*)elf_section_start(&syms, shdr), ++ memcpy(dst, + elf_section_start(elf, shdr2), + size); + } diff --git a/xen.changes b/xen.changes index 83cc9b9..c6b7ffa 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jun 18 14:23:38 MDT 2007 - ccoffing@novell.com + +- Fix compiler warnings. +- Update block-npiv. + ------------------------------------------------------------------- Mon Jun 11 10:11:00 MDT 2007 - ccoffing@novell.com diff --git a/xen.spec b/xen.spec index 6c9c88d..f70f1d5 100644 --- a/xen.spec +++ b/xen.spec @@ -35,7 +35,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit BuildRequires: kernel-source kernel-syms xorg-x11 %endif Version: 3.1.0_15042 -Release: 3 +Release: 4 License: GNU General Public License (GPL) Group: System/Kernel Autoreqprov: on @@ -51,13 +51,13 @@ Source6: init.xendomains Source7: logrotate.xend.conf Source8: domUloader.py Source9: xmexample.domUloader -Source10: block-nbd -Source11: xmexample.nbd +Source10: xmexample.disks +Source11: block-nbd Source12: block-iscsi -Source13: xmexample.iscsi -Source14: xmclone.sh -Source15: sysconfig.xend -Source16: network-multi +Source13: block-npiv +Source16: xmclone.sh +Source17: sysconfig.xend +Source18: network-multi # Upstream patches Patch0: 15048-localtime.diff Patch1: 15157_modified.patch @@ -687,7 +687,7 @@ done make -C docs install \ DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir} \ DOCDIR=%{_defaultdocdir}/xen -for name in COPYING %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE14; do +for name in COPYING %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE16; do install -m 644 $name $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/ done mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/xen/misc @@ -704,11 +704,11 @@ ln -s /etc/init.d/xendomains $RPM_BUILD_ROOT/usr/sbin/rcxendomains mkdir -p $RPM_BUILD_ROOT/etc/xen/{vm,examples} mv $RPM_BUILD_ROOT/etc/xen/xmexample* $RPM_BUILD_ROOT/etc/xen/examples rm $RPM_BUILD_ROOT/etc/xen/examples/*nbd -install -m644 %SOURCE9 %SOURCE11 %SOURCE13 $RPM_BUILD_ROOT/etc/xen/examples/ -install -m644 %SOURCE15 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend +install -m644 %SOURCE9 %SOURCE10 $RPM_BUILD_ROOT/etc/xen/examples/ +install -m644 %SOURCE17 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend # scripts rm $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd -install -m755 %SOURCE10 %SOURCE12 %SOURCE16 $RPM_BUILD_ROOT/etc/xen/scripts/ +install -m755 %SOURCE11 %SOURCE12 %SOURCE13 %SOURCE18 $RPM_BUILD_ROOT/etc/xen/scripts/ # logrotate install -m644 -D %SOURCE7 $RPM_BUILD_ROOT/etc/logrotate.d/xend # directories @@ -924,6 +924,9 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /sbin/ldconfig %changelog +* Mon Jun 18 2007 - ccoffing@novell.com +- Fix compiler warnings. +- Update block-npiv. * Mon Jun 11 2007 - ccoffing@novell.com - Fix more warn_unused_value compiler warnings. * Fri Jun 08 2007 - ccoffing@novell.com diff --git a/xmexample.disks b/xmexample.disks new file mode 100644 index 0000000..0fc37e1 --- /dev/null +++ b/xmexample.disks @@ -0,0 +1,32 @@ +# A VM's disks can be stored in a variety of ways. +# Here are some examples: +disk = [ + # Block device + 'phy:/dev/hdb,xvda,w', + # Raw format, accessed via loopback + 'file:/var/lib/xen/images/disk-example/disk0,xvdb,w', + # Raw format, accessed via blocktap + 'tap:aio:/var/lib/xen/images/disk-example/disk0,xvdc,w', + # QCOW format, accessed via blocktap + 'tap:qcow:/var/lib/xen/images/disk-example/disk0.qcow,xvdd,w', + # NBD (network block device): IP and port are separated by space + 'nbd:192.168.0.1 20004,xvde,w', + # iSCSI: The usual colon is replaced with '@' + 'iscsi:iqn.2006-09.de.suse@0ac47ee2-216e-452a-a341-a12624cd0225,xvdf,w', + # Fibre Channel N_Port ID Virtualization + 'npiv:210400e08b80c40f,xvdg,w' ] + + +# Remaining settings for the example VM: +name="disk-example" +memory=512 +vcpus=1 +on_crash="destroy" +on_poweroff="destroy" +on_reboot="restart" +localtime=0 +builder="linux" +bootloader="/usr/lib/xen/boot/domUloader.py" +bootargs="--entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen" +vif=[ 'mac=00:16:3e:00:01:02,bridge=xenbr0' ] +vfb=['type=vnc,vncunused=1'] diff --git a/xmexample.domUloader b/xmexample.domUloader index a762131..de2aeb6 100644 --- a/xmexample.domUloader +++ b/xmexample.domUloader @@ -1,150 +1,28 @@ -# -*- mode: python; -*- -#============================================================================ -# Python configuration setup for 'xm create'. -# This script sets the parameters used when a domain is created using 'xm create'. -# You use a separate script for each domain you want to create, or -# you can set the parameters for the domain on the xm command line. -#============================================================================ - -#---------------------------------------------------------------------------- -# The domain build function. Default is 'linux'. -#builder='linux' - -# Initial memory allocation (in megabytes) for the new domain. -memory = 64 - -# A name for your domain. All domains must have different names. -name = "ExampleDomain" - -# List of which CPUS this domain is allowed to use, default Xen picks -#cpus = "" # leave to Xen to pick -#cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 - -# Number of Virtual CPUS to use, default is 1 -#vcpus = 1 - -#---------------------------------------------------------------------------- -# Define network interfaces. - -# By default, no network interfaces are configured. You may have one created -# with sensible defaults using an empty vif clause: -# -# vif = [ '' ] -# -# or optionally override backend, bridge, ip, mac, script, type, or vifname: -# -# vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ] -# -# or more than one interface may be configured: -# -# vif = [ '', 'bridge=xenbr1' ] - -vif = [ '' ] - -#---------------------------------------------------------------------------- -# Define the disk devices you want the domain to have access to, and -# what you want them accessible as. -# Each disk entry is of the form phy:UNAME,DEV,MODE -# where UNAME is the device, DEV is the device name the domain will see, -# and MODE is r for read-only, w for read-write. - -disk = [ 'phy:hda1,hda1,w' ] - -# This is a bootloader used to boot paravirtualized domains. You can -# optionally plug in a different boot loader here, e.g., pygrub. There is -# usually no reason to change this. Don't use kernel and ramdisk if you -# use a bootloader. -bootloader = "/usr/lib/xen/boot/domUloader.py" +# This is a bootloader used to boot paravirtualized domains. You can optionally +# plug in a different boot loader here, e.g., pygrub. There is usually no +# reason to change this. Don't explicitly specify kernel and ramdisk if you use +# a bootloader. +bootloader="/usr/lib/xen/boot/domUloader.py" # The domUloader will pull the specified kernel and initrd out of the domU's # disk, and use that to boot. This is easier to manage, compared to manually # keeping a copy of the kernel and initrd in sync in dom0's filesystem and # pointing to them with the "kernel" and "ramdisk" parameters. Syntax is # "VDEV:KERNEL,INITRD", where VDEV is the block device (from domU's point of -# view) within which KERNEL and INITRD can be found. VDEV is optional; if it's -# not specified, the root= parameter will be evaluated, /etc/fstab from the -# root FS be consulted and a path relative to the domU root FS be used. +# view) within which KERNEL and INITRD can be found. bootentry = "hda1:/boot/vmlinuz-xen,/boot/initrd-xen" -#---------------------------------------------------------------------------- -# Define to which TPM instance the user domain should communicate. -# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM' -# where INSTANCE indicates the instance number of the TPM the VM -# should be talking to and DOM provides the domain where the backend -# is located. -# Note that no two virtual machines should try to connect to the same -# TPM instance. The handling of all TPM instances does require -# some management effort in so far that VM configration files (and thus -# a VM) should be associated with a TPM instance throughout the lifetime -# of the VM / VM configuration file. The instance number must be -# greater or equal to 1. -#vtpm = [ 'instance=1,backend=0' ] -#---------------------------------------------------------------------------- -# Set the kernel command line for the new domain. -# You only need to define the IP parameters and hostname if the domain's -# IP config doesn't, e.g. in ifcfg-eth0 or via DHCP. -# You can use 'extra' to set the runlevel and custom environment -# variables used by custom rc scripts (e.g. VMID=, usr= ). - -# Set if you want dhcp to allocate the IP address. -#dhcp="dhcp" -# Set netmask. -#netmask= -# Set default gateway. -#gateway= -# Set the hostname. -#hostname= "vm%d" % vmid - -# Set root device. -root = "/dev/hda1" - -# Root device for nfs. -#root = "/dev/nfs" -# The nfs server. -#nfs_server = '169.254.1.0' -# Root directory on the nfs server. -#nfs_root = '/full/path/to/root/directory' - -# Sets runlevel 4. -extra = "4" - -#---------------------------------------------------------------------------- -# Configure the behaviour when a domain exits. There are three 'reasons' -# for a domain to stop: poweroff, reboot, and crash. For each of these you -# may specify: -# -# "destroy", meaning that the domain is cleaned up as normal; -# "restart", meaning that a new domain is started in place of the old -# one; -# "preserve", meaning that no clean-up is done until the domain is -# manually destroyed (using xm destroy, for example); or -# "rename-restart", meaning that the old domain is not cleaned up, but is -# renamed and a new domain started in its place. -# -# The default is -# -# on_poweroff = 'destroy' -# on_reboot = 'restart' -# on_crash = 'restart' -# -# For backwards compatibility we also support the deprecated option restart -# -# restart = 'onreboot' means on_poweroff = 'destroy' -# on_reboot = 'restart' -# on_crash = 'destroy' -# -# restart = 'always' means on_poweroff = 'restart' -# on_reboot = 'restart' -# on_crash = 'restart' -# -# restart = 'never' means on_poweroff = 'destroy' -# on_reboot = 'destroy' -# on_crash = 'destroy' - -#on_poweroff = 'destroy' -#on_reboot = 'restart' -#on_crash = 'restart' - -#============================================================================ +# Remaining settings for the example VM: +name="domUloader-example" +memory=512 +vcpus=1 +on_crash="destroy" +on_poweroff="destroy" +on_reboot="restart" +localtime=0 +builder="linux" +bootargs="--entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen" +disk=[ 'file:/var/lib/xen/images/domUloader-example/disk0,xvda,w' ] +vif=[ 'mac=00:16:3e:00:01:02,bridge=xenbr0' ] +vfb=['type=vnc,vncunused=1'] diff --git a/xmexample.iscsi b/xmexample.iscsi deleted file mode 100644 index fcad6e8..0000000 --- a/xmexample.iscsi +++ /dev/null @@ -1,12 +0,0 @@ -kernel = "/boot/vmlinuz-xen" -ramdisk = "/boot/initrd-xen" -memory = 128 -name = "nbd" -# Please change MAC -vif = [ 'mac=00:16:e3:10:00:a0, bridge=xenbr0' ] -# Replaced the ':' in the iname with '@' -disk = [ 'iscsi:iqn.2006-09.de.suse@0ac47ee2-216e-452a-a341-a12624cd0225,hda,w' ] -dhcp = "dhcp" -hostname= "nbd" -root = "/dev/hda1" -extra = "3" diff --git a/xmexample.nbd b/xmexample.nbd deleted file mode 100644 index 3fd4ad2..0000000 --- a/xmexample.nbd +++ /dev/null @@ -1,12 +0,0 @@ -kernel = "/boot/vmlinuz-xen" -ramdisk = "/boot/initrd-xen" -memory = 128 -name = "nbd" -# Please change MAC -vif = [ 'mac=00:16:e3:10:00:a0, bridge=xenbr0' ] -# Please change PORT -disk = [ 'nbd:192.168.0.1 20004,hda1,w' ] -dhcp = "dhcp" -hostname= "nbd" -root = "/dev/hda1" -extra = "3"