OBS User unknown 2008-02-02 00:58:27 +00:00 committed by Git OBS Bridge
parent 622c859b48
commit 3c15755877
44 changed files with 4840 additions and 2385 deletions

42
16716-xend-version.patch Normal file
View File

@ -0,0 +1,42 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1200407045 0
# Node ID b64be2bc7a91c004982b0ddba0c644744f944141
# Parent e6e165f72e571c12f671c6ad8a70acf8d8090852
xend: Remove hardcoded (and apparently unused) xend version.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r e6e165f72e57 -r b64be2bc7a91 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Tue Jan 15 14:22:50 2008 +0000
+++ b/tools/python/xen/xend/XendNode.py Tue Jan 15 14:24:05 2008 +0000
@@ -377,13 +377,7 @@ class XendNode:
def xen_version(self):
info = self.xc.xeninfo()
- try:
- from xen import VERSION
- info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
- 'Xend': VERSION}
- except (ImportError, AttributeError):
- info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info,
- 'Xend': '3.0.3'}
+ info = {'Xen': '%(xen_major)d.%(xen_minor)d' % info}
# Add xend_config_format
info.update(self.xendinfo_dict())
diff -r e6e165f72e57 -r b64be2bc7a91 tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py Tue Jan 15 14:22:50 2008 +0000
+++ b/tools/python/xen/xend/server/SrvDaemon.py Tue Jan 15 14:24:05 2008 +0000
@@ -335,12 +335,6 @@ class Daemon:
log.info("Xend changeset: %s.", xinfo['xen_changeset'])
del xc
- try:
- from xen import VERSION
- log.info("Xend version: %s", VERSION)
- except ImportError:
- log.info("Xend version: Unknown.")
-
relocate.listenRelocation()
servers = SrvServer.create()
servers.start(status)

View File

@ -0,0 +1,367 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1200407535 0
# Node ID fba4e7357744e96797916689e3274344b82a8e5f
# Parent 58dfcad8d56d3ebad2e8553c43db499ce727cb36
x86: Allow batched mmu updates which preserve accessed/dirty pte bits.
Signed-off-by: Bruce Rogers <brogers@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-3.2-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm.c
+++ xen-3.2-testing/xen/arch/x86/mm.c
@@ -1342,21 +1342,30 @@ static inline int update_intpte(intpte_t
intpte_t old,
intpte_t new,
unsigned long mfn,
- struct vcpu *v)
+ struct vcpu *v,
+ int preserve_ad)
{
int rv = 1;
#ifndef PTE_UPDATE_WITH_CMPXCHG
- rv = paging_write_guest_entry(v, p, new, _mfn(mfn));
-#else
+ if ( !preserve_ad )
+ {
+ rv = paging_write_guest_entry(v, p, new, _mfn(mfn));
+ }
+ else
+#endif
{
intpte_t t = old;
for ( ; ; )
{
- rv = paging_cmpxchg_guest_entry(v, p, &t, new, _mfn(mfn));
+ intpte_t _new = new;
+ if ( preserve_ad )
+ _new |= old & (_PAGE_ACCESSED | _PAGE_DIRTY);
+
+ rv = paging_cmpxchg_guest_entry(v, p, &t, _new, _mfn(mfn));
if ( unlikely(rv == 0) )
{
MEM_LOG("Failed to update %" PRIpte " -> %" PRIpte
- ": saw %" PRIpte, old, new, t);
+ ": saw %" PRIpte, old, _new, t);
break;
}
@@ -1369,20 +1378,19 @@ static inline int update_intpte(intpte_t
old = t;
}
}
-#endif
return rv;
}
/* Macro that wraps the appropriate type-changes around update_intpte().
* Arguments are: type, ptr, old, new, mfn, vcpu */
-#define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v) \
+#define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v,_ad) \
update_intpte(&_t ## e_get_intpte(*(_p)), \
_t ## e_get_intpte(_o), _t ## e_get_intpte(_n), \
- (_m), (_v))
+ (_m), (_v), (_ad))
/* Update the L1 entry at pl1e to new value nl1e. */
static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e,
- unsigned long gl1mfn)
+ unsigned long gl1mfn, int preserve_ad)
{
l1_pgentry_t ol1e;
struct vcpu *curr = current;
@@ -1393,7 +1401,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
return 0;
if ( unlikely(paging_mode_refcounts(d)) )
- return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr);
+ return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, preserve_ad);
if ( l1e_get_flags(nl1e) & _PAGE_PRESENT )
{
@@ -1415,12 +1423,14 @@ static int mod_l1_entry(l1_pgentry_t *pl
/* Fast path for identical mapping, r/w and presence. */
if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) )
- return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr);
+ return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
+ preserve_ad);
if ( unlikely(!get_page_from_l1e(nl1e, FOREIGNDOM)) )
return 0;
- if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
+ preserve_ad)) )
{
put_page_from_l1e(nl1e, d);
return 0;
@@ -1428,7 +1438,8 @@ static int mod_l1_entry(l1_pgentry_t *pl
}
else
{
- if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
+ preserve_ad)) )
return 0;
}
@@ -1441,7 +1452,8 @@ static int mod_l1_entry(l1_pgentry_t *pl
static int mod_l2_entry(l2_pgentry_t *pl2e,
l2_pgentry_t nl2e,
unsigned long pfn,
- unsigned long type)
+ unsigned long type,
+ int preserve_ad)
{
l2_pgentry_t ol2e;
struct vcpu *curr = current;
@@ -1469,18 +1481,20 @@ static int mod_l2_entry(l2_pgentry_t *pl
/* Fast path for identical mapping and presence. */
if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT))
- return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr);
+ return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, preserve_ad);
if ( unlikely(!get_page_from_l2e(nl2e, pfn, d)) )
return 0;
- if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr,
+ preserve_ad)) )
{
put_page_from_l2e(nl2e, pfn);
return 0;
}
}
- else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) )
+ else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr,
+ preserve_ad)) )
{
return 0;
}
@@ -1494,7 +1508,8 @@ static int mod_l2_entry(l2_pgentry_t *pl
/* Update the L3 entry at pl3e to new value nl3e. pl3e is within frame pfn. */
static int mod_l3_entry(l3_pgentry_t *pl3e,
l3_pgentry_t nl3e,
- unsigned long pfn)
+ unsigned long pfn,
+ int preserve_ad)
{
l3_pgentry_t ol3e;
struct vcpu *curr = current;
@@ -1532,18 +1547,20 @@ static int mod_l3_entry(l3_pgentry_t *pl
/* Fast path for identical mapping and presence. */
if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT))
- return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr);
+ return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, preserve_ad);
if ( unlikely(!get_page_from_l3e(nl3e, pfn, d)) )
return 0;
- if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr,
+ preserve_ad)) )
{
put_page_from_l3e(nl3e, pfn);
return 0;
}
}
- else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) )
+ else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr,
+ preserve_ad)) )
{
return 0;
}
@@ -1564,7 +1581,8 @@ static int mod_l3_entry(l3_pgentry_t *pl
/* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */
static int mod_l4_entry(l4_pgentry_t *pl4e,
l4_pgentry_t nl4e,
- unsigned long pfn)
+ unsigned long pfn,
+ int preserve_ad)
{
struct vcpu *curr = current;
struct domain *d = curr->domain;
@@ -1592,18 +1610,20 @@ static int mod_l4_entry(l4_pgentry_t *pl
/* Fast path for identical mapping and presence. */
if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT))
- return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr);
+ return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, preserve_ad);
if ( unlikely(!get_page_from_l4e(nl4e, pfn, d)) )
return 0;
- if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr,
+ preserve_ad)) )
{
put_page_from_l4e(nl4e, pfn);
return 0;
}
}
- else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) )
+ else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr,
+ preserve_ad)) )
{
return 0;
}
@@ -1946,7 +1966,7 @@ int new_guest_cr3(unsigned long mfn)
l4e_from_pfn(
mfn,
(_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
- pagetable_get_pfn(v->arch.guest_table));
+ pagetable_get_pfn(v->arch.guest_table), 0);
if ( unlikely(!okay) )
{
MEM_LOG("Error while installing new compat baseptr %lx", mfn);
@@ -2458,13 +2478,16 @@ int do_mmu_update(
{
/*
* MMU_NORMAL_PT_UPDATE: Normal update to any level of page table.
+ * MMU_UPDATE_PT_PRESERVE_AD: As above but also preserve (OR)
+ * current A/D bits.
*/
case MMU_NORMAL_PT_UPDATE:
-
+ case MMU_PT_UPDATE_PRESERVE_AD:
rc = xsm_mmu_normal_update(d, req.val);
if ( rc )
break;
+ req.ptr -= cmd;
gmfn = req.ptr >> PAGE_SHIFT;
mfn = gmfn_to_mfn(d, gmfn);
@@ -2501,20 +2524,23 @@ int do_mmu_update(
case PGT_l1_page_table:
{
l1_pgentry_t l1e = l1e_from_intpte(req.val);
- okay = mod_l1_entry(va, l1e, mfn);
+ okay = mod_l1_entry(va, l1e, mfn,
+ cmd == MMU_PT_UPDATE_PRESERVE_AD);
}
break;
case PGT_l2_page_table:
{
l2_pgentry_t l2e = l2e_from_intpte(req.val);
- okay = mod_l2_entry(va, l2e, mfn, type_info);
+ okay = mod_l2_entry(va, l2e, mfn, type_info,
+ cmd == MMU_PT_UPDATE_PRESERVE_AD);
}
break;
#if CONFIG_PAGING_LEVELS >= 3
case PGT_l3_page_table:
{
l3_pgentry_t l3e = l3e_from_intpte(req.val);
- okay = mod_l3_entry(va, l3e, mfn);
+ okay = mod_l3_entry(va, l3e, mfn,
+ cmd == MMU_PT_UPDATE_PRESERVE_AD);
}
break;
#endif
@@ -2522,7 +2548,8 @@ int do_mmu_update(
case PGT_l4_page_table:
{
l4_pgentry_t l4e = l4e_from_intpte(req.val);
- okay = mod_l4_entry(va, l4e, mfn);
+ okay = mod_l4_entry(va, l4e, mfn,
+ cmd == MMU_PT_UPDATE_PRESERVE_AD);
}
break;
#endif
@@ -2652,7 +2679,7 @@ static int create_grant_pte_mapping(
}
ol1e = *(l1_pgentry_t *)va;
- if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v) )
+ if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v, 0) )
{
put_page_type(page);
rc = GNTST_general_error;
@@ -2720,9 +2747,11 @@ static int destroy_grant_pte_mapping(
}
/* Delete pagetable entry. */
- if ( unlikely(!UPDATE_ENTRY(l1,
- (l1_pgentry_t *)va, ol1e, l1e_empty(), mfn,
- d->vcpu[0] /* Change if we go to per-vcpu shadows. */)) )
+ if ( unlikely(!UPDATE_ENTRY
+ (l1,
+ (l1_pgentry_t *)va, ol1e, l1e_empty(), mfn,
+ d->vcpu[0] /* Change if we go to per-vcpu shadows. */,
+ 0)) )
{
MEM_LOG("Cannot delete PTE entry at %p", va);
put_page_type(page);
@@ -2758,7 +2787,7 @@ static int create_grant_va_mapping(
return GNTST_general_error;
}
ol1e = *pl1e;
- okay = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v);
+ okay = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v, 0);
guest_unmap_l1e(v, pl1e);
pl1e = NULL;
@@ -2796,7 +2825,7 @@ static int replace_grant_va_mapping(
}
/* Delete pagetable entry. */
- if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v)) )
+ if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v, 0)) )
{
MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
rc = GNTST_general_error;
@@ -2860,7 +2889,8 @@ int replace_grant_host_mapping(
}
ol1e = *pl1e;
- if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(), gl1mfn, curr)) )
+ if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(),
+ gl1mfn, curr, 0)) )
{
MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
guest_unmap_l1e(curr, pl1e);
@@ -2948,7 +2978,7 @@ int do_update_va_mapping(unsigned long v
pl1e = guest_map_l1e(v, va, &gl1mfn);
- if ( unlikely(!pl1e || !mod_l1_entry(pl1e, val, gl1mfn)) )
+ if ( unlikely(!pl1e || !mod_l1_entry(pl1e, val, gl1mfn, 0)) )
rc = -EINVAL;
if ( pl1e )
@@ -3517,7 +3547,7 @@ static int ptwr_emulated_update(
else
{
ol1e = *pl1e;
- if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, mfn, v) )
+ if ( !UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, mfn, v, 0) )
BUG();
}
Index: xen-3.2-testing/xen/include/public/xen.h
===================================================================
--- xen-3.2-testing.orig/xen/include/public/xen.h
+++ xen-3.2-testing/xen/include/public/xen.h
@@ -168,9 +168,14 @@
* ptr[:2] -- Machine address within the frame whose mapping to modify.
* The frame must belong to the FD, if one is specified.
* val -- Value to write into the mapping entry.
- */
-#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
-#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
+ *
+ * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
+ * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
+ * with those in @val.
+ */
+#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
+#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
+#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
/*
* MMU EXTENDED OPERATIONS

View File

@ -0,0 +1,31 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1200995509 0
# Node ID 6f3fb3f86b68182bb61a661e81f346f653005852
# Parent 2af5fb3e34e54e96d0c58e0e4557ee1240df9ce8
xend: On block-attach, remove device information when VmError occurs.
I tested xm block-attach command with a wrong
parameter(file:). Naturally a command error occurred. Then I retested
xm block-attach command with a correct parameter(phy:). But a command
error occurred again. The second command error occurred because Xend
did not remove device information from self.info when the first
command error occurred.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
diff -r 2af5fb3e34e5 -r 6f3fb3f86b68 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue Jan 22 09:50:06 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Jan 22 09:51:49 2008 +0000
@@ -535,6 +535,11 @@ class XendDomainInfo:
self._createDevice(dev_type, dev_config_dict)
self._waitForDevice(dev_type, devid)
except VmError, ex:
+ del self.info['devices'][dev_uuid]
+ if dev_type == 'tap':
+ self.info['vbd_refs'].remove(dev_uuid)
+ else:
+ self.info['%s_refs' % dev_type].remove(dev_uuid)
raise ex
else:
devid = None

129
16873-net-nat.patch Normal file
View File

@ -0,0 +1,129 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201185473 0
# Node ID 86c32269ba604f968c7abe5cf7360d7c00902ff8
# Parent 1190d50ce18c5a8237fc592d59cff8396bc435c5
network-nat: Fix NAT scripts.
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Index: xen-3.2-testing/tools/examples/network-nat
===================================================================
--- xen-3.2-testing.orig/tools/examples/network-nat
+++ xen-3.2-testing/tools/examples/network-nat
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
#============================================================================
# Default Xen network start/stop script when using NAT.
# Xend calls a network script when it starts.
@@ -27,7 +27,15 @@ evalVariables "$@"
netdev=${netdev:-eth0}
# antispoofing not yet implemented
antispoof=${antispoof:-no}
-dhcp=${dhcp:-no}
+
+# turn on dhcp feature by default if dhcpd is installed
+if [ -f /etc/dhcpd.conf ]
+then
+ dhcp=${dhcp:-yes}
+else
+ dhcp=${dhcp:-no}
+fi
+
if [ "$dhcp" != 'no' ]
then
Index: xen-3.2-testing/tools/examples/vif-nat
===================================================================
--- xen-3.2-testing.orig/tools/examples/vif-nat
+++ xen-3.2-testing/tools/examples/vif-nat
@@ -28,15 +28,22 @@
dir=$(dirname "$0")
. "$dir/vif-common.sh"
-dhcp=${dhcp:-no}
+# turn on dhcp feature by default if dhcpd is installed
+if [ -f /etc/dhcpd.conf ]
+then
+ dhcp=${dhcp:-yes}
+else
+ dhcp=${dhcp:-no}
+fi
if [ "$dhcp" != 'no' ]
then
dhcpd_conf_file=$(find_dhcpd_conf_file)
dhcpd_init_file=$(find_dhcpd_init_file)
- if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ]
+ dhcpd_arg_file=$(find_dhcpd_arg_file)
+ if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] || [ -z "$dhcpd_arg_file" ]
then
- echo 'Failed to find dhcpd configuration or init file.' >&2
+ echo 'Failed to find dhcpd configuration or init or args file.' >&2
exit 1
fi
fi
@@ -88,6 +95,31 @@ then
hostname="$hostname-$vifid"
fi
+dhcparg_remove_entry()
+{
+ local tmpfile=$(mktemp)
+ sed -e "s/$vif //" "$dhcpd_arg_file" >"$tmpfile"
+ if diff "$tmpfile" "$dhcpd_arg_file" >/dev/null
+ then
+ rm "$tmpfile"
+ else
+ mv "$tmpfile" "$dhcpd_arg_file"
+ fi
+}
+
+dhcparg_add_entry()
+{
+ dhcparg_remove_entry
+ local tmpfile=$(mktemp)
+ # handle Red Hat, SUSE, and Debian styles, with or without quotes
+ sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"$vif "'"/' \
+ "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
+ sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"$vif "'"/' \
+ "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
+ sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"$vif "'"/' \
+ "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file"
+ rm -f "$tmpfile"
+}
dhcp_remove_entry()
{
@@ -99,6 +131,7 @@ dhcp_remove_entry()
else
mv "$tmpfile" "$dhcpd_conf_file"
fi
+ dhcparg_remove_entry
}
@@ -109,6 +142,7 @@ dhcp_up()
mac=$(xenstore_read "$XENBUS_PATH/mac")
echo >>"$dhcpd_conf_file" \
"host $hostname { hardware ethernet $mac; fixed-address $vif_ip; option routers $router_ip; option host-name \"$hostname\"; }"
+ dhcparg_add_entry
release_lock "vif-nat-dhcp"
"$dhcpd_init_file" restart || true
}
Index: xen-3.2-testing/tools/examples/xen-network-common.sh
===================================================================
--- xen-3.2-testing.orig/tools/examples/xen-network-common.sh
+++ xen-3.2-testing/tools/examples/xen-network-common.sh
@@ -89,6 +89,11 @@ find_dhcpd_init_file()
first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd}
}
+find_dhcpd_arg_file()
+{
+ first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp
+}
+
# configure interfaces which act as pure bridge ports:
setup_bridge_port() {
local dev="$1"

32
16877-blktap.patch Normal file
View File

@ -0,0 +1,32 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201185686 0
# Node ID 31adb5c972d03e45cb746cd2305126ea2571282f
# Parent 6269a3ce7b830f6903a61e1116331590b47f7e99
block scripts: use fatal() in xen-hotplug-common.sh if the file does not exist.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
diff -r 6269a3ce7b83 -r 31adb5c972d0 tools/examples/blktap
--- a/tools/examples/blktap Thu Jan 24 14:40:35 2008 +0000
+++ b/tools/examples/blktap Thu Jan 24 14:41:26 2008 +0000
@@ -71,9 +71,9 @@ fi
fi
# some versions of readlink cannot be passed a regular file
if [ -L "$p" ]; then
- file=$(readlink -f "$p") || ebusy "$p link does not exist."
+ file=$(readlink -f "$p") || fatal "$p link does not exist."
else
- [ -f "$p" ] || { ebusy "$p file does not exist."; }
+ [ -f "$p" ] || { fatal "$p file does not exist."; }
file="$p"
fi
@@ -85,7 +85,7 @@ fi
if [ "$command" = 'add' ]
then
- [ -e "$file" ] || { ebusy $file does not exist; }
+ [ -e "$file" ] || { fatal $file does not exist; }
success
fi

View File

@ -0,0 +1,209 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201267705 0
# Node ID 666573856c5928371435b72d907dd7f06965965f
# Parent b321ef006189e10d3b733747f508b1fb608810e9
(Re)introduce notion of crashed VM power state.
The crashed power state is necessary to allow both core-dumping a
crashed but preserved VM and renaming/restarting a crashed VM.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.2-testing/docs/xen-api/vm-lifecycle.tex
===================================================================
--- xen-3.2-testing.orig/docs/xen-api/vm-lifecycle.tex
+++ xen-3.2-testing/docs/xen-api/vm-lifecycle.tex
@@ -21,7 +21,10 @@
\end{figure}
Figure~\ref{fig-vm-lifecycle} shows the states that a VM can be in
-and the API calls that can be used to move the VM between these states.
+and the API calls that can be used to move the VM between these states. The crashed
+state indicates that the guest OS running within the VM has crashed. There is no
+API to explicitly move to the crashed state, however a hardShutdown will move the
+VM to the powered down state.
\section{VM boot parameters}
Index: xen-3.2-testing/docs/xen-api/vm_lifecycle.dot
===================================================================
--- xen-3.2-testing.orig/docs/xen-api/vm_lifecycle.dot
+++ xen-3.2-testing/docs/xen-api/vm_lifecycle.dot
@@ -1,6 +1,6 @@
digraph g{
-node [shape=box]; "powered down" paused running suspended;
+node [shape=box]; "powered down" paused running suspended crashed;
"powered down" -> paused [label="start(paused=true)"];
"powered down" -> running [label="start(paused=false)"];
@@ -11,5 +11,7 @@ paused -> suspended [label="suspend"];
paused -> running [label="resume"];
running -> "powered down" [label="cleanShutdown /\nhardShutdown"];
running -> paused [label="pause"];
+running -> crashed [label="guest OS crash"]
+crashed -> "powered down" [label="hardShutdown"]
}
\ No newline at end of file
Index: xen-3.2-testing/docs/xen-api/xenapi-datamodel.tex
===================================================================
--- xen-3.2-testing.orig/docs/xen-api/xenapi-datamodel.tex
+++ xen-3.2-testing/docs/xen-api/xenapi-datamodel.tex
@@ -156,6 +156,7 @@ The following enumeration types are used
\hspace{0.5cm}{\tt Paused} & Paused \\
\hspace{0.5cm}{\tt Running} & Running \\
\hspace{0.5cm}{\tt Suspended} & Suspended \\
+\hspace{0.5cm}{\tt Crashed} & Crashed \\
\hspace{0.5cm}{\tt Unknown} & Some other unknown state \\
\hline
\end{longtable}
Index: xen-3.2-testing/tools/libxen/include/xen/api/xen_vm_power_state.h
===================================================================
--- xen-3.2-testing.orig/tools/libxen/include/xen/api/xen_vm_power_state.h
+++ xen-3.2-testing/tools/libxen/include/xen/api/xen_vm_power_state.h
@@ -46,6 +46,11 @@ enum xen_vm_power_state
XEN_VM_POWER_STATE_SUSPENDED,
/**
+ * Crashed
+ */
+ XEN_VM_POWER_STATE_CRASHED,
+
+ /**
* Some other unknown state
*/
XEN_VM_POWER_STATE_UNKNOWN
Index: xen-3.2-testing/tools/libxen/src/xen_vm_power_state.c
===================================================================
--- xen-3.2-testing.orig/tools/libxen/src/xen_vm_power_state.c
+++ xen-3.2-testing/tools/libxen/src/xen_vm_power_state.c
@@ -32,6 +32,7 @@ static const char *lookup_table[] =
"Paused",
"Running",
"Suspended",
+ "Crashed",
"Unknown"
};
Index: xen-3.2-testing/tools/python/xen/xend/XendAPIConstants.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendAPIConstants.py
+++ xen-3.2-testing/tools/python/xen/xend/XendAPIConstants.py
@@ -25,6 +25,7 @@ XEN_API_VM_POWER_STATE = [
'Running',
'Suspended',
'Halted',
+ 'Crashed',
'Unknown'
]
@@ -33,7 +34,8 @@ XEN_API_VM_POWER_STATE_PAUSED = 1
XEN_API_VM_POWER_STATE_RUNNING = 2
XEN_API_VM_POWER_STATE_SUSPENDED = 3
XEN_API_VM_POWER_STATE_SHUTTINGDOWN = 4
-XEN_API_VM_POWER_STATE_UNKNOWN = 5
+XEN_API_VM_POWER_STATE_CRASHED = 5
+XEN_API_VM_POWER_STATE_UNKNOWN = 6
XEN_API_ON_NORMAL_EXIT = [
'destroy',
Index: xen-3.2-testing/tools/python/xen/xend/XendConstants.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendConstants.py
+++ xen-3.2-testing/tools/python/xen/xend/XendConstants.py
@@ -61,6 +61,7 @@ DOM_STATES = [
'running',
'suspended',
'shutdown',
+ 'crashed',
'unknown',
]
@@ -69,6 +70,7 @@ DOM_STATE_PAUSED = XEN_API_VM_POWER_STAT
DOM_STATE_RUNNING = XEN_API_VM_POWER_STATE_RUNNING
DOM_STATE_SUSPENDED = XEN_API_VM_POWER_STATE_SUSPENDED
DOM_STATE_SHUTDOWN = XEN_API_VM_POWER_STATE_SHUTTINGDOWN
+DOM_STATE_CRASHED = XEN_API_VM_POWER_STATE_CRASHED
DOM_STATE_UNKNOWN = XEN_API_VM_POWER_STATE_UNKNOWN
DOM_STATES_OLD = [
Index: xen-3.2-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomain.py
@@ -43,6 +43,7 @@ from xen.xend.XendConstants import XS_VM
from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_PAUSED
from xen.xend.XendConstants import DOM_STATE_RUNNING, DOM_STATE_SUSPENDED
from xen.xend.XendConstants import DOM_STATE_SHUTDOWN, DOM_STATE_UNKNOWN
+from xen.xend.XendConstants import DOM_STATE_CRASHED
from xen.xend.XendConstants import TRIGGER_TYPE
from xen.xend.XendDevices import XendDevices
from xen.xend.XendAPIConstants import *
@@ -69,6 +70,7 @@ POWER_STATE_NAMES = dict([(x, XEN_API_VM
DOM_STATE_RUNNING,
DOM_STATE_SUSPENDED,
DOM_STATE_SHUTDOWN,
+ DOM_STATE_CRASHED,
DOM_STATE_UNKNOWN]])
POWER_STATE_ALL = 'all'
@@ -1191,13 +1193,14 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot pause privileged domain %s" % domid)
ds = dominfo._stateGet()
- if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_RUNNING],
POWER_STATE_NAMES[ds])
log.info("Domain %s (%d) paused.", dominfo.getName(),
int(dominfo.getDomid()))
- dominfo.pause()
+ if ds == DOM_STATE_RUNNING:
+ dominfo.pause()
if state:
return ds
except XendInvalidDomain:
@@ -1216,7 +1219,7 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot dump core for privileged domain %s" % domid)
- if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING):
+ if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_PAUSED],
POWER_STATE_NAMES[dominfo._stateGet()])
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -414,7 +414,7 @@ class XendDomainInfo:
"""
from xen.xend import XendDomain
- if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED):
+ if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED, XEN_API_VM_POWER_STATE_CRASHED):
try:
XendTask.log_progress(0, 30, self._constructDomain)
XendTask.log_progress(31, 60, self._initDomain)
@@ -648,7 +648,7 @@ class XendDomainInfo:
return rc
def getDeviceSxprs(self, deviceClass):
- if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
return self.getDeviceController(deviceClass).sxprs()
else:
sxprs = []
@@ -2248,6 +2248,9 @@ class XendDomainInfo:
return XEN_API_VM_POWER_STATE_SUSPENDED
else:
return XEN_API_VM_POWER_STATE_HALTED
+ elif info['crashed']:
+ # Crashed
+ return XEN_API_VM_POWER_STATE_CRASHED
else:
# We are either RUNNING or PAUSED
if info['paused']:

View File

@ -0,0 +1,64 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201267747 0
# Node ID 367902a19412ba2cb6b3dff88a83ba624457e8e0
# Parent 666573856c5928371435b72d907dd7f06965965f
Fix 'on_*=rename-restart' domain configuration option.
When setting e.g. 'on_crash=rename-restart' option in domain config
and crashing guest OS running in the domain, the new domain is
restarted with same name as renamed domain.
jfehlig4: # xm li
Name ID Mem VCPUs State Time(s)
Domain-0 0 1233 4 r----- 937.9
Domain-e64b12a0-0493-44d7-afde-55c776513426 21 384 1 ---c- 14.3
Domain-e64b12a0-0493-44d7-afde-55c776513426 22 384 1 r----- 7.3
This patch copies the domain info prior to setting new name and uuid
in the crashed domain info and uses the copied domain info to
construct the restarted domain.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1386,9 +1386,10 @@ class XendDomainInfo:
self._writeVm('xend/previous_restart_time', str(now))
+ new_dom_info = self.info
try:
if rename:
- self._preserveForRestart()
+ new_dom_info = self._preserveForRestart()
else:
self._unwatchVm()
self.destroyDomain()
@@ -1402,7 +1403,7 @@ class XendDomainInfo:
new_dom = None
try:
new_dom = XendDomain.instance().domain_create_from_dict(
- self.info)
+ new_dom_info)
new_dom.waitForDevices()
new_dom.unpause()
rst_cnt = self._readVm('xend/restart_count')
@@ -1433,11 +1434,15 @@ class XendDomainInfo:
new_name, new_uuid)
self._unwatchVm()
self._releaseDevices()
+ new_dom_info = self.info.copy()
+ new_dom_info['name_label'] = self.info['name_label']
+ new_dom_info['uuid'] = self.info['uuid']
self.info['name_label'] = new_name
self.info['uuid'] = new_uuid
self.vmpath = XS_VMROOT + new_uuid
self._storeVmDetails()
self._preserve()
+ return new_dom_info
def _preserve(self):

View File

@ -0,0 +1,23 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201267771 0
# Node ID dc6264577b5905a82a41d082544280867f259d81
# Parent 367902a19412ba2cb6b3dff88a83ba624457e8e0
Remove outdated comments concerning Xen API in xend configuration file.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r 367902a19412 -r dc6264577b59 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp Fri Jan 25 13:29:07 2008 +0000
+++ b/tools/examples/xend-config.sxp Fri Jan 25 13:29:31 2008 +0000
@@ -15,9 +15,7 @@
#(loglevel DEBUG)
-# The Xen-API server configuration. (Please note that this server is
-# available as an UNSUPPORTED PREVIEW in Xen 3.0.4, and should not be relied
-# upon).
+# The Xen-API server configuration.
#
# This value configures the ports, interfaces, and access controls for the
# Xen-API server. Each entry in the list starts with either unix, a port

83
16886-xenstore-leak.patch Normal file
View File

@ -0,0 +1,83 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201267791 0
# Node ID 7f9646fcffe8075a75ba831832773ace485a8608
# Parent dc6264577b5905a82a41d082544280867f259d81
Fix leaking of /vm/<uuid> path in xenstore on various VM lifecycle events.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-3.2-testing/tools/python/xen/xend/XendCheckpoint.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py
+++ xen-3.2-testing/tools/python/xen/xend/XendCheckpoint.py
@@ -125,10 +125,10 @@ def save(fd, dominfo, network, live, dst
if checkpoint:
dominfo.resumeDomain()
else:
- dominfo.destroyDomain()
+ dominfo.destroy()
dominfo.testDeviceComplete()
try:
- dominfo.setName(domain_name)
+ dominfo.setName(domain_name, False)
except VmError:
# Ignore this. The name conflict (hopefully) arises because we
# are doing localhost migration; if we are doing a suspend of a
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1118,10 +1118,11 @@ class XendDomainInfo:
def getDomid(self):
return self.domid
- def setName(self, name):
+ def setName(self, name, to_store = True):
self._checkName(name)
self.info['name_label'] = name
- self.storeVm("name", name)
+ if to_store:
+ self.storeVm("name", name)
def getName(self):
return self.info['name_label']
@@ -1392,7 +1393,7 @@ class XendDomainInfo:
new_dom_info = self._preserveForRestart()
else:
self._unwatchVm()
- self.destroyDomain()
+ self.destroy()
# new_dom's VM will be the same as this domain's VM, except where
# the rename flag has instructed us to call preserveForRestart.
@@ -1406,9 +1407,6 @@ class XendDomainInfo:
new_dom_info)
new_dom.waitForDevices()
new_dom.unpause()
- rst_cnt = self._readVm('xend/restart_count')
- rst_cnt = int(rst_cnt) + 1
- self._writeVm('xend/restart_count', str(rst_cnt))
new_dom._removeVm(RESTART_IN_PROGRESS)
except:
if new_dom:
@@ -1434,13 +1432,19 @@ class XendDomainInfo:
new_name, new_uuid)
self._unwatchVm()
self._releaseDevices()
+ # Remove existing vm node in xenstore
+ self._removeVm()
new_dom_info = self.info.copy()
new_dom_info['name_label'] = self.info['name_label']
new_dom_info['uuid'] = self.info['uuid']
self.info['name_label'] = new_name
self.info['uuid'] = new_uuid
self.vmpath = XS_VMROOT + new_uuid
+ # Write out new vm node to xenstore
self._storeVmDetails()
+ rst_cnt = self._readVm('xend/restart_count')
+ rst_cnt = int(rst_cnt) + 1
+ self._writeVm('xend/restart_count', str(rst_cnt))
self._preserve()
return new_dom_info

View File

@ -0,0 +1,43 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1201278634 0
# Node ID c2216dce87fba6866de8814b19ab580a852f65b6
# Parent c360bb765b25b5a83550741e6ff80007ffb00885
Update XenAPI version number, changelog, and cover sheet.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r c360bb765b25 -r c2216dce87fb docs/xen-api/revision-history.tex
--- a/docs/xen-api/revision-history.tex Fri Jan 25 16:26:31 2008 +0000
+++ b/docs/xen-api/revision-history.tex Fri Jan 25 16:30:34 2008 +0000
@@ -16,5 +16,12 @@
\end{flushleft}
\end{minipage}\\
\hline
+ 1.0.2 & 25th Jan. 08 & J. Fehlig &
+ \begin{minipage}[t]{7cm}
+ \begin{flushleft}
+ Added Crashed VM power state.
+ \end{flushleft}
+ \end{minipage}\\
+ \hline
\end{tabular}
\end{center}
\ No newline at end of file
diff -r c360bb765b25 -r c2216dce87fb docs/xen-api/xenapi-coversheet.tex
--- a/docs/xen-api/xenapi-coversheet.tex Fri Jan 25 16:26:31 2008 +0000
+++ b/docs/xen-api/xenapi-coversheet.tex Fri Jan 25 16:30:34 2008 +0000
@@ -17,12 +17,12 @@
\newcommand{\coversheetlogo}{xen.eps}
%% Document date
-\newcommand{\datestring}{10th December 2007}
+\newcommand{\datestring}{25th January 2008}
\newcommand{\releasestatement}{Stable Release}
%% Document revision
-\newcommand{\revstring}{API Revision 1.0.1}
+\newcommand{\revstring}{API Revision 1.0.2}
%% Document authors
\newcommand{\docauthors}{

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1758,7 +1758,7 @@ class XendDomainInfo:
@@ -1772,7 +1772,7 @@ class XendDomainInfo:
xc.domain_setmaxmem(self.domid, maxmem)
# Make sure there's enough RAM available for the domain

View File

@ -5,7 +5,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2064,7 +2064,7 @@ class XendDomainInfo:
@@ -2078,7 +2078,7 @@ class XendDomainInfo:
(fn, BOOTLOADER_LOOPBACK_DEVICE))
vbd = {

View File

@ -72,16 +72,17 @@ case "$command" in
{ /etc/init.d/open-iscsi start >/dev/null 2>&1; sleep 1; }
# list of targets on node
par=`xenstore-read $XENBUS_PATH/params` || true
TGTID=$par; TGTID=${TGTID//@/:}; TGTID=${TGTID//\#/,}
TGTID=$par; TGTID=${TGTID//@/:}
LUN=${TGTID##*,}; TGTID=${TGTID%,*}
if test $LUN = $TGTID; then unset LUN; fi
#echo "add $TGTID lun $LUN" 1>&2
while read port uuid; do
while read rec port uuid; do
rec=${rec%]}; rec=${rec#[}
if test $uuid = $TGTID; then
find_sdev $TGTID $LUN
if test -z "$dev"; then
#echo iscsiadm -m node -T $uuid -p $port -l 1>&2
iscsiadm -m node -T $uuid -p $port -l || exit 2
iscsiadm -m node -r $rec -l || exit 2
usleep 100000
find_sdev $TGTID $LUN
fi
@ -99,9 +100,10 @@ case "$command" in
#echo "remove $dev:$tgt" 1>&2
if test -x /sbin/blockdev -a -n "$node"; then blockdev --flushbufs $node; fi
test -z "$tgt" && exit 2
while read port uuid; do
while read rec port uuid; do
if test $uuid = $tgt; then
iscsiadm -m node -T $uuid -p $port -u
rec=${rec%]}; rec=${rec#[}
iscsiadm -m node -r $rec -u
exit 0
fi
done < <(iscsiadm -m node)

View File

@ -8,100 +8,267 @@ dir=$(dirname "$0")
#set -x
#command=$1
# Find first alive non-VHOST
find_qla()
# Look for the NPIV vport with the WWPN
# $1 contains the WWPN (assumes it does not contain a leading "0x")
find_vhost()
{
unset qla
for qla in /proc/scsi/qla2xxx/*; do
if grep -q "<DEAD>" $qla; then
continue
fi
if grep -q "VHOST index" $qla; then
continue
unset vhost
# look in upstream locations
for fchost in /sys/class/fc_vports/* ; do
if test -e $fchost/port_name ; then
wwpn=`cat $fchost/port_name | sed -e s/^0x//`
if test $wwpn = $1 ; then
# Note: makes the assumption the vport will always have an scsi_host child
vhost=`ls -d $fchost/device/host*`
vhost=`basename $vhost`
return
fi
fi
done
# look in vendor-specific locations
# Emulex - just looks like another scsi_host - so look at fc_hosts...
for fchost in /sys/class/fc_host/* ; do
if test -e $fchost/port_name ; then
wwpn=`cat $fchost/port_name | sed -e s/^0x//`
if test $wwpn = $1 ; then
# Note: makes the assumption the vport will always have an scsi_host child
vhost=`basename $fchost`
return
fi
fi
return
done
}
# Find dev for NPIV
# Create a NPIV vport on the fabric w/ FABRICNM, with WWPN,WWNN
# $1 contains FABRICNM
# $2 contains the VPORT WWPN
# $3 contains the VPORT WWNN
# (assumes no name contains a leading "0x")
create_vport()
{
# find a base adapter with npiv support that is on the right fabric
# Look via upstream interfaces
for fchost in /sys/class/fc_host/* ; do
if test -e $fchost/vport_create ; then
# is the link up, w/ NPIV support ?
pstate=`cat $fchost/port_state`
ptype=`cat $fchost/port_type | cut -c 1-5`
fname=`cat $fchost/fabric_name | sed -e s/^0x//`
if [ $pstate = "Online" -a $ptype = "NPort" -a $fname = $1 ] ; then
vmax=`cat $fchost/max_npiv_vports`
vinuse=`cat $fchost/npiv_vports_inuse`
avail=`expr $vmax - $vinuse`
if [ $avail -gt 0 ] ; then
# create the vport
echo $2":"$3 > $fchost/vport_create
if [ $? -eq 0 ] ; then
return 0
fi
# failed - so we'll just look for the next adapter
fi
fi
fi
done
# Look in vendor-specific locations
# Emulex: interfaces mirror upstream, but are under adapter scsi_host
for shost in /sys/class/scsi_host/* ; do
if [ -e $shost/vport_create ] ; then
fchost=`ls -d $shost/device/fc_host*`
# is the link up, w/ NPIV support ?
pstate=`cat $fchost/port_state`
ptype=`cat $fchost/port_type | cut -c 1-5`
fname=`cat $fchost/fabric_name | sed -e s/^0x//`
if [ $pstate = "Online" -a $ptype = "NPort" -a $fname = $1 ] ; then
vmax=`cat $shost/max_npiv_vports`
vinuse=`cat $shost/npiv_vports_inuse`
avail=`expr $vmax - $vinuse`
if [ $avail -gt 0 ] ; then
# create the vport
echo $2":"$3 > $shost/vport_create
if [ $? -eq 0 ] ; then
return 0
fi
# failed - so we'll just look for the next adapter
fi
fi
fi
done
return 1
}
# Look for the LUN on the indicated scsi_host (which is an NPIV vport)
# $1 is the scsi_host name (normalized to simply the hostX name)
# $2 is the WWPN of the tgt port the lun is on
# Note: this implies we don't support a multipath'd lun, or we
# are explicitly identifying a "path"
# $3 is the LUN number of the scsi device
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
hostno=${1/*host/}
for sdev in /sys/class/scsi_device/${hostno}:*:$3 ; do
if test -e $sdev/device/../fc_trans*/port_name ; then
tgtwwpn=`cat $sdev/device/../fc_trans*/port_name | sed -e s/^0x//`
if test $tgtwwpn = $2 ; then
if test -e $sdev/device/block* ; then
dev=`readlink $sdev/device/block*`
dev=${dev##*/}
return
fi
fi
fi
done
}
find_qla
test -z "$qla" && exit 2
# Look for the NPIV vhost based on a scsi "sdX" name
# $1 is the "sdX" name
find_vhost_from_dev()
{
unset vhost
hostno=`readlink /sys/block/$1/device`
hostno=${hostno##*/}
hostno=${hostno%%:*}
if test -z "$hostno" ; then return; fi
vhost="host"$hostno
}
# We're about to terminate a vhost based on a scsi device
# Flush all nodes on that vhost as they are about to go away
# $1 is the vhost
flush_nodes_on_vhost()
{
if test ! -x /sbin/blockdev ; then return; fi
hostno=${1/*host/}
for sdev in /sys/class/scsi_device/${hostno}:* ; do
if test -e $sdev/device/block* ; then
dev=`readlink $sdev/device/block*`
dev=${dev##*/}
dev="/dev/"$dev
if test -n "$dev"; then
blockdev --flushbufs $dev
fi
fi
done
}
# Terminate a NPIV vhost
# $1 is vhost
delete_vhost()
{
# use upstream interface
for vport in /sys/class/fc_vports/* ; do
if test -e $vport/device/$1 ; then
if test -e $vport/vport_delete ; then
echo "1" > $vport/vport_delete
if test $? -ne 0 ; then exit 6; fi
sleep 4
return
fi
fi
done
# use vendor specific interface
# Emulex
if test -e /sys/class/fc_host/$1/device/../scsi_host*/lpfc_drvr_version ; then
shost=`ls -1d /sys/class/fc_host/$1/device/../scsi_host* | sed s/.*scsi_host://`
vportwwpn=`cat /sys/class/fc_host/$1/port_name | sed s/^0x//`
vportwwnn=`cat /sys/class/fc_host/$1/node_name | sed s/^0x//`
echo "$vportwwpn:$vportwwnn" > /sys/class/scsi_host/$shost/vport_delete
if test $? -ne 0 ; then exit 6; fi
sleep 4
return
fi
# Qlogic
if test -e /sys/class/fc_host/$1/device/../scsi_host*/driver_version ; then
shost=`ls -1d /sys/class/fc_host/$1/device/../scsi_host* | sed s/.*scsi_host://`
vportwwpn=`cat /sys/class/fc_host/$1/port_name | sed s/^0x//`
vportwwnn=`cat /sys/class/fc_host/$1/node_name | sed s/^0x//`
echo "$vportwwpn:$vportwwnn" > /sys/class/scsi_host/$shost/vport_delete
if test $? -ne 0 ; then exit 6; fi
sleep 4
return
fi
exit 6
}
case "$command" in
add)
# Params is one big arg, with fields separated by hyphens:
# FABRIC-VPWWPN-VPWWNN-TGTWWPN-LUN#
# arg 2 - Fabric Name
# arg 3 - VPORT's WWPN
# arg 4 - VPORT's WWNN
# arg 5 - Target's WWPN
# arg 6 - LUN # on Target
# no wwn contains a leading 0x - it is a 16 character hex value
# You may want to optionally pick a specific adapter ?
par=`xenstore-read $XENBUS_PATH/params` || true
#par=$2
NPIV=$par
find_sdev $NPIV
if test -z "$dev"; then
echo "scsi-qlavportc=$NPIV" > $qla
NPIVARGS=$par;
LUN=${NPIVARGS##*-*-*-*-}; NPIVARGS=${NPIVARGS%-*}
if test $LUN = $NPIVARGS ; then exit 1; fi
TGTWWPN=${NPIVARGS##*-*-*-}; NPIVARGS=${NPIVARGS%-*}
if test $TGTWWPN = $NPIVARGS ; then exit 1; fi
VPORTWWNN=${NPIVARGS##*-*-}; NPIVARGS=${NPIVARGS%-*}
if test $VPORTWWNN = $NPIVARGS ; then exit 1; fi
VPORTWWPN=${NPIVARGS##*-}; NPIVARGS=${NPIVARGS%-*}
if test $VPORTWWPN = $NPIVARGS ; then exit 1; fi
FABRICNM=$NPIVARGS
# Ensure we compare everything using lower-case hex characters
TGTWWPN=`echo $TGTWWPN | tr A-Z a-z`
VPORTWWPN=`echo $VPORTWWPN | tr A-Z a-z`
VPORTWWNN=`echo $VPORTWWNN | tr A-Z a-z`
FABRICNM=`echo $FABRICNM | tr A-Z a-z`
find_vhost $VPORTWWPN
if test -z "$vhost" ; then
create_vport $FABRICNM $VPORTWWPN $VPORTWWNN
if [ $? -ne 0 ] ; then exit 2; fi
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
find_vhost $VPORTWWPN
if test -z "$vhost" ; then exit 3; fi
fi
find_sdev $vhost $TGTWWPN $LUN
if test -z "$dev"; then
echo "- - -" > /sys/class/scsi_host/$vhost/scan
sleep 2
find_sdev $vhost $TGTWWPN $LUN
fi
if test ! -z "$dev"; then
xenstore-write $XENBUS_PATH/node /dev/$dev
write_dev /dev/$dev
exit 0
fi
exit 1
exit 4
;;
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
# this is really screwy. the first delete of a lun will
# terminate the entire vport (all luns)
find_vhost_from_dev $dev
if test -z "$vhost" ; then exit 5; fi
flush_nodes_on_vhost $vhost
delete_vhost $vhost
exit 0
;;
esac

View File

@ -1,7 +1,7 @@
Index: 2008-01-07/xen/arch/x86/traps.c
Index: 2008-01-18/xen/arch/x86/traps.c
===================================================================
--- 2008-01-07.orig/xen/arch/x86/traps.c 2008-01-07 12:02:51.000000000 +0100
+++ 2008-01-07/xen/arch/x86/traps.c 2008-01-07 12:11:52.000000000 +0100
--- 2008-01-18.orig/xen/arch/x86/traps.c 2008-01-17 09:25:35.000000000 +0100
+++ 2008-01-18/xen/arch/x86/traps.c 2008-01-18 09:03:16.000000000 +0100
@@ -49,6 +49,7 @@
#include <xen/trace.h>
#include <asm/paging.h>
@ -10,7 +10,7 @@ Index: 2008-01-07/xen/arch/x86/traps.c
#include <asm/io.h>
#include <asm/atomic.h>
#include <asm/desc.h>
@@ -2812,7 +2813,7 @@ long unregister_guest_nmi_callback(void)
@@ -2822,7 +2823,7 @@ long unregister_guest_nmi_callback(void)
return 0;
}
@ -19,10 +19,10 @@ Index: 2008-01-07/xen/arch/x86/traps.c
{
struct trap_info cur;
struct vcpu *curr = current;
Index: 2008-01-07/xen/include/asm-x86/hypercall.h
Index: 2008-01-18/xen/include/asm-x86/hypercall.h
===================================================================
--- 2008-01-07.orig/xen/include/asm-x86/hypercall.h 2007-06-04 08:35:36.000000000 +0200
+++ 2008-01-07/xen/include/asm-x86/hypercall.h 2008-01-07 12:11:52.000000000 +0100
--- 2008-01-18.orig/xen/include/asm-x86/hypercall.h 2008-01-16 14:24:36.000000000 +0100
+++ 2008-01-18/xen/include/asm-x86/hypercall.h 2008-01-18 09:03:16.000000000 +0100
@@ -32,9 +32,10 @@ extern long
do_physdev_op_compat(
XEN_GUEST_HANDLE(physdev_op_t) uop);
@ -35,10 +35,10 @@ Index: 2008-01-07/xen/include/asm-x86/hypercall.h
extern int
do_mmu_update(
Index: 2008-01-07/xen/include/public/arch-x86/xen.h
Index: 2008-01-18/xen/include/public/arch-x86/xen.h
===================================================================
--- 2008-01-07.orig/xen/include/public/arch-x86/xen.h 2008-01-07 12:11:43.000000000 +0100
+++ 2008-01-07/xen/include/public/arch-x86/xen.h 2008-01-07 12:11:52.000000000 +0100
--- 2008-01-18.orig/xen/include/public/arch-x86/xen.h 2008-01-18 09:03:15.000000000 +0100
+++ 2008-01-18/xen/include/public/arch-x86/xen.h 2008-01-18 09:03:16.000000000 +0100
@@ -98,7 +98,6 @@ struct trap_info {
unsigned long address; /* code offset */
};

47
hypercall-check.patch Normal file
View File

@ -0,0 +1,47 @@
Index: 2008-01-07/unmodified_drivers/linux-2.6/platform-pci/evtchn.c
===================================================================
--- 2008-01-07.orig/unmodified_drivers/linux-2.6/platform-pci/evtchn.c 2007-11-12 08:47:41.000000000 +0100
+++ 2008-01-07/unmodified_drivers/linux-2.6/platform-pci/evtchn.c 2008-01-17 17:53:37.000000000 +0100
@@ -118,8 +118,8 @@ void unmask_evtchn(int port)
ever bind event channels to vcpu 0 in HVM guests. */
if (unlikely(cpu != 0)) {
evtchn_unmask_t op = { .port = port };
- (void)HYPERVISOR_event_channel_op(EVTCHNOP_unmask,
- &op);
+ VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask,
+ &op));
put_cpu();
return;
}
@@ -227,7 +227,8 @@ void unbind_from_irqhandler(unsigned int
mask_evtchn(evtchn);
if (irq_evtchn[irq].close) {
struct evtchn_close close = { .port = evtchn };
- HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+ if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
+ BUG();
}
}
@@ -310,7 +311,7 @@ static irqreturn_t evtchn_interrupt(int
void force_evtchn_callback(void)
{
- (void)HYPERVISOR_xen_version(0, NULL);
+ VOID(HYPERVISOR_xen_version(0, NULL));
}
EXPORT_SYMBOL(force_evtchn_callback);
Index: 2008-01-07/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
===================================================================
--- 2008-01-07.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c 2007-11-02 17:25:53.000000000 +0100
+++ 2008-01-07/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c 2008-01-17 18:02:17.000000000 +0100
@@ -58,7 +58,7 @@ static int bp_suspend(void)
BUG_ON(!irqs_disabled());
- suspend_cancelled = HYPERVISOR_shutdown(SHUTDOWN_suspend);
+ suspend_cancelled = HYPERVISOR_suspend(0);
if (!suspend_cancelled) {
write_lock(&suspend_lock);

View File

@ -84,7 +84,6 @@ case "$1" in
fi
# Load XEN backend modules
# Sidenote: They could be loaded later:
# - netloop at network-bridge init time
# - netbk and blkbk when the dom0 hotplug events occur
# (in xen-network-common.sh and block-common.sh)
# - xenblk when xend prepares for bootloader
@ -92,7 +91,6 @@ case "$1" in
modprobe blktap 2>/dev/null || true
modprobe blkbk 2>/dev/null || true
modprobe xenblk 2>/dev/null || true
modprobe netloop 2>/dev/null || true
modprobe netbk 2>/dev/null || true
xend start
await_daemons_up

File diff suppressed because it is too large Load Diff

50
multinet-include.template Normal file
View File

@ -0,0 +1,50 @@
#!/bin/sh
#============================================================================
# multinet-include.template
#
# Version = 1.0.0
# Date = 2007-12-31
#
# Description:
#
# Script description goes here.
#
#============================================================================
#### start/stop info ########################################
#
# default-run: post-start pre-stop
#
# pre-start-num:
# post-start-num: 10
# pre-stop-num: 10
# post-stop-num:
#
###############################################################
#### Read config files and set variables ##################################
#. /etc/sysconfig/xend
#. /etc/xen/scripts/multinet-common.sh
#### Script Functions #####################################################
#### Main Code Body #######################################################
case $1 in
pre-start)
;;
post-start)
;;
pre-stop)
;;
post-stop)
;;
esac

View File

@ -1,17 +0,0 @@
Read the mac address from the otherend
Signed-off-by: ksrinivasan@novell.com
Index: xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
===================================================================
--- xen-3.2-testing.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -349,7 +349,7 @@ static int xen_net_read_mac(struct xenbu
char *s, *e, *macstr;
int i;
- macstr = s = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL);
+ macstr = s = xenbus_read(XBT_NIL, dev->otherend, "mac", NULL);
if (IS_ERR(macstr))
return PTR_ERR(macstr);

View File

@ -2,8 +2,8 @@
#============================================================================
# network-multinet
#
# Version = 2.0.1
# Date = 2007-11-29
# Version = 3.0.0
# Date = 2008-01-30
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
@ -13,64 +13,59 @@
#
# Description:
#
# Replacement for the xen network-bridge, network-nat and network-route
# Replacement for the Xen network-bridge, network-nat and network-route
# scripts. This script allows for the creation of multiple networks.
#
# This script can create 4 types of networks:
# This script can create 6 types of networks:
#
# bridged: -Networks that contain both a physical network device (ethX)
# and a virtual network device (vethX) from Dom0.
# bridged: -Networks that are connected to a physical network device
# in Dom0 and on which Dom0 can communitcate
# -This is the traditional type of network created in xen by
# the basic network-bridge script.
# -VMs on these network(s) appear to be on the real network(s)
#
# nohost: -Networks that contain a physical network device but not a
# virtual network device from Dom0.
# nohost: -Networks that are connected to Dom0 but on which Dom0 cannot
# communitcate
# -These can be used to allow virtual machines to communicate
# with the outside world but not with Dom0.
# (Usefull if you want to isolate traffic away from Dom0)
#
# hostonly: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# hostonly: -Networks that are connected to Dom0 but are private from
# the physical network
# -This type of network will allow VMs connected to it to
# access only Dom0 and other VMs connected to the network.
# -This type of network is similiar to a VMware "HOST ONLY"
# network.
#
# nat: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# nat: -Networks that are connected to Dom0 and are private from the
# physical network but VMs can get out to the physical network
# -This type of network will allow VMs connected to it to access
# Dom0,the "outside world" via NAT and other VMs connected to it.
# Dom0, the "outside world" via NAT and other VMs connected to it.
# -This type of network is similiar to a VMware "NAT" network.
#
# routed: -Networks that contain only a virtual network device (vethX)
# from Dom0.
# routed: -Networks that are not directly connected to the physical network
# but who's traffic is directly routed to other networks
# -This type of network will allow VMs connected to it to access
# Dom0,the "outside world" via routing through Dom0 and other VMs
# Dom0, the "outside world" via routing through Dom0 and other VMs
# connected to it.
#
# empty: -Networks that do not contain any physical or virtual network
# devices from Dom0.
# empty: -Networks that are not connected to either Dom0 or the physical
# network
# -These can be used to allow VMs in DomUs to communicate only
# with other DomUs and not Dom0.
#
#
# This script accepts the (start|stop|restart|status) parameters.
#
# This script requires that the vif-bridge script be used as the vif
# creation script (as opposed to vif-nat/vif-route).
#
# This script will test for the presence of the physical interfaces
# configured to be connected to bridged networks and only attempt to
# create networks on the ones that are present and up. It will also test
# for the presence of virtual interfaces configured to be connected to
# other networks and only create networks for the ones that exist and
# are not already connected to an existing network.
# This script will verify that a requested physical interface is present and
# up before creating the network and connecting the physical interface to it.
#
# Edit the NETWORK_LIST variable to define which networks to create on which
# interfaces. The default is to create a bridged network on the first
# interface active network interface.
# active network interface.
#
# To enable this script edit the network-script field in the
# /etc/xen/xend-config.sxp file.
@ -79,8 +74,6 @@
#
# Depends on: $SCRIPT_PATH/multinet-common.sh
#
# Calls if present: $SCRIPT_PATH/xen-dhcpd
#
# Config file: /etc/sysconfig/xend
#
# Usage: network-multinet (start|stop|restart|status)
@ -88,18 +81,9 @@
# Vars:
#
# --------------------------- In this script ----------------------------
# SCRIPT_PATH -Path to the directory containing the xen network-bridge
# script (typically /etc/xen/scripts)
#
# CONFIG_FILE_PATH -Path to extra config files
# (not used currently by this script)
#
# NETWORK_SAVE_PATH -Path to save network configuration information in
#
# IPTABLES_SAVE_FILE -File in which to save backed-up iptables rules so that they
# may be restored when the script is stopped
#
# XEN_DHCP_SCRIPT -Script called to manage the DHCP server on the specified networks
# SCRIPT_PATH -Path to the directory containing the xen network
# configuration scripts (typically /etc/xen/scripts)
#
# ------------------------- In the config file --------------------------
# NETWORK_LIST -Space delimited list of network devices to create networks
@ -109,7 +93,7 @@
#
# Example with 3 virtual devices:
#
# "bridge,0,eth0,,,dhcp-off nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# "bridge,0,default,default,dhcp-off nat,0,none,172.23.0.1/16,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off"
#
# NAT_EXTERNAL_INTERFACE -Network interface to use as the external interface
# for NATed and Routed networks
@ -124,10 +108,6 @@
. /etc/sysconfig/xend
SCRIPT_PATH="/etc/xen/scripts"
CONF_FILE_PATH="/etc/xen/conf"
NETWORK_SAVE_PATH="/var/lib/xend/network_save"
IPTABLES_SAVE_FILE="$NETWORK_SAVE_PATH/iptables-save"
XEN_DHCP_SCRIPT="$SCRIPT_PATH/xen-dhcpd"
#### Script Functions #####################################################
@ -155,11 +135,6 @@ make_config_dirs() {
then
mkdir $NETWORK_SAVE_PATH
fi
if ! [ -d $CONF_FILE_PATH ]
then
mkdir $CONF_FILE_PATH
fi
}
@ -171,21 +146,25 @@ create_networks() {
VIF_COUNT=0
case $NAT_EXTERNAL_INTERFACE in
default)
NAT_EXTERNAL_INTERFACE=`ip route list | awk '/^default / { print $NF }'`
;;
esac
for NETWORK in $NETWORK_LIST
do
local NET_TYPE=`echo $NETWORK | cut -d "," -f 1`
local NET_NUMBER=`echo $NETWORK | cut -d "," -f 2`
local NET_DEV=`echo $NETWORK | cut -d "," -f 3`
local NET_DEV_MAC=`echo $NETWORK | cut -d "," -f 4`
local NET_DEV_IP=`echo $NETWORK | cut -d "," -f 5`
local NET_DHCP_SRV=`echo $NETWORK | cut -d "," -f 6`
local NET_DEV_IP=`echo $NETWORK | cut -d "," -f 4`
local NET_DHCP_SRV=`echo $NETWORK | cut -d "," -f 5`
case $NET_DHCP_SRV in
dhcp-on)
DHCP_SRV="on"
;;
*)
DHCP_SRV="off"
;;
esac
# Find the name of the network interface for the first bridged network
#---------------------------------------------------------------------
case $NET_DEV in
default)
local NET_DEV=`ip route list | awk '/^default / { print $NF }'`
@ -194,23 +173,128 @@ create_networks() {
case $NET_TYPE in
bridge)
create_bridged_networks $NET_DEV $NET_NUMBER
((VIF_COUNT++))
# Create the network
#---------------------------------------------------------------------
configure_bridged_networks $CMD_OPT $NET_DEV $NET_NUMBER
;;
nat|route|hostonly)
create_local_networks $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV
((VIF_COUNT++))
# Create the network
#---------------------------------------------------------------------
configure_local_networks $CMD_OPT $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_IP $NET_DHCP_SRV
;;
nohost)
create_nohost_networks $NET_DEV $NET_NUMBER
# Create the network
#---------------------------------------------------------------------
configure_nohost_networks $CMD_OPT $NET_DEV $NET_NUMBER
;;
empty)
create_empty_networks $NET_NUMBER
# Create the network
#---------------------------------------------------------------------
configure_empty_networks $CMD_OPT $NET_NUMBER
;;
esac
done
}
#***** Pre/Post Start/Stop Functions **************************************
run_prestart_scripts() {
echo ""
echo "============================================================"
echo "Running pre-start scripts"
echo
test -d $PLUGIN_DIR/pre-start || mkdir -p $PLUGIN_DIR/pre-start
if ls $PLUGIN_DIR/pre-start/*.sh > /dev/null 2&>1
then
for SCRIPT in `ls $PLUGIN_DIR/pre-start/*.sh`
do
echo ""
echo " Running $SCRIPT"
echo
$SCRIPT prestart
echo
echo "------------------------------------------------------------"
done
else
echo " No pre-start scripts to run. Continuing ..."
echo
fi
echo "============================================================"
}
run_poststart_scripts() {
echo ""
echo "============================================================"
echo "Running post-start scripts"
echo
test -d $PLUGIN_DIR/post-start || mkdir -p $PLUGIN_DIR/post-start
if ls $PLUGIN_DIR/post-start/*.sh > /dev/null 2&>1
then
for SCRIPT in `ls $PLUGIN_DIR/post-start/*.sh`
do
echo ""
echo " Running $SCRIPT"
echo
$SCRIPT poststart
echo
echo "------------------------------------------------------------"
done
else
echo " No post-start scripts to run. Continuing ..."
echo
fi
echo "============================================================"
}
run_prestop_scripts() {
echo ""
echo "============================================================"
echo "Running pre-stop scripts"
echo
test -d $PLUGIN_DIR/pre-stop || mkdir -p $PLUGIN_DIR/pre-stop
if ls $PLUGIN_DIR/pre-stop/*.sh > /dev/null 2&>1
then
for SCRIPT in `ls $PLUGIN_DIR/pre-stop/*.sh`
do
echo ""
echo " Running $SCRIPT"
echo
$SCRIPT prestop
echo
echo "------------------------------------------------------------"
done
else
echo " No pre-stop scripts to run. Continuing ..."
echo
fi
echo "============================================================"
}
run_poststop_scripts() {
echo ""
echo "============================================================"
echo "Running post-stop scripts"
echo
test -d $PLUGIN_DIR/post-stop || mkdir -p $PLUGIN_DIR/post-stop
if ls $PLUGIN_DIR/post-stop/*.sh > /dev/null 2&>1
then
for SCRIPT in `ls $PLUGIN_DIR/post-stop/*.sh`
do
echo ""
echo " Running $SCRIPT"
echo
$SCRIPT poststop
echo
echo "------------------------------------------------------------"
done
else
echo " No post-stop scripts to run. Continuing ..."
echo
fi
echo "============================================================"
}
#### Start, Stop, Status Functions ########################################
start_xend_network() {
@ -218,11 +302,19 @@ start_xend_network() {
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo " Starting the xend network environment"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
make_config_dirs
manage_susefirewall2 stop || manage_iptables stop
#manage_susefirewall2 start
manage_routing start
# Determine if we are using SuSEfirewall2
use_sf2 start
# Run pre-start scripts
run_prestart_scripts
manage_firewall prestart
# Create the predefined networks
create_networks
# Run post-start scripts
manage_firewall poststart
run_poststart_scripts
}
stop_xend_network() {
@ -230,10 +322,19 @@ stop_xend_network() {
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
echo " Stopping the xend network environment"
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
manage_susefirewall2 stop
create_networks
manage_routing stop
manage_susefirewall2 start || manage_iptables start
# Run pre-stop scripts
run_prestop_scripts
manage_firewall prestop
# Remove the networks
remove_all_networks
# Run post-stop scripts
manage_firewall poststop
run_poststop_scripts
# Clean-up if we are using the SuSEfirewall2
use_sf2 stop
}
show_xend_network_status() {
@ -244,54 +345,44 @@ show_xend_network_status() {
get_option "$1"
make_config_dirs
touch $NETWORKTAB
case $CMD_OPT in
start)
# Start the Xen network
start_xend_network
# Start the DHCP server if it exists
if [ -e $XEN_DHCP_SCRIPT ]
then
$XEN_DHCP_SCRIPT start
fi
#do_dhcpd start
;;
stop)
# Stop the DHCP server if it exists
if [ -e $XEN_DHCP_SCRIPT ]
then
$XEN_DHCP_SCRIPT stop
fi
#do_dhcpd stop
# Stop the Xen network
stop_xend_network
;;
restart)
# Stop the DHCP server if it exists
if [ -e $XEN_DHCP_SCRIPT ]
then
$XEN_DHCP_SCRIPT stop
fi
#do_dhcpd stop
# Stop the Xen network
CMD_OPT="stop"
stop_xend_network
# Start the Xen network
CMD_OPT="start"
start_xend_network
# Start the DHCP server if it exists
if [ -e $XEN_DHCP_SCRIPT ]
then
$XEN_DHCP_SCRIPT start
fi
#do_dhcpd start
;;
status)
show_xend_network_status
if [ -e $XEN_DHCP_SCRIPT ]
then
$XEN_DHCP_SCRIPT status
fi
#do_dhcpd status
;;
esac

View File

@ -2,40 +2,7 @@ Index: xen-3.2-testing/unmodified_drivers/linux-2.6/mkbuildtree
===================================================================
--- xen-3.2-testing.orig/unmodified_drivers/linux-2.6/mkbuildtree
+++ xen-3.2-testing/unmodified_drivers/linux-2.6/mkbuildtree
@@ -13,16 +13,30 @@ C=$PWD
if [ -n "$XEN" -a -d "$XEN" ]; then
XEN=$(cd $XEN && pwd)
else
- XEN=$C/../../xen
+ XEN=/usr/src/linux/include/xen
fi
if [ -n "$XL" -a -d "$XL" ]; then
XL=$(cd $XL && pwd)
else
- XL=$C/../../linux-2.6.18-xen.hg
+ XL=/usr/src/linux
+fi
+cd "$(dirname "$0")"
+
+if [ -n "$ALT_KMP_OS" -a "$ALT_KMP_OS" == other ]; then
+ XL=$C/linux-2.6-xen-sparse
+ XEN=$C/linux-2.6-xen-sparse/include/xen
fi
for d in $(find ${XL}/drivers/xen/ -maxdepth 1 -type d | sed -e 1d); do
+ # TEMPORARY - Don't link entire directory until the accel.c fix is in the kernel cvs
+ if echo $d | egrep -q netfront; then
+ ln -sf ${XL}/drivers/xen/netfront/netfront.c netfront
+ ln -sf ${XL}/drivers/xen/netfront/netfront.h netfront
+ cp -p ../../linux-2.6-xen-sparse/drivers/xen/netfront/accel.c netfront
+ continue
+ fi
+ # END TEMPORARY
if ! echo $d | egrep -q back; then
lndir $d $(basename $d) > /dev/null 2>&1
fi
@@ -39,7 +53,7 @@ ln -sf ${XL}/drivers/xen/core/reboot.c p
@@ -40,7 +40,7 @@ ln -sf ${XL}/drivers/xen/core/reboot.c p
mkdir -p include/asm include/xen
lndir -silent ${XL}/include/xen include/xen
@ -44,19 +11,16 @@ Index: xen-3.2-testing/unmodified_drivers/linux-2.6/mkbuildtree
# Need to be quite careful here: we don't want the files we link in to
# risk overriding the native Linux ones (in particular, system.h must
Index: xen-3.2-testing/unmodified_drivers/linux-2.6/overrides.mk
Index: xen-3.2-testing/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
===================================================================
--- xen-3.2-testing.orig/unmodified_drivers/linux-2.6/overrides.mk
+++ xen-3.2-testing/unmodified_drivers/linux-2.6/overrides.mk
@@ -4,6 +4,11 @@
#
# (i.e. we need the native config for things like -mregparm, but
# a Xen kernel to find the right headers)
+ifeq ($(ALT_KMP_OS),other)
+ SPARSEINCLUDE := -I$(M)/../../linux-2.6-xen-sparse/include/xen -I$(M)/../../linux-2.6-xen-sparse/include
+ SPARSEINCLUDE += $(CPPFLAGS)
+ CPPFLAGS = $(SPARSEINCLUDE)
+endif
EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205
EXTRA_CFLAGS += -DCONFIG_XEN_COMPAT=0xffffff
EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H
--- xen-3.2-testing.orig/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
+++ xen-3.2-testing/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
@@ -151,7 +151,7 @@ typedef irqreturn_t (*irq_handler_t)(int
#endif
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && CONFIG_SLE_VERSION < 10
#define setup_xen_features xen_setup_features
#endif

88
pv-drv-mkbuildtree.patch Normal file
View File

@ -0,0 +1,88 @@
Index: 2008-01-07/unmodified_drivers/linux-2.6/mkbuildtree
===================================================================
--- 2008-01-07.orig/unmodified_drivers/linux-2.6/mkbuildtree 2007-10-09 11:46:22.000000000 +0200
+++ 2008-01-07/unmodified_drivers/linux-2.6/mkbuildtree 2008-01-17 17:32:01.000000000 +0100
@@ -8,27 +8,28 @@ else
echo "This may be overridden on the command line (i386,x86_64,ia64)."
fi
-C=$PWD
+C=$(cd $(dirname $0) && pwd)
+R=${C%/*/*}
if [ -n "$XEN" -a -d "$XEN" ]; then
XEN=$(cd $XEN && pwd)
else
- XEN=$C/../../xen
+ XEN=$R/xen
fi
+echo "Xen tree: $XEN"
if [ -n "$XL" -a -d "$XL" ]; then
XL=$(cd $XL && pwd)
else
- XL=$C/../../linux-2.6.18-xen.hg
+ XL=$R/linux-2.6.18-xen.hg
fi
+echo "Linux tree: $XL"
-for d in $(find ${XL}/drivers/xen/ -maxdepth 1 -type d | sed -e 1d); do
- if ! echo $d | egrep -q back; then
- lndir $d $(basename $d) > /dev/null 2>&1
- fi
- if ! echo $d | egrep -q ball; then
- lndir $d $(basename $d) > /dev/null 2>&1
- fi
+cd $C
+
+for d in $(find ${XL}/drivers/xen/ -mindepth 1 -maxdepth 1 -type d); do
+ test -d $(basename $d) || continue
+ lndir $d $(basename $d) > /dev/null 2>&1
done
ln -sf ${XL}/drivers/xen/core/gnttab.c platform-pci
@@ -44,23 +45,27 @@ ln -nsf ${XEN}/include/public include/xe
# Need to be quite careful here: we don't want the files we link in to
# risk overriding the native Linux ones (in particular, system.h must
# be native and not xenolinux).
-case "$uname"
-in
-"x86_64")
- ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/hypervisor.h include/asm
- ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/hypercall.h include/asm
- ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/synch_bitops.h include/asm
- ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/maddr.h include/asm
- ln -sf ${XL}/include/asm-x86_64/mach-xen/asm/gnttab_dma.h include/asm
- mkdir -p include/asm-i386
- lndir -silent ${XL}/include/asm-i386 include/asm-i386
- ;;
-i[34567]86)
- ln -sf ${XL}/include/asm-i386/mach-xen/asm/hypervisor.h include/asm
- ln -sf ${XL}/include/asm-i386/mach-xen/asm/hypercall.h include/asm
- ln -sf ${XL}/include/asm-i386/mach-xen/asm/synch_bitops.h include/asm
- ln -sf ${XL}/include/asm-i386/mach-xen/asm/maddr.h include/asm
- ln -sf ${XL}/include/asm-i386/mach-xen/asm/gnttab_dma.h include/asm
+case "$uname" in
+i[34567]86|x86_64)
+ if [ -d ${XL}/include/asm-x86 ]; then
+ ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypervisor.h include/asm
+ ln -sf ${XL}/include/asm-x86/mach-xen/asm/hypercall*.h include/asm
+ ln -sf ${XL}/include/asm-x86/mach-xen/asm/synch_bitops*.h include/asm
+ ln -sf ${XL}/include/asm-x86/mach-xen/asm/maddr*.h include/asm
+ ln -sf ${XL}/include/asm-x86/mach-xen/asm/gnttab_dma.h include/asm
+ else
+ if [ $uname = x86_64 ]; then
+ mkdir -p include/asm-i386
+ lndir -silent ${XL}/include/asm-i386 include/asm-i386
+ else
+ uname=i386
+ fi
+ ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypervisor.h include/asm
+ ln -sf ${XL}/include/asm-$uname/mach-xen/asm/hypercall.h include/asm
+ ln -sf ${XL}/include/asm-$uname/mach-xen/asm/synch_bitops.h include/asm
+ ln -sf ${XL}/include/asm-$uname/mach-xen/asm/maddr.h include/asm
+ ln -sf ${XL}/include/asm-$uname/mach-xen/asm/gnttab_dma.h include/asm
+ fi
;;
"ia64")
ln -sf ${XL}/include/asm-ia64/hypervisor.h include/asm

View File

@ -1,73 +0,0 @@
Index: 2008-01-07/xen/arch/x86/hvm/hvm.c
===================================================================
--- 2008-01-07.orig/xen/arch/x86/hvm/hvm.c 2008-01-07 12:02:51.000000000 +0100
+++ 2008-01-07/xen/arch/x86/hvm/hvm.c 2008-01-07 12:11:59.000000000 +0100
@@ -606,10 +606,11 @@ int hvm_set_efer(uint64_t value)
value &= ~EFER_LMA;
- if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) ||
+ if ( (value & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (value & EFER_LME)) ||
(!cpu_has_nx && (value & EFER_NX)) ||
(!cpu_has_syscall && (value & EFER_SCE)) ||
+ (!cpu_has_lmsl && (value & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (value & EFER_FFXSE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
Index: 2008-01-07/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- 2008-01-07.orig/xen/arch/x86/hvm/svm/svm.c 2008-01-07 12:02:51.000000000 +0100
+++ 2008-01-07/xen/arch/x86/hvm/svm/svm.c 2008-01-07 12:11:59.000000000 +0100
@@ -53,6 +53,11 @@
u32 svm_feature_flags;
+#ifdef __x86_64__
+/* indicate whether guest may use EFER.LMSLE */
+unsigned char cpu_has_lmsl = 0;
+#endif
+
#define set_segment_register(name, value) \
asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
@@ -922,6 +927,22 @@ int start_svm(struct cpuinfo_x86 *c)
/* Initialize core's ASID handling. */
svm_asid_init(c);
+#ifdef __x86_64__
+ /*
+ * Check whether EFER.LMSLE can be written.
+ * Unfortunately there's no feature bit defined for this.
+ */
+ eax = read_efer();
+ edx = read_efer() >> 32;
+ if ( wrmsr_safe(MSR_EFER, eax | EFER_LMSLE, edx) == 0 )
+ rdmsr(MSR_EFER, eax, edx);
+ if ( eax & EFER_LMSLE )
+ {
+ cpu_has_lmsl = 1;
+ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx);
+ }
+#endif
+
if ( cpu != 0 )
return 1;
Index: 2008-01-07/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- 2008-01-07.orig/xen/include/asm-x86/hvm/hvm.h 2008-01-07 12:02:52.000000000 +0100
+++ 2008-01-07/xen/include/asm-x86/hvm/hvm.h 2008-01-07 12:11:59.000000000 +0100
@@ -127,6 +127,12 @@ struct hvm_function_table {
extern struct hvm_function_table hvm_funcs;
extern int hvm_enabled;
+#ifdef __i386__
+# define cpu_has_lmsl 0
+#else
+extern unsigned char cpu_has_lmsl;
+#endif
+
int hvm_domain_initialise(struct domain *d);
void hvm_domain_relinquish_resources(struct domain *d);
void hvm_domain_destroy(struct domain *d);

View File

@ -1,3 +1,21 @@
#============================================================================
# /etc/sysconfig/xend
#
# Version = 3.0.0
# Date = 2008-01-30
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
# The latest version can be found at:
#
# http://pronetworkconsulting.com/linux/scripts/network-multinet.html
#
# Description:
#
# This configuration file is for use with network-multinet version 3
#
#============================================================================
## Path: System/Virtualization
## Description:
## Type: list()
@ -8,133 +26,55 @@
# devices,mac addresses and IP addresses to create bridges on using
# the following format:
#
# <network type>,<number of network type>,<network device>,<mac address>,<IP address/CIDR NetMask>,<dhcp server status>
# <network type>,<number of network type>,<network device>,<IP address/CIDR NetMask>,<dhcp server status>
#
# Where:
# <network type> = bridge|nat|route|hostonly|nohost|empty
# <number of network type> = The network number (0,1,2,etc.) of that type of
# network (i.e. xennat0, xenbr1, xenhost3, etc.)
# <network device> = The network interface the bridge will be
# attached to (i.e. eth0, veth2, etc.)
# If set to 'default' the interface used for the
# default gateway will be used
# <mac address> = The MAC address to assign to <network device>
# <network device> = The network interface the bridge will be attached
# to (i.e. eth0, etc.)
# For NAT. Routed, or Hostonly networks this should
# be "none" because there is no device. For Bridged or
# Nohost interfaces this should be a physical
# interfaces (eth, bond, vlan, etc.) If set to
# 'default' the interface used for the default
# gateway will be used
# <IP address/CIDR Netmask> = The IP address and Subnet Mask to assign to
# <network device> format= 1.2.3.4/24
# <dhcp server status> = dhcp-on|dhcp-off (DHCP server on/off on that net)
#
# Network Definition Examples:
# bridged "bridge,0,default,,,dhcp-off"
# "bridge,1,eth1,,,dhcp-off"
# nat "nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# routed "route,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# hostonly "hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off"
# nohost "nohost,0,eth1,,,dhcp-off"
# empty "empty,0,,,dhcp-off"
# bridged "bridge,0,default,default,dhcp-off"
# "bridge,1,eth1,default,dhcp-off"
# nat "nat,0,none,172.22.0.1/16,dhcp-off"
# routed "route,0,none,172.23.0.1/16,dhcp-off"
# hostonly "hostonly,0,none,172.24.0.1/16,dhcp-off"
# nohost "nohost,0,eth1,,"
# empty "empty,0,none,none,"
#
# Example: "bridge,0,eth0,,,dhcp-off nat,0,veth2,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
# Example: "bridge,0,eth0,default,dhcp-off nat,0,none,172.22.0.1/16,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off empty,0,none,none,"
#
# The above example would create 4 networks the first being a bridged network
# (xenbr0), the second being a NATed network (xennat0), the third being a host
# only network (xenhost0) and the fourth being an empty network (xenempty0)
#
# Used by network-multinet v2.x only
# Used by network-multinet v3.x only
#
NETWORK_LIST="bridge,0,default,,,dhcp-off nat,0,veth2,00:16:3E:01:00:02,172.22.0.1/16,dhcp-off hostonly,0,veth3,00:16:3E:01:00:03,172.23.0.1/16,dhcp-off empty,0,,,dhcp-off"
NETWORK_LIST="bridge,0,default,default,dhcp-off nat,0,none,172.22.0.1/16,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off empty,0,none,,"
## Type: string(eth0,eth1,eth2,eth3)
## Default: "eth0"
## Config:
#
# Network interface to use as the external interface for NATed
# and Routed networks
# and Routed networks.
#
# If set to 'default" it will use the same interface used for the
# default route
#
NAT_EXTERNAL_INTERFACE="default"
## Type: string(xenbr)
## Default: "xenbr"
## Config:
#
# Name of bridge to create (xenbr0, xenbr1, etc.)
#
# Used by network-multinet v1.x only
#
BRIDGE_NAME="xenbr"
## Type: list()
## Default: "eth0"
## Config:
#
# Space delimited list of physical network
# devices to create traditional bridges on
#
# Used by network-multinet v1.x only
#
# Example: "eth0 eth1 eth2"
#
# The above example would create 3 traditional bridges
# xenbr0 on eth0, xenbr1 on eth1 and xenbr2 on eth2
#
BRIDGE_NETDEV_LIST="eth0"
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of virtual network devices,mac addresses
# and IP addresses to create local bridges on using the following format:
#
# <virtual network device>,<mac address>,<IP address/CIDR NetMask>,<nat|hostonly|route>,<dhcp-on|dhcp-off>
#
# Example: "veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-on veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
#
# The above example would create 2 local bridged the first being a NATed network
# and the second being a host only network
#
# Used by network-multinet v1.x only
#
LOCAL_BRIDGE_LIST="veth2,00:16:3E:01:00:02,172.22.0.1/16,nat,dhcp-off veth3,00:16:3E:01:00:03,172.23.0.1/16,hostonly,dhcp-off"
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of bridge numbers/NICs to
# create "no-host" bridges on.
#
# No-Host bridges are bridges that are connected to a
# physical interface but not to an interface in Domain0.
# VMs connected to them are bridged to the outside world
# but cannot communicate with Domain0
#
# Example: "eth1,4"
#
# The above example would create a single NO-Host bridge named xenbr4
# that would have the eth1 interface connected to it as a bridge port
#
# Used by network-multinet v1.x only
#
NOHOST_BRIDGE_LIST=""
## Type: string(eth
## Type: list()
## Default: ""
## Config:
#
# Space delimited list of bridge numbers to
# create empty bridges on.
#
# Example: "4 5"
#
# The above example would create two empty bridges named xenbr4 and xenbr5
#
# Used by network-multinet v1.x only
#
EMPTY_BRIDGE_LIST="4"
## Type: string(128-249)
## Default: "128-249"
## Config:
@ -145,7 +85,7 @@ EMPTY_BRIDGE_LIST="4"
#
XEN_DHCP_RANGE="128-249"
## Type: string(137.65.1.1,137.65.1.2)
## Type: string(10.0.0.1,10.0.0.2)
## Default: "gateway"
## Config:
#
@ -153,7 +93,7 @@ XEN_DHCP_RANGE="128-249"
# If set to "gateway" then the IP address of the gateway will be
# set as the DNS server.
#
# Examples: "137.65.1.1,137.65.1.2"
# Examples: "10.0.0.1,10.0.0.2"
# "gateway"
#
XEN_DHCP_DNS_SERVERS="gateway"
@ -186,7 +126,7 @@ RELOCATION_NODELIST="any"
#
# If set to true the xend-relocation script will attempt to
# enable/disable vm migration on all relocation nodes listed
# in the RELOCATION_LIST variable.
# in the RELOCATION_NODELIST variable.
#
# Note: Communication with the nodes is done via ssh so
# pre-distributed ssh keys is recommended.
@ -200,4 +140,3 @@ MANAGE_ALL_RELOCATION_NODES="false"
# The TCP port used by Xen for VM relocation
#
XEN_RELOCATION_PORT="8002"

View File

@ -48,7 +48,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1528,6 +1528,9 @@ class XendDomainInfo:
@@ -1542,6 +1542,9 @@ class XendDomainInfo:
if devclass in XendDevices.valid_devices():
log.info("createDevice: %s : %s" % (devclass, scrub_password(config)))
dev_uuid = config.get('uuid')

View File

@ -1,12 +0,0 @@
Index: xen-3.2-testing/xen/arch/x86/x86_64/entry.S
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_64/entry.S
+++ xen-3.2-testing/xen/arch/x86/x86_64/entry.S
@@ -93,6 +93,7 @@ failsafe_callback:
jnc 1f
orb $TBF_INTERRUPT,TRAPBOUNCE_flags(%rdx)
1: call create_bounce_frame
+ andl $~X86_EFLAGS_DF,UREGS_eflags(%rsp)
jmp test_all_events
.previous
.section __pre_ex_table,"a"

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/xen/arch/x86/mm.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/mm.c
+++ xen-3.2-testing/xen/arch/x86/mm.c
@@ -3556,6 +3556,7 @@ static int ptwr_emulated_cmpxchg(
@@ -3586,6 +3586,7 @@ static int ptwr_emulated_cmpxchg(
container_of(ctxt, struct ptwr_emulate_ctxt, ctxt));
}
@ -10,7 +10,7 @@ Index: xen-3.2-testing/xen/arch/x86/mm.c
static int ptwr_emulated_cmpxchg8b(
enum x86_segment seg,
unsigned long offset,
@@ -3571,13 +3572,16 @@ static int ptwr_emulated_cmpxchg8b(
@@ -3601,13 +3602,16 @@ static int ptwr_emulated_cmpxchg8b(
offset, ((u64)old_hi << 32) | old, ((u64)new_hi << 32) | new, 8, 1,
container_of(ctxt, struct ptwr_emulate_ctxt, ctxt));
}
@ -133,20 +133,18 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -30,10 +30,11 @@
@@ -30,7 +30,10 @@
#include <xen/types.h>
#include <xen/lib.h>
#include <asm/regs.h>
+#include <asm/processor.h>
#undef cmpxchg
#undef cpuid
+#undef cpuid
+#undef wbinvd
#endif
-#undef wbinvd /* Macro'ed in include/asm-x86/system.h */
#include <asm-x86/x86_emulate.h>
/* Operand sizes: 8-bit operands or specified/overridden size. */
@@ -2978,58 +2979,63 @@ x86_emulate(
@@ -2978,60 +2981,64 @@ x86_emulate(
src.val = x86_seg_gs;
goto pop_seg;
@ -156,6 +154,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
- unsigned long old_lo, old_hi;
+ case 0xc7: /* Grp9 (cmpxchg{8,16}b) */
generate_exception_if((modrm_reg & 7) != 1, EXC_UD);
generate_exception_if(ea.type != OP_MEM, EXC_UD);
- if ( (rc = ops->read(ea.mem.seg, ea.mem.off+0, &old_lo, 4, ctxt)) ||
- (rc = ops->read(ea.mem.seg, ea.mem.off+4, &old_hi, 4, ctxt)) )
- goto done;
@ -188,6 +187,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
- {
- unsigned long old, new;
- generate_exception_if((modrm_reg & 7) != 1, EXC_UD);
- generate_exception_if(ea.type != OP_MEM, EXC_UD);
- if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &old, 8, ctxt)) != 0 )
- goto done;
- if ( ((uint32_t)(old>>0) != (uint32_t)_regs.eax) ||
@ -226,8 +226,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
+ &old_lo, sizeof(old_lo), ctxt)) ||
+ (rc = ops->read(ea.mem.seg, ea.mem.off+sizeof(old_lo),
+ &old_hi, sizeof(old_lo), ctxt)) )
goto done;
- _regs.eflags |= EFLG_ZF;
+ goto done;
+ if ( (old_lo != _regs.eax) || (old_hi != _regs.edx) )
+ {
+ _regs.eax = old_lo;
@ -237,7 +236,8 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
+ else if ( ops->cmpxchg2 == NULL )
+ {
+ rc = X86EMUL_UNHANDLEABLE;
+ goto done;
goto done;
- _regs.eflags |= EFLG_ZF;
+ }
+ else
+ {
@ -253,7 +253,7 @@ Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
case 0xc8 ... 0xcf: /* bswap */
dst.type = OP_REG;
@@ -3039,7 +3045,7 @@ x86_emulate(
@@ -3041,7 +3048,7 @@ x86_emulate(
{
default: /* case 2: */
/* Undefined behaviour. Writes zero on all tested CPUs. */

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7da7e0b2e35bba8e475d26a062540e83b76868bbcc3d3d3d7d1f447ce685115
size 6404909
oid sha256:8861bb05830342cad2424e1c1d26ce002fbbbaffbb5c7bfcc08ffd6f52dbccfb
size 5460134

View File

@ -0,0 +1,49 @@
Index: xen-3.2-testing/tools/ioemu/xenstore.c
===================================================================
--- xen-3.2-testing.orig/tools/ioemu/xenstore.c 2008-01-31 07:52:20.000000000 -0700
+++ xen-3.2-testing/tools/ioemu/xenstore.c 2008-01-31 07:56:00.000000000 -0700
@@ -478,7 +478,7 @@
void xenstore_process_event(void *opaque)
{
- char **vec, *image = NULL;
+ char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL;
unsigned int len, num, hd_index;
vec = xs_read_watch(xsh, &num);
@@ -505,8 +505,23 @@
goto out;
hd_index = vec[XS_WATCH_TOKEN][2] - 'a';
image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len);
- if (image == NULL || !strcmp(image, bs_table[hd_index]->filename))
- goto out; /* gone or identical */
+ if (image == NULL)
+ goto out; /* gone */
+
+ /* Strip off blktap sub-type prefix */
+ bpath = strdup(vec[XS_WATCH_PATH]);
+ if (bpath == NULL)
+ goto out;
+ if ((offset = strrchr(bpath, '/')) != NULL)
+ *offset = '\0';
+ if (pasprintf(&buf, "%s/type", bpath) == -1)
+ goto out;
+ drv = xs_read(xsh, XBT_NULL, buf, &len);
+ if (drv && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != NULL))
+ memmove(image, offset+1, strlen(offset+1)+1);
+
+ if (!strcmp(image, bs_table[hd_index]->filename))
+ goto out; /* identical */
do_eject(0, vec[XS_WATCH_TOKEN]);
bs_table[hd_index]->filename[0] = 0;
@@ -521,6 +536,9 @@
}
out:
+ free(drv);
+ free(buf);
+ free(bpath);
free(image);
free(vec);
}

270
xen-dhcpd
View File

@ -1,270 +0,0 @@
#!/bin/bash
#============================================================================
# xen-dhcpd
#
# Version = 1.0.2
# Date = 2007-09-14
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
# Contributers = Mike Friesenegger - mfriesenegger (at) novell (dot) com
#
# The latest version can be found at:
#
# http://pronetworkconsulting.com/linux/scripts/network-multinet.html
#
# Description:
#
# This script configures and enables the DHCP server for the networks on
# which it has been defined to run in the Xen network condifuration script
# config file.
#
#============================================================================
#### Read config files and set variables ##################################
# Source the configuration File
. /etc/sysconfig/xend
DHCPD_CONF_FILE="/etc/dhcpd.conf"
CONF_FILE_PATH="/etc/xen/conf"
SYSCONFIG_FILE="/etc/sysconfig/dhcpd"
#### Script Functions #####################################################
do_we_start_dhcpd() {
if ! echo $LOCAL_BRIDGE_LIST|grep -q "dhcp-on" || ! echo $NETWORK_LIST|grep -q "dhcp-on"
then
echo " The DHCP daemon is not configured on any network"
echo ""
echo " Not starting dhcpd for Xen"
echo "============================================================"
exit 1
fi
}
cleanup_old_dhcp_config_files() {
# A bit of housekeeping, cleaning up old configuration files
#echo "cleaning up /etc/xen/conf/"
#read
rm -rf /etc/xen/conf/*
#echo "cleaning up /etc/dhcpd-xen*"
#read
rm -rf /etc/dhcpd-xen*
#echo "cleaning up /etc/sysconfig/network/ifcfg-veth-id*"
#read
rm -rf /etc/sysconfig/network/ifcfg-veth-id*
}
create_xen_dhcp_config_files() {
# backup original dhcpd sysconfig file
#echo "backup original dhcpd sysconfig file"
#read
cp "$SYSCONFIG_FILE" "$CONF_FILE_PATH"/dhcpd.xensave
cp "$DHCPD_CONF_FILE" "$CONF_FILE_PATH/dhcpd.conf.xensave"
for IFACE in $LOCAL_BRIDGE_LIST
do
# If DHCPON is set to dhcp-off, skip creating config files for vethX
#---------------------------------------------------------------------
local DHCPON=`echo $IFACE|cut -d "," -f 5`
test "$DHCPON" = "dhcp-off" && continue
# Set local function variables
#---------------------------------------------------------------------
local DEV=`echo $IFACE|cut -d "," -f 1`
local MAC=`echo $IFACE|cut -d "," -f 2`
local IPCIDR=`echo $IFACE|cut -d "," -f 3`
local IPADDR=`echo $IPCIDR|cut -d "/" -f 1`
local RANGE="`echo $IPADDR|cut -d "." -f 1,2,3`.`echo $XEN_DHCP_RANGE|cut -d "-" -f 1` - `echo $IPADDR|cut -d "." -f 1,2,3`.`echo $XEN_DHCP_RANGE|cut -d "-" -f 2`"
local SUBNET=`ipcalc -n -b $IPCIDR|grep "Network:"|cut -d ":" -f 2|cut -d "/" -f 1`
local NETMASK=`ipcalc -n -b $IPCIDR|grep "Netmask:"|cut -d ":" -f 2|cut -d "=" -f 1`
local BRIDGE_NUM=${DEV##${DEV%%[0-9]*}}
local BR_NAME=$BRIDGE_NAME$BRIDGE_NUM
case $XEN_DHCP_DNS_SERVERS in
gateway)
# Use Dom0 as the DNS server
local DNS=$IPADDR
;;
*)
# Specify DNS server(s)
if test `echo $XEN_DHCP_DNS_SERVERS|grep -c ","`
then
local DNS=`echo $XEN_DHCP_DNS_SERVERS|sed "s/,/, /"`
else
local DNS=`echo $XEN_DHCP_DNS_SERVERS`
fi
;;
esac
# echo out what we are doing
#---------------------------------------------------------------------
echo "------------------------------------------------------------"
echo " Configuring dhcpd for bridge: $BR_NAME"
echo " on Interface: $DEV"
echo " -------------------"
echo " Subnet: $SUBNET"
echo " Netmask: $NETMASK"
echo " Range: $RANGE"
echo " DNS Servers: $DNS"
echo " Gateway: $IPADDR"
echo "------------------------------------------------------------"
# Create network ifcfg-veth config file
# THIS IS NOT NECESSARY UNLESS YOU WANT TO SEE THE NIC IN YAST TOOLS
#---------------------------------------------------------------------
echo "NAME='XEN Virtual Ethernet - $DEV'" > /etc/sysconfig/network/ifcfg-veth-id-$MAC
# Create the dhcpd-xen.vethX.conf file
#---------------------------------------------------------------------
echo "ddns-update-style none;" > /etc/dhcpd-xen.$DEV.conf
echo "subnet $SUBNET netmask $NETMASK {" >> /etc/dhcpd-xen.$DEV.conf
echo " range `echo $RANGE | tr -d -`;" >> /etc/dhcpd-xen.$DEV.conf
echo " default-lease-time 14400;" >> /etc/dhcpd-xen.$DEV.conf
echo " max-lease-time 14400;" >> /etc/dhcpd-xen.$DEV.conf
echo " option domain-name-servers $DNS;" >> /etc/dhcpd-xen.$DEV.conf
echo " option routers $IPADDR;" >> /etc/dhcpd-xen.$DEV.conf
echo "}" >> /etc/dhcpd-xen.$DEV.conf
# edit the dhcpd sysconfig file for xen
#---------------------------------------------------------------------
#echo "editing DHCPD_INTERFACE in $SYSCONFIG_FILE"
#read
sed -i "s/^DHCPD_INTERFACE=\"\([^\"]*\)\"/DHCPD_INTERFACE=\"\1 veth-id-$MAC\"/" $SYSCONFIG_FILE
#echo "editing DHCPD_CONF_INCLUDE_FILES in $SYSCONFIG_FILE"
#read
sed -i "s/^DHCPD_CONF_INCLUDE_FILES=\"\([^\"]*\)\"/DHCPD_CONF_INCLUDE_FILES=\"\1\/etc\/dhcpd-xen.$DEV.conf\"/" $SYSCONFIG_FILE
# edit the dhcpd.conf file to include additional dhcpd configs for xen
#---------------------------------------------------------------------
echo "include \"/etc/dhcpd-xen.$DEV.conf\";" >> $DHCPD_CONF_FILE
done
}
restore_original_dhcp_config_files() {
# Restore the original dhcpd.conf file
#---------------------------------------------------------------------
#echo "restoring original dhcpd.conf"
#read
mv $CONF_FILE_PATH/dhcpd.xensave $SYSCONFIG_FILE > /dev/null 2>&1
mv $CONF_FILE_PATH/dhcpd.conf.xensave $DHCPD_CONF_FILE > /dev/null 2>&1
# FIXME: should I be doing this in the for loop below using sed?
for IFACE in $LOCAL_BRIDGE_LIST
do
# If DHCPON is set to dhcp-off, skip creating config files for vethX
#---------------------------------------------------------------------
local DHCPON=`echo $IFACE|cut -d "," -f 5`
test "$DHCPON" = "dhcp-off" && continue
# Set local function variables
#---------------------------------------------------------------------
local DEV=`echo $IFACE|cut -d "," -f 1`
local MAC=`echo $IFACE|cut -d "," -f 2`
local IPCIDR=`echo $IFACE|cut -d "," -f 3`
local IPADDR=`echo $IPCIDR|cut -d "/" -f 1`
local RANGE="`echo $IPADDR|cut -d "." -f 1,2,3`.`echo $XEN_DHCP_RANGE|cut -d "-" -f 1` `echo $IPADDR|cut -d "." -f 1,2,3`.`echo $XEN_DHCP_RANGE|cut -d "-" -f 2`"
local SUBNET=`ipcalc -n -b $IPCIDR|grep "Network:"|cut -d ":" -f 2|cut -d "/" -f 1`
local NETMASK=`ipcalc -n -b $IPCIDR|grep "Netmask:"|cut -d ":" -f 2|cut -d "=" -f 1`
# echo out what we are doing
#---------------------------------------------------------------------
echo " Removing dhcpd configuration for bridge: $BR_NAME"
echo "------------------------------------------------------------"
# Delete network ifcfg-veth config file
#---------------------------------------------------------------------
#echo "deleteing ifcfg-veth-$MAC"
#read
rm -rf /etc/sysconfig/network/ifcfg-veth-id-$MAC
# Delete the dhcpd-xen.vethX.conf file
#---------------------------------------------------------------------
#echo "deleteing dhcpd-xen.$DEV.conf"
#read
rm -rf /etc/dhcpd-xen.$DEV.conf
# Restore the original dhcpd.conf file
#---------------------------------------------------------------------
# FIXME: should I be doing this with sed here instead?
done
}
#### Start, Stop, Status Functions ########################################
start_xen_dhcpd() {
do_we_start_dhcpd
#cleanup_old_dhcp_config_files
create_xen_dhcp_config_files
echo ""
echo " Starting the DHCP Daemon on configured networks"
/etc/init.d/dhcpd restart
}
stop_xen_dhcpd() {
#/etc/init.d/dhcpd stop
restore_original_dhcp_config_files
if grep -Rl "Short-Description:.*DHCP Server" /etc/init.d/rc`runlevel|cut -d " " -f 2`.d|grep -q "S"
then
/etc/init.d/dhcpd restart
fi
}
xen_dhcpd_status () {
/etc/init.d/dhcpd status
}
#### Main Code Body #######################################################
# Check to see if dhcpd and ipcalc are installed
if [ -e /usr/sbin/dhcpd ] && [ -e /etc/init.d/dhcpd ] && [ -e $SYSCONFIG_FILE ] && [ -e /usr/bin/ipcalc ]
then
echo ""
echo "============================================================"
case $1 in
start)
start_xen_dhcpd
exit 0
;;
stop)
stop_xen_dhcpd
exit 0
;;
restart)
stop_xen_dhcpd
start_xen_dhcpd
exit 0
;;
status)
/etc/init.d/dhcpd status
exit 0
;;
esac
echo "============================================================"
else
echo ""
echo "============================================================"
if [ ! -e /usr/sbin/dhcpd ] && [ ! -e /etc/init.d/dhcpd ] && [ ! -e $SYSCONFIG_FILE ]
then
echo ""
echo " The DHCP Daemon is not installed or is missing needed files."
fi
if [ ! -e /usr/bin/ipcalc ]
then
echo ""
echo " The ipcalc package is not installed."
fi
echo ""
echo " Skipping starting dhcpd for Xen"
echo "============================================================"
exit 1
fi

View File

@ -147,7 +147,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
from xen.xend.XendError import XendError, VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.XendTask import XendTask
@@ -1484,6 +1484,10 @@ class XendDomainInfo:
@@ -1498,6 +1498,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@ -158,7 +158,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -2012,8 +2016,11 @@ class XendDomainInfo:
@@ -2026,8 +2030,11 @@ class XendDomainInfo:
blexec = osdep.pygrub_path
blcfg = None
@ -172,7 +172,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
if not disks:
msg = "Had a bootloader specified, but no disks are bootable"
@@ -2024,13 +2031,10 @@ class XendDomainInfo:
@@ -2038,13 +2045,10 @@ class XendDomainInfo:
devtype = devinfo[0]
disk = devinfo[1]['uname']
@ -189,7 +189,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
log.info("Mounting %s on %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))
@@ -2042,7 +2046,9 @@ class XendDomainInfo:
@@ -2056,7 +2060,9 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()

View File

@ -1,38 +1,217 @@
diff -r 15cfd1f8fa38 tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c Tue Jan 08 16:45:08 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c Thu Jan 10 12:20:59 2008 -0700
@@ -78,6 +78,7 @@ static void xenfb_invalidate(void *opaqu
+++ b/tools/ioemu/hw/xenfb.c Thu Jan 17 12:16:49 2008 -0700
@@ -8,6 +8,7 @@
#include <xen/io/fbif.h>
#include <xen/io/kbdif.h>
#include <xen/io/protocols.h>
+#include <xen/grant_table.h>
#include <stdbool.h>
#include <xen/event_channel.h>
#include <sys/mman.h>
@@ -45,6 +46,7 @@ struct xenfb {
struct xs_handle *xsh; /* xs daemon handle */
struct xenfb_device fb, kbd;
void *pixels; /* guest framebuffer data */
+ void *old_pixels; /* guest FB data before remapping to extended */
size_t fb_len; /* size of framebuffer */
int row_stride; /* width of one row in framebuffer */
int depth; /* colour depth of guest framebuffer */
@@ -52,7 +54,9 @@ struct xenfb {
int height; /* pixel height of guest framebuffer */
int abs_pointer_wanted; /* Whether guest supports absolute pointer */
int button_state; /* Last seen pointer button state */
- char protocol[64]; /* frontend protocol */
+ char protocol[64]; /* frontend protocol */
+ int otherend_bsize; /* frontend bit size */
+ int gnttabdev;
};
/* Functions for frontend/backend state machine*/
@@ -78,6 +82,9 @@ static void xenfb_invalidate(void *opaqu
static void xenfb_invalidate(void *opaque);
static void xenfb_screen_dump(void *opaque, const char *name);
static int xenfb_register_console(struct xenfb *xenfb);
+static int xenfb_send_resize(struct xenfb *xenfb, int width, int height);
+static void xenfb_map_extended_fb(struct xenfb *xenfb, int, int, int);
+static int xenfb_send_map_extended_done(struct xenfb *xenfb);
/*
* Tables to map from scancode to Linux input layer keycode.
@@ -264,6 +265,9 @@ struct xenfb *xenfb_new(int domid, Displ
@@ -261,9 +268,19 @@ struct xenfb *xenfb_new(int domid, Displ
if (!xenfb->xsh)
goto fail;
+ xenfb->gnttabdev = xc_gnttab_open();
+ if (xenfb->gnttabdev == -1) {
+ fprintf(stderr, "FB: Can't open gnttab device\n");
+ }
+
xenfb->ds = ds;
xenfb_device_set_domain(&xenfb->fb, domid);
xenfb_device_set_domain(&xenfb->kbd, domid);
+
+ /* Indicate we have the frame buffer resize feature */
+ xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "feature-resize", "1");
+ /* Indicate we have the frame buffer resize feature, requires grant tables */
+ if (xenfb->gnttabdev > 0) {
+ xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "feature-resize", "1");
+ }
fprintf(stderr, "FB: Waiting for KBD backend creation\n");
xenfb_wait_for_backend(&xenfb->kbd, xenfb_backend_created_kbd);
@@ -510,6 +514,12 @@ static void xenfb_on_fb_event(struct xen
@@ -320,6 +337,58 @@ static void xenfb_copy_mfns(int mode, in
for (i = 0; i < count; i++)
dst[i] = (mode == 32) ? src32[i] : src64[i];
+}
+
+static void xenfb_map_extended_fb(struct xenfb *xenfb, int extended_mem_length,
+ int gref_cnt, int gref)
+{
+ int n_fbmfns;
+ unsigned long *fbmfns = NULL;
+ void *page;
+ int i;
+ int ep_gref;
+ int amt;
+ int index;
+ void *pixels;
+ int *grefs;
+
+ grefs = xc_gnttab_map_grant_ref (xenfb->gnttabdev,
+ xenfb->fb.otherend_id,
+ gref, 0);
+ if (NULL == grefs) {
+ fprintf(stderr,"FB: Can't map to grant refs\n");
+ return;
+ }
+ n_fbmfns = (extended_mem_length + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
+ fbmfns = malloc(sizeof(unsigned long) * n_fbmfns);
+ if (fbmfns) {
+ ep_gref = PAGE_SIZE/(xenfb->otherend_bsize/8);
+ amt = index = 0;
+ for(i = 0; i < gref_cnt; i++) {
+ page = xc_gnttab_map_grant_ref (xenfb->gnttabdev,
+ xenfb->fb.otherend_id,
+ grefs[i], 0);
+ if (page) {
+ index = i * ep_gref;
+ amt = ep_gref;
+ if (n_fbmfns - index < ep_gref)
+ amt = n_fbmfns - index;
+ xenfb_copy_mfns(xenfb->otherend_bsize, amt, &fbmfns[index], page);
+ xc_gnttab_munmap(xenfb->gnttabdev, page, 1);
+ }
+ else
+ goto gref_error;
+ }
+ pixels = xc_map_foreign_pages(xenfb->xc, xenfb->fb.otherend_id,
+ PROT_READ | PROT_WRITE, fbmfns, n_fbmfns);
+ if (pixels) {
+ xenfb->old_pixels = xenfb->pixels;
+ xenfb->pixels = pixels;
+ }
+ free(fbmfns);
+ }
+gref_error:
+ xc_gnttab_munmap(xenfb->gnttabdev, grefs, 1);
}
static int xenfb_map_fb(struct xenfb *xenfb, int domid)
@@ -377,6 +446,7 @@ static int xenfb_map_fb(struct xenfb *xe
#endif
}
+ xenfb->otherend_bsize = mode;
n_fbmfns = (xenfb->fb_len + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
n_fbdirs = n_fbmfns * mode / 8;
n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
@@ -456,6 +526,10 @@ static void xenfb_detach_dom(struct xenf
munmap(xenfb->pixels, xenfb->fb_len);
xenfb->pixels = NULL;
}
+ if (xenfb->old_pixels) {
+ munmap(xenfb->old_pixels, xenfb->fb_len);
+ xenfb->old_pixels = NULL;
+ }
}
/* Remove the backend area in xenbus since the framebuffer really is
@@ -473,6 +547,9 @@ void xenfb_shutdown(struct xenfb *xenfb)
xc_evtchn_close(xenfb->evt_xch);
if (xenfb->xsh)
xs_daemon_close(xenfb->xsh);
+ if (xenfb->gnttabdev > 0)
+ xc_gnttab_close(xenfb->gnttabdev);
+
free(xenfb);
}
@@ -510,6 +587,22 @@ static void xenfb_on_fb_event(struct xen
}
xenfb_guest_copy(xenfb, x, y, w, h);
break;
+ case XENFB_TYPE_RESIZE:
+ xenfb->width = event->resize.width;
+ xenfb->height = event->resize.height;
+ xenfb->row_stride = event->resize.stride;
+ dpy_resize(xenfb->ds, xenfb->width, xenfb->height);
+ xenfb_send_resize(xenfb, xenfb->width, xenfb->height);
+ break;
+ case XENFB_TYPE_MAP_EXTENDED:
+ if (xenfb->gnttabdev > 0) {
+ xenfb_map_extended_fb(xenfb,
+ event->map_extended.extended_mem_length,
+ event->map_extended.gref_cnt,
+ event->map_extended.gref);
+ }
+ xenfb_send_map_extended_done(xenfb);
+ break;
}
}
mb(); /* ensure we're done with ring contents */
@@ -601,6 +611,19 @@ static int xenfb_send_motion(struct xenf
@@ -555,6 +648,41 @@ static int xenfb_on_state_change(struct
return 0;
}
+/* Send an event to the framebuffer frontend driver */
+static int xenfb_fb_event(struct xenfb *xenfb,
+ union xenfb_in_event *event)
+{
+ uint32_t prod;
+ struct xenfb_page *page = xenfb->fb.page;
+
+ if (xenfb->fb.state != XenbusStateConnected)
+ return 0;
+
+ prod = page->in_prod;
+ if (prod - page->in_cons == XENFB_IN_RING_LEN) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ mb(); /* ensure ring space available */
+ XENFB_IN_RING_REF(page, prod) = *event;
+ wmb(); /* ensure ring contents visible */
+ page->in_prod = prod + 1;
+ return xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port);
+}
+
+/* Send a extended memory map done event to kbd driver */
+static int xenfb_send_map_extended_done(struct xenfb *xenfb)
+{
+ union xenfb_in_event event;
+
+ memset(&event, 0, XENFB_IN_EVENT_SIZE);
+ event.type = XENFB_TYPE_MAP_EXTENDED_DONE;
+
+ return xenfb_fb_event(xenfb, &event);
+}
+
+
/* Send an event to the keyboard frontend driver */
static int xenfb_kbd_event(struct xenfb *xenfb,
union xenkbd_in_event *event)
@@ -601,6 +729,19 @@ static int xenfb_send_motion(struct xenf
event.motion.rel_x = rel_x;
event.motion.rel_y = rel_y;
event.motion.rel_z = rel_z;
@ -46,16 +225,28 @@ diff -r 15cfd1f8fa38 tools/ioemu/hw/xenfb.c
+ union xenkbd_in_event event;
+
+ memset(&event, 0, XENKBD_IN_EVENT_SIZE);
+ event.type = XENKBD_TYPE_RESIZE;
+ event.resize.width = width;
+ event.resize.height = height;
+ event.type = XENKBD_TYPE_FBRESIZE;
+ event.fbresize.width = width;
+ event.fbresize.height = height;
return xenfb_kbd_event(xenfb, &event);
}
diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
--- a/xen/include/public/io/fbif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/fbif.h Thu Jan 10 11:00:13 2008 -0700
@@ -50,12 +50,26 @@ struct xenfb_update
+++ b/xen/include/public/io/fbif.h Thu Jan 17 08:16:28 2008 -0700
@@ -29,8 +29,9 @@
/* Out events (frontend -> backend) */
/*
- * Out events may be sent only when requested by backend, and receipt
- * of an unknown out event is an error.
+ * Out event update is sent only when requested by backend
+ * Events resize and map_extended are frontend generated
+ * It is an error to send any unknown event types
*/
/* Event type 1 currently not used */
@@ -50,12 +51,44 @@ struct xenfb_update
int32_t height; /* rect height */
};
@ -68,8 +259,25 @@ diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
+struct xenfb_resize
+{
+ uint8_t type; /* XENFB_TYPE_RESIZE */
+ int32_t width; /* frame buffer width in pixels */
+ int32_t height; /* frame buffer height in pixels */
+ int32_t width; /* width in pixels */
+ int32_t height; /* height in pixels */
+ int32_t stride; /* stride in pixels */
+ int32_t depth; /* future */
+};
+
+/*
+ * Framebuffer map extended memory event
+ * Causes backend to map extended frame buffer memory
+ * for larger screen resolution support
+ */
+#define XENFB_TYPE_MAP_EXTENDED 4
+
+struct xenfb_map_extended
+{
+ uint8_t type; /* XENFB_TYPE_MAP_EXTENDED */
+ int32_t extended_mem_length; /* extended frame buffer len (in bytes) */
+ int32_t gref_cnt; /* number of mapping refernces used */
+ int32_t gref; /* reference to mapping references */
+};
+
#define XENFB_OUT_EVENT_SIZE 40
@ -79,22 +287,39 @@ diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
uint8_t type;
struct xenfb_update update;
+ struct xenfb_resize resize;
+ struct xenfb_map_extended map_extended;
char pad[XENFB_OUT_EVENT_SIZE];
};
@@ -109,15 +123,18 @@ struct xenfb_page
* Each directory page holds PAGE_SIZE / sizeof(*pd)
* framebuffer pages, and can thus map up to PAGE_SIZE *
* PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE == 4096 and
- * sizeof(unsigned long) == 4, that's 4 Megs. Two directory
- * pages should be enough for a while.
+ * sizeof(unsigned long) == 4 on a 32 bit system that's 4 Megs
+ * sizeof(unsigned long) == 8 on a 64 bit system that's 2 Megs
+ * Will need 3 directory page entries to support a 5MB frame
+ * buffer which is enough for a 1280x1024 display
*/
- unsigned long pd[2];
+ unsigned long pd[3];
@@ -63,14 +96,26 @@ union xenfb_out_event
/*
* Frontends should ignore unknown in events.
- * No in events currently defined.
*/
+
+/*
+ * Framebuffer map extended memory done event
+ * Causes fronted to end foreign access to extended memory
+ * grant table references
+ */
+#define XENFB_TYPE_MAP_EXTENDED_DONE 1
+
+struct xenfb_map_extended_done
+{
+ uint8_t type; /* XENFB_TYPE_MAP_EXTENDED_DONE */
+};
#define XENFB_IN_EVENT_SIZE 40
union xenfb_in_event
{
uint8_t type;
+ struct xenfb_map_extended_done map_extended_done;
char pad[XENFB_IN_EVENT_SIZE];
};
@@ -116,8 +161,9 @@ struct xenfb_page
};
/*
@ -108,37 +333,38 @@ diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
#define XENFB_WIDTH 800
diff -r 15cfd1f8fa38 xen/include/public/io/kbdif.h
--- a/xen/include/public/io/kbdif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/kbdif.h Thu Jan 10 12:28:09 2008 -0700
@@ -44,6 +44,11 @@
+++ b/xen/include/public/io/kbdif.h Thu Jan 17 10:43:35 2008 -0700
@@ -44,6 +44,12 @@
* request-abs-update in xenstore.
*/
#define XENKBD_TYPE_POS 4
+/*
+ * Sent when frame buffer is resized. kbd adjusts absolute
+ * max X and Y axis values in input ptr device.
+ * Frame buffer resize event. Adjusts absolute max X and Y axis
+ * values in input ptr device. Necessary for proper scaling
+ * when the screen resolution changes
+ */
+#define XENKBD_TYPE_RESIZE 5
+#define XENKBD_TYPE_FBRESIZE 5
struct xenkbd_motion
{
@@ -68,6 +73,12 @@ struct xenkbd_position
@@ -68,6 +74,12 @@ struct xenkbd_position
int32_t abs_z; /* absolute Z position (wheel) */
};
+struct xenkbd_resize
+struct xenkbd_fbresize
+{
+ uint8_t type; /* XENKBD_TYPE_RESIZE */
+ uint8_t type; /* XENKBD_TYPE_FBRESIZE */
+ int32_t width; /* frame buffer width in pixels */
+ int32_t height; /* frame buffer height in pixels */
+};
#define XENKBD_IN_EVENT_SIZE 40
union xenkbd_in_event
@@ -76,6 +87,7 @@ union xenkbd_in_event
@@ -76,6 +88,7 @@ union xenkbd_in_event
struct xenkbd_motion motion;
struct xenkbd_key key;
struct xenkbd_position pos;
+ struct xenkbd_resize resize;
+ struct xenkbd_fbresize fbresize;
char pad[XENKBD_IN_EVENT_SIZE];
};

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-3.2-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.2-testing/tools/examples/xend-config.sxp
@@ -132,7 +132,8 @@
@@ -130,7 +130,8 @@
#
# (network-script 'network-bridge netdev=eth1')
#

View File

@ -1,18 +0,0 @@
Index: xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
===================================================================
--- xen-3.2-testing.orig/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
+++ xen-3.2-testing/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
@@ -249,6 +249,13 @@ static int __devinit netfront_probe(stru
int err;
struct net_device *netdev;
struct netfront_info *info;
+ unsigned int handle;
+
+ err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%u", &handle);
+ if (err != 1) {
+ xenbus_dev_fatal(dev, err, "reading handle");
+ return err;
+ }
netdev = create_netdev(dev);
if (IS_ERR(netdev)) {

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendNode.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendNode.py
+++ xen-3.2-testing/tools/python/xen/xend/XendNode.py
@@ -585,10 +585,34 @@ class XendNode:
@@ -579,10 +579,34 @@ class XendNode:
info['cpu_mhz'] = info['cpu_khz'] / 1000
@ -41,7 +41,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendNode.py
ITEM_ORDER = ['nr_cpus',
'nr_nodes',
@@ -598,6 +622,9 @@ class XendNode:
@@ -592,6 +616,9 @@ class XendNode:
'hw_caps',
'total_memory',
'free_memory',
@ -92,7 +92,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -680,6 +680,27 @@ class XendDomainInfo:
@@ -685,6 +685,27 @@ class XendDomainInfo:
return dev_info

View File

@ -185,20 +185,6 @@ Index: xen-3.2-testing/tools/xenstore/xsls.c
fputs(" (", stdout);
for (i = 0; i < nperms; i++) {
if (i)
Index: xen-3.2-testing/xen/arch/x86/x86_emulate.c
===================================================================
--- xen-3.2-testing.orig/xen/arch/x86/x86_emulate.c
+++ xen-3.2-testing/xen/arch/x86/x86_emulate.c
@@ -31,7 +31,9 @@
#include <xen/lib.h>
#include <asm/regs.h>
#undef cmpxchg
+#undef cpuid
#endif
+#undef wbinvd /* Macro'ed in include/asm-x86/system.h */
#include <asm-x86/x86_emulate.h>
/* Operand sizes: 8-bit operands or specified/overridden size. */
Index: xen-3.2-testing/tools/libxen/src/xen_common.c
===================================================================
--- xen-3.2-testing.orig/tools/libxen/src/xen_common.c

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 1 16:11:59 MST 2008 - carnold@novell.com
- Update to xen 3.2 FCS. Changeset 16718
- Merge xen-tools and xen-tools-ioemu into xen-tools.
-------------------------------------------------------------------
Sat Jan 12 00:37:41 CET 2008 - carnold@suse.de
@ -676,7 +682,7 @@ Thu Feb 8 16:54:59 MST 2007 - ccoffing@novell.com
+ #239582: Use extracted kernel-xen/initrd-xen if present
-------------------------------------------------------------------
Tue Feb 6 12:02:47 CET 2007 - ro@suse.de
Tue Feb 6 12:02:47 MST 2007 - ro@suse.de
- disable commented out buildreq for kernel for the moment
to workaround endless rebuild

814
xen.spec

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2690,6 +2690,14 @@ class XendDomainInfo:
@@ -2707,6 +2707,14 @@ class XendDomainInfo:
if not config.has_key('backend'):
config['backend'] = "00000000-0000-0000-0000-000000000000"

View File

@ -31,7 +31,7 @@ Index: xen-3.2-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-3.2-testing.orig/tools/examples/xend-config.sxp
+++ xen-3.2-testing/tools/examples/xend-config.sxp
@@ -51,16 +51,19 @@
@@ -49,16 +49,19 @@
#
# (9367 pam '' /etc/xen/xen-api.key /etc/xen/xen-api.crt)
#
@ -55,7 +55,7 @@ Index: xen-3.2-testing/tools/examples/xend-config.sxp
#(xend-unix-path /var/lib/xend/xend-socket)
@@ -138,7 +141,52 @@
@@ -136,7 +139,54 @@
# two fake interfaces per guest domain. To do things like this, write
# yourself a wrapper script, and call network-bridge from it, as appropriate.
#
@ -67,40 +67,42 @@ Index: xen-3.2-testing/tools/examples/xend-config.sxp
+# multiple networks, supporting the following types:
+#
+#
+# bridged: -Networks that contain both a physical network device (ethX)
+# and a virtual network device (vethX) from Dom0.
+# -This is the traditional type of network created in xen by
+# This script can create 6 types of networks:
+#
+# bridged: -Networks that are connected to a physical network device
+# in Dom0 and on which Dom0 can communitcate
+# -This is the traditional type of network created in xen by
+# the basic network-bridge script.
+# -VMs on these network(s) appear to be on the real network(s)
+#
+# nohost: -Networks that contain a physical network device but not a
+# virtual network device from Dom0.
+# -These can be used to allow virtual machines to communicate
+# with the outside world but not with Dom0.
+# nohost: -Networks that are connected to Dom0 but on which Dom0 cannot
+# communitcate
+# -These can be used to allow virtual machines to communicate
+# with the outside world but not with Dom0.
+# (Usefull if you want to isolate traffic away from Dom0)
+#
+# hostonly: -Networks that contain only a virtual network device (vethX)
+# from Dom0.
+# -This type of network will allow VMs connected to it to
+# hostonly: -Networks that are connected to Dom0 but are private from
+# the physical network
+# -This type of network will allow VMs connected to it to
+# access only Dom0 and other VMs connected to the network.
+# -This type of network is similiar to a VMware "HOST ONLY"
+# -This type of network is similiar to a VMware "HOST ONLY"
+# network.
+#
+# nat: -Networks that contain only a virtual network device (vethX)
+# from Dom0.
+# -This type of network will allow VMs connected to it to access
+# Dom0,the "outside world" via NAT and other VMs connected to it.
+# nat: -Networks that are connected to Dom0 and are private from the
+# physical network but VMs can get out to the physical network
+# -This type of network will allow VMs connected to it to access
+# Dom0, the "outside world" via NAT and other VMs connected to it.
+# -This type of network is similiar to a VMware "NAT" network.
+#
+# routed: -Networks that contain only a virtual network device (vethX)
+# from Dom0.
+# -This type of network will allow VMs connected to it to access
+# Dom0,the "outside world" via routing through Dom0 and other VMs
+# routed: -Networks that are not directly connected to the physical network
+# but who's traffic is directly routed to other networks
+# -This type of network will allow VMs connected to it to access
+# Dom0, the "outside world" via routing through Dom0 and other VMs
+# connected to it.
+#
+# empty: -Networks that do not contain any physical or virtual network
+# devices from Dom0.
+# -These can be used to allow VMs in DomUs to communicate only
+# empty: -Networks that are not connected to either Dom0 or the physical
+# network
+# -These can be used to allow VMs in DomUs to communicate only
+# with other DomUs and not Dom0.
+#
+# See /etc/xen/scripts/network-multinet for more details.

13
xend-core-dump-loc.diff Normal file
View File

@ -0,0 +1,13 @@
Index: xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1490,7 +1490,7 @@ class XendDomainInfo:
try:
if not corefile:
this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())
- corefile = "/var/xen/dump/%s-%s.%s.core" % (this_time,
+ corefile = "/var/lib/xen/dump/%s-%s.%s.core" % (this_time,
self.info['name_label'], self.domid)
if os.path.isdir(corefile):

514
xend-network Normal file
View File

@ -0,0 +1,514 @@
#!/bin/bash
#============================================================================
# xend-network
#
# Version = 1.1.1
# Date = 2008-01-10
#
# Maintainer(s) = Ron Terry - ron (at) pronetworkconsulting (dot) com
#
# The latest version can be found at:
#
# http://pronetworkconsulting.com/linux/scripts/network-multinet.html
#
# Description:
#
# This script creates, deletes, and modifies virtual networks on the fly
# without having to restart the Xen network script. The same functions
# are used to create/delete virtual networks in this script as are used
# in the network-multinet network script.
#
# Vars:
#
# SCRIPT_PATH- -Path to the directory that contains the Xen
# network helper scripts
#
# DEFAULT_SNM -Default subnet mask value to use (number of bits)
# if not defined from the command line
#
# MODE -Mode that the xend-network script is running in:
# (add, del, delall, mod, show)
#
# NET_DEV -Network interface name
# NET_DEV_MAC -MAC address to be assigned to the network interface
# NET_DEV_IP -IP address to be assigned to the network interface
# NET_TYPE -Type of netowrk
# (bridge, nat, hostonly, route, nohost, empty)
# NET_NUMBER -Number of the specifed network type
# NET_NAME -Name of the specified network
# (xenbr, xennat, xenhost, xenroute, xennohost, xenempty)
# NAT_EXTERNAL_INTERFACE -Network interface to masquerade all NAT network
# trafic with
# NET_DHCP_SRV -Parameter defining whether or not the DHCP server
# should be enabled on the specified network:
# (dhcp-on, dhcp-off)
#============================================================================
#### Read config files and set variables ##################################
SCRIPT_PATH="/etc/xen/scripts"
DEFAULT_SNM="24"
. $SCRIPT_PATH/multinet-common.sh
#### Script Functions #####################################################
usage() {
echo "Usage: xend-network add|del|mod {options}"
echo
echo " Options: -t <bridge type> :bridged|nat|hostonly|routed|nohost|empty"
echo " -i <dev> :Virtual network interface - vethX"
echo " (for nat, hostonly and routed bridges only)"
echo " -I <Pdev> :Physical network interface - ethX"
echo " (for bridged and nohost bridges only)"
echo " -m <MAC addr> :MAC address"
echo " (for nat, hostonly and routed bridges only)"
echo " -a <IP Address> :IP address"
echo " (for nat, hostonly and routed bridges only)"
echo " -n <bridge #> :Bridge number (optional)"
echo " -N <bridge name> :Bridge name (optional)"
echo " -M <bridge name> :New Bridge name (used with rename option only)"
echo " -e <ext iface> :External network interface"
echo " (optional - for nat and routed networks only)"
echo " -d :Enable DHCP on this network"
echo
echo "Examples:"
echo
echo " bridged network: xend-network add -t bridge -i eth0"
echo " nat network: xend-network add -t nat -i veth0 -m 00:11:22:aa:bb:cc -a 10.0.0.1"
echo " hostonly network: xend-network add -t hostonly -i veth0 -m 00:11:22:aa:bb:cc -a 10.0.0.1"
echo " routed network: xend-network add -t route -i veth0 -m 00:11:22:aa:bb:cc -a 10.0.0.1"
echo " nohost network: xend-network add -t nohost -i eth0"
echo " empty network: xend-network add -t empty"
echo " empty network: xend-network del -N nat1"
}
get_mode() {
if ! [ -z "$1" ] && ! echo "$1" | grep -q "^-"
then
case $1 in
add)
MODE="add"
echo "Running in add mode"
;;
del)
MODE="del"
echo "Running in delete mode"
;;
delall)
MODE="delall"
echo "Running in delete-all mode"
;;
mod)
MODE="mod"
echo "Running in modify mode"
;;
show)
MODE="show"
echo "Running in show mode"
;;
esac
shift
echo "Options: $*"
get_options $*
else
usage
exit 1
fi
}
get_options() {
while getopts "t:i:I:m:a:n:N:M:e:dh" OPTIONS
do
case $OPTIONS in
i)
NET_DEV=$OPTARG
echo "Network Interface = $NET_DEV"
echo "----------------------------"
;;
I)
NET_DEV=$OPTARG
echo "Network Interface = $NET_DEV"
echo "----------------------------"
;;
m)
NET_DEV_MAC=$OPTARG
echo "MAC Address = $NET_DEV_MAC"
echo "----------------------------"
;;
a)
NET_DEV_IP=$OPTARG
echo "IP Address = $NET_DEV_IP"
echo "----------------------------"
;;
t)
NET_TYPE=$OPTARG
echo "Network type = $NET_TYPE"
echo "----------------------------"
;;
n)
NET_NUMBER=$OPTARG
echo "Number of Network Type = $NET_NUMBER"
echo "----------------------------"
;;
N)
NET_NAME=$OPTARG
echo "Network Name = $NET_NAME"
echo "----------------------------"
;;
M)
NEW_NET_NAME=$OPTARG
echo "New Network Name = $NEW_NET_NAME"
echo "----------------------------"
;;
e)
NAT_EXTERNAL_INTERFACE=$OPTARG
echo "NAT External Interface = $NAT_EXTERNAL_INTERFACE"
echo "----------------------------"
;;
d)
NET_DHCP_SRV="dhcp-on"
;;
h)
usage
exit 0
;;
esac
done
if [ -z $NET_DHCP_SRV ]
then
NET_DHCP_SRV="dhcp-off"
fi
}
#***** Address Generating Functions ***************************************
gen_mac_addr() {
local RANDOM=`od -An -N2 -i /dev/random`
local MAC="00:16:3E"
MAC="$MAC:"`printf "%02X\n" $[ ( $RANDOM % 255 ) + 1 ] `
MAC="$MAC:"`printf "%02X\n" $[ ( $RANDOM % 255 ) + 1 ] `
MAC="$MAC:"`printf "%02X\n" $[ ( $RANDOM % 255 ) + 1 ] `
echo $MAC
#NET_DEV_MAC="$MAC"
}
gen_ip_addr(){
local DUP=""
until [ "$DUP" = "N" ]
do
local IP=10.$(( 1+(`od -An -N2 -i /dev/random` )%(254-1+1) )).$(( 1+(`od -An -N2 -i /dev/random` )%(254-1+1) )).$(( 1+(`od -An -N2 -i /dev/random` )%(254-1+1) ))
local NET_ID=`echo $IP|cut -d "." -f 1-3`.0\/$DEFAULT_SNM
if ! ip route show | grep "$NET_ID" && ! ip addr show | grep "$IP"
then
DUP="N"
fi
done
echo "$IP"/$DEFAULT_SNM
#NET_DEV_IP="$IP"\/24
}
#***** Option Finding Functions *******************************************
find_next_net_number() {
# Variables passed in (only one of the following):
# $BRIDGE_NAME $NAT_NAME $HOSTONLY_NAME $ROUTE_NAME $NOHOST_NAME $EMPTY_NAME
local TYPE_NAME="$1"
if [ -z $NET_NUMBER ]
then
local BRIDGE_TYPE_LIST=`ip addr show | grep ".*: $TYPE_NAME" | cut -d ":" -f 2 | cut -d " " -f 2`
for BRIDGE in $BRIDGE_TYPE_LIST
do
NET_NUMBER=${BRIDGE##${BRIDGE%%[0-9]*}}
done
((NET_NUMBER++))
if [ "$NET_NUMBER" -eq "1" ] && ! ip addr show | grep -q ".*: $TYPE_NAME"0
then
#((NET_NUMBER--))
NET_NUMBER="0"
fi
fi
}
find_next_net_device() {
# Variables passed in (only one fo the following):
# $BRIDGE_NAME $NAT_NAME $HOSTONLY_NAME $ROUTE_NAME $NOHOST_NAME
local DEV_NUMBER
local TYPE_NAME="$1"
if [ -z $NET_DEV ]
then
case $NET_TYPE in
bridge|nohost)
DEV_NAME="$DEFAULT_PDEV"
;;
nat|hostonly|route)
DEV_NAME="$DEFAULT_VDEV"
;;
esac
local DEV_LIST=`ip addr show | grep ".*: $DEV_NAME" | cut -d ":" -f 2 | cut -d " " -f 2`
for DEVICE in $DEV_LIST
do
DEV_NUMBER=${DEVICE##${DEVICE%%[0-9]*}}
done
NEXT_DEV_NUMBER="$DEV_NUMBER"
((NEXT_DEV_NUMBER++))
case $NET_TYPE in
bridge|nohost)
if ! ip addr show | grep -q ".*: $DEV_NAME$DEV_NUMBER" && ! ip addr show | grep -q ".*: $TYPE_NAME$DEV_NUMBER"
then
NET_DEV="$DEFAULT_DEV$DEV_NUMBER"
VIF_COUNT="$DEV_NUMBER"
else
NET_DEV="$DEFAULT_DEV$NEXT_DEV_NUMBER"
VIF_COUNT="$NEXT_DEV_NUMBER"
fi
;;
nat|hostonly|route)
if ! ip addr show | grep -q ".*: $TYPE_NAME$DEV_NUMBER"
then
NET_DEV="$DEV_NAME$DEV_NUMBER"
VIF_COUNT="$DEV_NUMBER"
else
NET_DEV="$DEV_NAME$NEXT_DEV_NUMBER"
VIF_COUNT="$NEXT_DEV_NUMBER"
fi
;;
esac
fi
}
find_network_type() {
if echo "$1" | grep -q "$BRIDGE_NAME"
then
NET_TYPE="bridge"
elif echo "$1" | grep -q "$NAT_NAME"
then
NET_TYPE="nat"
elif echo "$1" | grep -q "$HOSTONLY_NAME"
then
NET_TYPE="hostonly"
elif echo "$1" | grep -q "$ROUTE_NAME"
then
NET_TYPE="route"
elif echo "$1" | grep -q "$NOHOST_NAME"
then
NET_TYPE="nohost"
elif echo "$1" | grep -q "$EMPTY_NAME"
then
NET_TYPE="empty"
fi
}
#***** Network Creation/Deletion Functions ********************************
create_network() {
# The variable CMD_OPT must be set to one of the following before calling
# this function: start, stop, status
case $MODE in
add)
case $NET_TYPE in
bridge)
find_next_net_number $BRIDGE_NAME
find_next_net_device $BRIDGE_NAME
echo "Creating network of type: $NET_TYPE"
echo " Named: $BRIDGE_NAME$NET_NUMBER"
echo " On interface: $NET_DEV"
echo " Switchport: vif0.$VIF_COUNT"
# Create the network
#---------------------------------------------------------------------
create_bridged_networks $NET_DEV $NET_NUMBER
;;
nat|hostonly|route)
if [ -z $NET_NUMBER ]
then
case $NET_TYPE in
nat)
find_next_net_number $NAT_NAME
find_next_net_device $NAT_NAME
;;
hostonly)
find_next_net_number $HOSTONLY_NAME
find_next_net_device $HOSTONLY_NAME
;;
route)
find_next_net_number $ROUTE_NAME
find_next_net_device $ROUTE_NAME
;;
esac
fi
if [ -z $NET_DEV_MAC ]
then
echo "No MAC address was not supplied. Generating MAC"
NET_DEV_MAC="`gen_mac_addr`"
fi
if [ -z $NET_DEV_IP ]
then
echo "The IP address was not supplied. Generating IP"
NET_DEV_IP="`gen_ip_addr`"
fi
echo "Creating network of type: $NET_TYPE"
case $NET_TYPE in
nat)
echo " Named: $NAT_NAME$NET_NUMBER"
;;
hostonly)
echo " Named: $HOSTONLY_NAME$NET_NUMBER"
;;
route)
echo " Named: $ROUTE_NAME$NET_NUMBER"
;;
esac
echo " On interface: $NET_DEV"
echo " Switchport: vif0.$VIF_COUNT"
echo " MAC Addr: $NET_DEV_MAC"
echo " IP Address: $NET_DEV_IP"
echo " DHCP: $NET_DHCP_SRV"
# Create the network
#---------------------------------------------------------------------
create_local_networks $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV
;;
nohost)
if [ -z $NET_NUMBER ]
then
find_next_net_number $NOHOST_NAME
fi
find_next_net_device $NOHOST_NAME
echo "Creating network of type: $NET_TYPE"
echo " Named: $NOHOST_NAME$NET_NUMBER"
echo " On interface: $NET_DEV"
# Create the network
#---------------------------------------------------------------------
create_nohost_networks $NET_DEV $NET_NUMBER
;;
empty)
if [ -z $NET_NUMBER ]
then
find_next_net_number $EMPTY_NAME
fi
echo "Creating network of type: $NET_TYPE"
echo " Named: $EMPTY_NAME$NET_NUMBER"
# Create the network
#---------------------------------------------------------------------
create_empty_networks $NET_NUMBER
;;
*)
echo "Error: Incorrect Bridge Type: $NET_TYPE"
exit 1
;;
esac
;;
del)
VIF_COUNT=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 2`
NET_TYPE=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 3`
NET_NUMBER=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 4`
NET_DEV=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 5`
NET_DEV_MAC=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 6`
NET_DEV_IP=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 7`
NET_DEV_DHCP_SRV=`grep $NET_NAME $NETWORK_SAVE_FILE | cut -d "," -f 8`
echo "Removing network: $NET_NAME"
# Remove the network
#---------------------------------------------------------------------
case $NET_TYPE in
bridge)
create_bridged_networks $NET_DEV $NET_NUMBER
;;
nat|hostonly|route)
create_local_networks $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV
;;
nohost)
create_nohost_networks $NET_DEV $NET_NUMBER
;;
empty)
create_empty_networks $NET_NUMBER
;;
esac
;;
esac
}
#***** Network Renameing Functions ****************************************
modify_network() {
echo
echo "Modifying networks is currently unsupported."
echo
}
#***** Network Showing Functions ******************************************
show_networks() {
ACTIVE_NETWORK_LIST=`ip addr show | grep "xen" | cut -d ":" -f 2 | cut -d " " -f 2`
echo
echo "--------------------------------------"
echo " Active Virtual Networks"
echo "--------------------------------------"
for NET in $ACTIVE_NETWORK_LIST
do
echo $NET
echo
done
}
#### Main Code Body #######################################################
get_mode $*
touch $NETWORK_SAVE_FILE
case $MODE in
add)
CMD_OPT="start"
create_network
;;
del)
CMD_OPT="stop"
create_network
;;
delall)
CMD_OPT="stop"
remove_all_networks
mod)
modify_network
exit 0
;;
show)
show_networks
exit 0
;;
*)
echo "Only the following modes are supported: add|del|delall|rename|show"
;;
esac
exit 0

File diff suppressed because it is too large Load Diff