diff --git a/16716-xend-version.patch b/16716-xend-version.patch new file mode 100644 index 0000000..fad0d61 --- /dev/null +++ b/16716-xend-version.patch @@ -0,0 +1,42 @@ +# HG changeset patch +# User Keir Fraser +# Date 1200407045 0 +# Node ID b64be2bc7a91c004982b0ddba0c644744f944141 +# Parent e6e165f72e571c12f671c6ad8a70acf8d8090852 +xend: Remove hardcoded (and apparently unused) xend version. +Signed-off-by: Jim Fehlig + +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) diff --git a/16718-batched-mmu-updates.patch b/16718-batched-mmu-updates.patch new file mode 100644 index 0000000..1216a29 --- /dev/null +++ b/16718-batched-mmu-updates.patch @@ -0,0 +1,367 @@ +# HG changeset patch +# User Keir Fraser +# Date 1200407535 0 +# Node ID fba4e7357744e96797916689e3274344b82a8e5f +# Parent 58dfcad8d56d3ebad2e8553c43db499ce727cb36 +x86: Allow batched mmu updates which preserve accessed/dirty pte bits. +Signed-off-by: Bruce Rogers +Signed-off-by: Keir Fraser + +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 diff --git a/16777-xend-block-attach.patch b/16777-xend-block-attach.patch new file mode 100644 index 0000000..9f7550d --- /dev/null +++ b/16777-xend-block-attach.patch @@ -0,0 +1,31 @@ +# HG changeset patch +# User Keir Fraser +# 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 + +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 diff --git a/16873-net-nat.patch b/16873-net-nat.patch new file mode 100644 index 0000000..d54fd42 --- /dev/null +++ b/16873-net-nat.patch @@ -0,0 +1,129 @@ +# HG changeset patch +# User Keir Fraser +# Date 1201185473 0 +# Node ID 86c32269ba604f968c7abe5cf7360d7c00902ff8 +# Parent 1190d50ce18c5a8237fc592d59cff8396bc435c5 +network-nat: Fix NAT scripts. +Signed-off-by: Dan Magenheimer + +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" diff --git a/16877-blktap.patch b/16877-blktap.patch new file mode 100644 index 0000000..7d259db --- /dev/null +++ b/16877-blktap.patch @@ -0,0 +1,32 @@ +# HG changeset patch +# User Keir Fraser +# 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 + +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 + diff --git a/16883-xend-crashed-state.patch b/16883-xend-crashed-state.patch new file mode 100644 index 0000000..4cff753 --- /dev/null +++ b/16883-xend-crashed-state.patch @@ -0,0 +1,209 @@ +# HG changeset patch +# User Keir Fraser +# 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 + +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']: diff --git a/16884-xend-rename-restart.patch b/16884-xend-rename-restart.patch new file mode 100644 index 0000000..4d42424 --- /dev/null +++ b/16884-xend-rename-restart.patch @@ -0,0 +1,64 @@ +# HG changeset patch +# User Keir Fraser +# 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 + +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): diff --git a/16885-xend-config-comments.patch b/16885-xend-config-comments.patch new file mode 100644 index 0000000..8316aec --- /dev/null +++ b/16885-xend-config-comments.patch @@ -0,0 +1,23 @@ +# HG changeset patch +# User Keir Fraser +# Date 1201267771 0 +# Node ID dc6264577b5905a82a41d082544280867f259d81 +# Parent 367902a19412ba2cb6b3dff88a83ba624457e8e0 +Remove outdated comments concerning Xen API in xend configuration file. + +Signed-off-by: Jim Fehlig + +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 diff --git a/16886-xenstore-leak.patch b/16886-xenstore-leak.patch new file mode 100644 index 0000000..7baf8b5 --- /dev/null +++ b/16886-xenstore-leak.patch @@ -0,0 +1,83 @@ +# HG changeset patch +# User Keir Fraser +# Date 1201267791 0 +# Node ID 7f9646fcffe8075a75ba831832773ace485a8608 +# Parent dc6264577b5905a82a41d082544280867f259d81 +Fix leaking of /vm/ path in xenstore on various VM lifecycle events. + +Signed-off-by: Jim Fehlig + +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 + diff --git a/16890-xenapi-version.patch b/16890-xenapi-version.patch new file mode 100644 index 0000000..ad6eee6 --- /dev/null +++ b/16890-xenapi-version.patch @@ -0,0 +1,43 @@ +# HG changeset patch +# User Keir Fraser +# Date 1201278634 0 +# Node ID c2216dce87fba6866de8814b19ab580a852f65b6 +# Parent c360bb765b25b5a83550741e6ff80007ffb00885 +Update XenAPI version number, changelog, and cover sheet. +Signed-off-by: Jim Fehlig + +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}{ diff --git a/32on64-extra-mem.patch b/32on64-extra-mem.patch index 70cb0da..5e6240f 100644 --- a/32on64-extra-mem.patch +++ b/32on64-extra-mem.patch @@ -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 diff --git a/blktap.patch b/blktap.patch index 78212e7..4a1bc3d 100644 --- a/blktap.patch +++ b/blktap.patch @@ -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 = { diff --git a/block-iscsi b/block-iscsi index a1f4194..c30b000 100644 --- a/block-iscsi +++ b/block-iscsi @@ -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) diff --git a/block-npiv b/block-npiv index 6d11784..34c4792 100644 --- a/block-npiv +++ b/block-npiv @@ -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 "" $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 diff --git a/const-set-trap-table-arg.patch b/const-set-trap-table-arg.patch index 7c18247..b4bfdd1 100644 --- a/const-set-trap-table-arg.patch +++ b/const-set-trap-table-arg.patch @@ -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 #include @@ -10,7 +10,7 @@ Index: 2008-01-07/xen/arch/x86/traps.c #include #include #include -@@ -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 */ }; diff --git a/hypercall-check.patch b/hypercall-check.patch new file mode 100644 index 0000000..fd6fe15 --- /dev/null +++ b/hypercall-check.patch @@ -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); diff --git a/init.xend b/init.xend index 7e4a10c..7e0e613 100644 --- a/init.xend +++ b/init.xend @@ -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 diff --git a/multinet-common.sh b/multinet-common.sh index d886e4c..aa4581a 100644 --- a/multinet-common.sh +++ b/multinet-common.sh @@ -1,9 +1,9 @@ #!/bin/sh #============================================================================ -# multinet-common +# multinet-common.sh # -# 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,7 +13,38 @@ # # Description: # -# Function library for network-multinet and all other multinet related scripts +# Function library for network-multinet and all other multinet related +# network scripts +# +# Vars (should not require modification): +# +# BRIDGE_NAME -Name of bridged networks +# HOSTONLY_NAME -Name of hostonly networks +# NAT_NAME -Name of NAT networks +# ROUTE_NAME -Name of routed networks +# NOHOST_NAME -Name of nohost networks +# EMPTY_NAME -Name of empty networks +# +# DEFAULT_DEV -default network interface name +# DEFAULT_PDEV -default pysical interface name +# DEFAULT_VDEV -default virtual interface name +# +# NETWORKTAB -File that contains a list of the virtual networks that +# have been created (typically /etc/xen/networktab) +# +# 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 +# SF2_SYSCONFIG_FILE -Path to the /etc/sysconfig/ file for SuSEfirewall2 +# +# PLUGIN_DIR -directory containing the plug-in network configuration +# scrips +# +# DHCPD_CONF_FILE -Path to the dhcpd config file +# DHCP_SYSCONFIG_FILE -Path to the dhcpd sysconfig file +# +# IFCFG_FILE_DIR -Directory that contains the network interface +# configuration files (ifcfg-xxxx) # #============================================================================ @@ -28,6 +59,20 @@ DEFAULT_DEV="eth" DEFAULT_PDEV="peth" DEFAULT_VDEV="veth" +NETWORKTAB="/etc/xen/networktab" +SCRIPT_PATH="/etc/xen/scripts" + +NETWORK_SAVE_PATH="/var/lib/xend/network-save" +IPTABLES_SAVE_FILE="$NETWORK_SAVE_PATH/iptables-save" +SF2_SYSCONFIG_FILE="/etc/sysconfig/SuSEfirewall2" + +PLUGIN_DIR="/etc/xen/scripts/multinet.d" + +DHCPD_CONF_FILE="/etc/dhcpd.conf" +DHCP_SYSCONFIG_FILE="/etc/sysconfig/dhcpd" + +IFCFG_FILE_DIR="/etc/sysconfig/network" + #### Script Functions ##################################################### #***** Generic Functions ************************************************** @@ -55,12 +100,47 @@ findCommand() { #***** Firewall/Routing Functions ***************************************** -manage_routing() { +find_default_interface() { + local DEV=$1 + case ${DEV} in + default) + DEV=`ip route list | awk '/^default / { print $NF }'` + ;; + *) + if ! ip addr show | grep " ${DEV}:" + then + #echo "${DEV} does not exist. Using default." + DEV=`ip route show | awk '/^default / { print $NF }'` + fi + ;; + esac + + echo ${DEV} +} + +find_nat_external_interface() { + #------------------------------------------------------------------ + # Find the external NAT network interface + #------------------------------------------------------------------ + case $NAT_EXTERNAL_INTERFACE in + default) + NAT_EXTERNAL_INTERFACE=`ip route show | awk '/^default / { print $NF }'` + ;; + *) + if ! [ ip addr show | grep " $NAT_EXTERNAL_INTERFACE:" ] + then + #echo "$NAT_EXTERNAL_INTERFACE does not exist. Using default." + NAT_EXTERNAL_INTERFACE=`ip route show | awk '/^default / { print $NF }'` + fi + ;; + esac +} + +configure_routing() { # Saves and restores the ip forward and Network Address Translation state # that exist before the script runs # -# This function reads the start,stop parameter from the $CMD_OPT -# variable and responds respectively. +# The values start|stop are passed into this function and it behaves respectivly case $1 in start) @@ -97,20 +177,6 @@ manage_routing() { echo "============================================================" echo 0 > /proc/sys/net/ipv4/ip_forward fi - - #------------------------------------------------------------------ - # Determine if we need to enable NAT - #------------------------------------------------------------------ - if echo $NETWORK_LIST | grep -qE "(nat|NAT)" - then - echo "" - echo "============================================================" - echo "Enabling Network Adress Translation" - echo "============================================================" - iptables -t nat -A POSTROUTING -o $NAT_EXTERNAL_INTERFACE -j MASQUERADE - sysctl -q -w net.bridge.bridge-nf-call-iptables="0" - NAT_DONE="yes" - fi ;; stop) #------------------------------------------------------------------ @@ -122,16 +188,16 @@ manage_routing() { echo "============================================================" case `cat $NETWORK_SAVE_PATH/init_ip_fwd_state` in 0) - echo "ip_forward = 0" + #echo "ip_forward = 0" echo "0" > /proc/sys/net/ipv4/ip_forward ;; 1) - echo "ip_forward = 0" + #echo "ip_forward = 0" echo "1" > /proc/sys/net/ipv4/ip_forward ;; *) - echo "Original state unknown. Using default value." - echo "ip_forward = 0" + #echo "Original state unknown. Using default value." + #echo "ip_forward = 0" echo "0" > /proc/sys/net/ipv4/ip_forward ;; esac @@ -139,12 +205,216 @@ manage_routing() { #------------------------------------------------------------------ # Clean up init_ip_fwd_state file #------------------------------------------------------------------ - rm $NETWORK_SAVE_PATH/init_ip_fwd_state + rm -f $NETWORK_SAVE_PATH/init_ip_fwd_state ;; esac } -manage_susefirewall2() { +configure_nat() { + #------------------------------------------------------------------ + # Find the external NAT network interface + #------------------------------------------------------------------ + #find_nat_external_interface + NAT_EXTERNAL_INTERFACE=`find_default_interface $NAT_EXTERNAL_INTERFACE` + + #case $NAT_EXTERNAL_INTERFACE in + # default) + # NAT_EXTERNAL_INTERFACE=`ip route show | awk '/^default / { print $NF }'` + # ;; + # *) + # if ! [ ip addr show | grep " $NAT_EXTERNAL_INTERFACE:" ] + # then + # #echo "$NAT_EXTERNAL_INTERFACE does not exist. Using default." + # NAT_EXTERNAL_INTERFACE=`ip route show | awk '/^default / { print $NF }'` + # fi + # ;; + #esac + + #------------------------------------------------------------------ + # Determine if we need to enable NAT + #------------------------------------------------------------------ + if echo $NETWORK_LIST | grep -qE "(nat|NAT)" + then + echo "" + echo "============================================================" + echo "Enabling Network Adress Translation" + echo "============================================================" + iptables -t nat -A POSTROUTING -o $NAT_EXTERNAL_INTERFACE -j MASQUERADE + modprobe bridge + sysctl -q -w net.bridge.bridge-nf-call-iptables="0" + NAT_DONE="yes" + fi +} + +use_sf2() { +# This function determins whether or not to use the SuSEfirewall2 +# to configure routing, NAT, and firewall rules. +# +# The values start|stop are passed into this fuction + case $1 in + start) + if [ -e /etc/init.d/SuSEfirewall2_setup ] && /etc/init.d/SuSEfirewall2_setup status | grep -iwq "running" + then + echo "Determining how to configure the firewall and routing:" + echo " Using SuSEfirewall2" + echo "yes" > $NETWORK_SAVE_PATH/use_sf2 + else + echo "Determining how to configure the firewall and routing:" + echo " Using iptables" + echo "no" > $NETWORK_SAVE_PATH/use_sf2 + fi + ;; + stop) + if [ -e $NETWORK_SAVE_PATH/use_sf2 ] + then + rm -rf $NETWORK_SAVE_PATH/use_sf2 + fi + ;; + esac +} + +update_sf2_config() { +# This function backs up the initial values in /etc/sysconfig/SuSEfirewall2 +# and then modifies them with the values required for the Xen network +# environment when it is started. It also restores the initial values when +# it is stopped +# +# The values start|stop are passed into this fuction + + case $CMD_OPT in + start) + # Back-up initial values + echo " -Backing up initial SuSEfirewall2 parameters" + grep "^FW_DEV_EXT=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_DEV_INT=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_DEV_DMZ=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_ROUTE=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_MASQUERADE=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_MASQ_DEV=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_MASQ_NETS=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_NOMASQ_NETS=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_FORWARD=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + grep "^FW_FORWARD_ALWAYS_INOUT_DEV=" $SF2_SYSCONFIG_FILE >> $NETWORK_SAVE_PATH/sf2 + + # Update values for Xen networking + #find_nat_external_interface + local DEV=`find_default_interface` $NAT_EXTERNAL_INTERFACE + + #case $NAT_EXTERNAL_INTERFACE in + # default) + # local DEV=`ip route list | awk '/^default / { print $NF }'` + # ;; + # *) + # local DEV="$NAT_EXTERNAL_INTERFACE" + # ;; + #esac + + # Find the HWD_CONFIG_0 file neame for SLE10 + if [ -x /sbin/getcfg ] + then + local NAT_DEV="`/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- "$DEV" | grep "HWD_CONFIG_0="|cut -d '"' -f 2`" + else + local NAT_DEV="$DEV" + fi + + echo " -Updating SuSEfirewall2 parameters for the Xen network environment" + sed -i "s/^FW_DEV_EXT=\"\(.*\)\"$/FW_DEV_EXT=\"\1 $NAT_DEV\"/g" $SF2_SYSCONFIG_FILE + sed -i 's/^FW_ROUTE="no"/FW_ROUTE="yes"/g' $SF2_SYSCONFIG_FILE + sed -i 's/^FW_MASQUERADE="no"/FW_MASQUERADE="yes"/g' $SF2_SYSCONFIG_FILE + sed -i "s/^FW_MASQ_DEV=.*/FW_MASQ_DEV=\"$NAT_DEV\"/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_FORWARD_ALWAYS_INOUT_DEV=.*/FW_FORWARD_ALWAYS_INOUT_DEV=\"xenbr+ xennat+ xenhost+ xenroute+ xennohost+ xenempty+\"/g" $SF2_SYSCONFIG_FILE + ;; + stop) + # Restore the original values + echo " -Restoring initial SuSEfirewall2 parameters" + sed -i "s/^FW_DEV_EXT=.*/`grep "^FW_DEV_EXT=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_DEV_INT=.*/`grep "^FW_DEV_INT=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_DEV_DMZ=.*/`grep "^FW_DEV_DMZ=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_ROUTE=.*/`grep "^FW_ROUTE=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_MASQUERADE=.*/`grep "^FW_MASQUERADE=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s/^FW_MASQ_DEV=.*/`grep "^FW_MASQ_DEV=" $NETWORK_SAVE_PATH/sf2`/g" $SF2_SYSCONFIG_FILE + sed -i "s+^FW_MASQ_NETS=.*+`grep "^FW_MASQ_NETS=" $NETWORK_SAVE_PATH/sf2`+g" $SF2_SYSCONFIG_FILE + sed -i "s+^FW_NOMASQ_NETS=.*+`grep "^FW_NOMASQ_NETS=" $NETWORK_SAVE_PATH/sf2`+g" $SF2_SYSCONFIG_FILE + sed -i "s+^FW_FORWARD=.*+`grep "^FW_FORWARD=" $NETWORK_SAVE_PATH/sf2`+g" $SF2_SYSCONFIG_FILE + sed -i "s+^FW_FORWARD_ALWAYS_INOUT_DEV=.*+`grep "^FW_FORWARD_ALWAYS_INOUT_DEV=" $NETWORK_SAVE_PATH/sf2`+g" $SF2_SYSCONFIG_FILE + + rm -f $NETWORK_SAVE_PATH/sf2 + ;; + esac +} + +update_sf2_interfaces() { +# This function modifies the internal interfaces and the values that define which +# networks can be masqueraded in the /etc/sysconfig/SuSEfirewall2 file. +# +# Usage: update_sf2_interfaces start|stop $DEV $TYPE $IPADDR + + local DEV="$2" + local NETWORK_TYPE="$3" + local IPADDR="`ipcalc $4|grep Network:|sed "s/Network: *//g"|cut -d " " -f 1`" + #local MACADDR="$5" + + local FW_INT_IFACE="$DEV" + + case $1 in + start) + # Add an internal interface + echo + echo " SuSEfirwall2 is present:" + echo " Adding $FW_INT_IFACE as an internal interface" + sed -i "s/\(^FW_DEV_INT=\".*\)\"$/\1 $FW_INT_IFACE\"/g" $SF2_SYSCONFIG_FILE + case $NETWORK_TYPE in + nat) + # Add a NATed network + echo " Adding $IPADDR as a NATed network" + sed -i "s+\(^FW_MASQ_NETS=\".*\)\"$+\1 $IPADDR\"+g" $SF2_SYSCONFIG_FILE + sed -i "s+\(^FW_FORWARD=\".*\)\"$+\1 $IPADDR\"+g" $SF2_SYSCONFIG_FILE + ;; + hostonly) + # Add a non-NATed network + echo " Adding $IPADDR as a non-NATed network" + sed -i "s+\(^FW_NOMASQ_NETS=\".*\)\"$+\1 $IPADDR\"+g" $SF2_SYSCONFIG_FILE + ;; + route) + # Add a routed network + echo " Adding $IPADDR as a routed network" + sed -i "s+\(^FW_FORWARD=\".*\)\"$+\1 $IPADDR\"+g" $SF2_SYSCONFIG_FILE + ;; + esac + ;; + stop) + # Remove an internal interface + echo + echo " SuSEfirwall2 is present:" + echo " Removing $FW_INT_IFACE as an internal interface" + sed -i "s/\(^FW_DEV_INT=\".*\) $FW_INT_IFACE\(.*\)\"$/\1\2\"/g" $SF2_SYSCONFIG_FILE + case $NETWORK_TYPE in + nat) + # Remove a NATed network + echo " Removing $IPADDR as a NATed network" + sed -i "s+\(^FW_MASQ_NETS=\".*\) $IPADDR\(.*\)\"$+\1\2\"+g" $SF2_SYSCONFIG_FILE + sed -i "s+\(^FW_FORWARD=\".*\) $IPADDR\(.*\)\"$+\1\2\"+g" $SF2_SYSCONFIG_FILE + ;; + hostonly) + # Remove a non-NATed network + echo " Removing $IPADDR as a non-NATed network" + sed -i "s+\(^FW_NOMASQ_NETS=\".*\) $IPADDR\(.*\)\"$+\1\2\"+g" $SF2_SYSCONFIG_FILE + ;; + route) + # Remove a routed network + echo " Removing $IPADDR as a routed network" + sed -i "s+\(^FW_FORWARD=\".*\) $IPADDR\(.*\)\"$+\1\2\"+g" $SF2_SYSCONFIG_FILE + ;; + esac + ;; + esac +} + +handle_sf2() { +# This function starts and stops the SuSEfirewall2 +# +# Usage: handle_sf2 start|stop|restart + case $1 in stop) if [ -e /etc/init.d/SuSEfirewall2_setup ] && /etc/init.d/SuSEfirewall2_setup status | grep -iwq "running" @@ -153,22 +423,33 @@ manage_susefirewall2() { echo "============================================================" echo "Stopping SuSEfirewall2" echo "============================================================" - /etc/init.d/SuSEfirewall2_setup stop > /dev/null - echo "0" > $NETWORK_SAVE_PATH/sf2 + /etc/init.d/SuSEfirewall2_setup stop > /dev/null 2>&1 return 0 else return 1 fi ;; start) - if [ -e $NETWORK_SAVE_PATH/sf2 ] && grep "0" $NETWORK_SAVE_PATH/sf2 + if [ -e $NETWORK_SAVE_PATH/use_sf2 ] && grep "yes" $NETWORK_SAVE_PATH/use_sf2 then echo "" echo "============================================================" echo "Starting SuSEfirewall2" echo "============================================================" - /etc/init.d/SuSEfirewall2_setup start > /dev/null - rm -rf $NETWORK_SAVE_PATH/sf2 + /etc/init.d/SuSEfirewall2_setup start > /dev/null 2>&1 + return 0 + else + return 1 + fi + ;; + restart) + if [ -e $NETWORK_SAVE_PATH/use_sf2 ] && grep "yes" $NETWORK_SAVE_PATH/use_sf2 + then + echo "" + echo "============================================================" + echo "Restarting SuSEfirewall2" + echo "============================================================" + /etc/init.d/SuSEfirewall2_setup restart > /dev/null 2>&1 return 0 else return 1 @@ -178,10 +459,11 @@ manage_susefirewall2() { } manage_iptables() { -# Saves and restores the iptables rules that exist before the script runs +# This function saves and restores the iptables rules that exist +# before the Xen network script runs # -# This function reads the start,stop parameter from the $CMD_OPT -# variable and responds respectively. +# The following values can be passed into this fuction: +# start|stop case $1 in stop) @@ -189,17 +471,19 @@ manage_iptables() { echo "============================================================" echo "Saving iptables rules" echo "============================================================" - + echo + #---------------------------------------------------------------- # Saving iptables rules for $TABLE to a file #---------------------------------------------------------------- + echo " -----------------------" for TABLE in `iptables-save |grep '*'|cut -d '*' -f 2` do - echo "Saving table: $TABLE" + echo " Saving table: $TABLE" iptables-save -t $TABLE > $IPTABLES_SAVE_FILE@$TABLE - echo "Flushing table: $TABLE" + echo " Flushing table: $TABLE" iptables -F -t $TABLE - echo "-----------------------" + echo " -----------------------" done #---------------------------------------------------------------- @@ -223,129 +507,367 @@ manage_iptables() { echo "============================================================" echo "Restoring iptables rules" echo "============================================================" - + echo + #---------------------------------------------------------------- # Restoring iptables rules for $TABLE #---------------------------------------------------------------- + echo " -----------------------" for TABLE in `ls $IPTABLES_SAVE_FILE*|cut -d "@" -f 2` do - echo "Restoring table: $TABLE" + echo " Restoring table: $TABLE" iptables-restore < $IPTABLES_SAVE_FILE@$TABLE rm $IPTABLES_SAVE_FILE@$TABLE - echo "-----------------------" + echo " -----------------------" done ;; esac } +manage_firewall() { +# This function determins how the firewall is being managed +# (either with SuSEfirewall2 or not) and then manages the +# configuration of routing and the firewall accordingly. +# +# The following values can be passed into this function: +# prestart|poststart|prestop|poststop + echo + echo "============================================================" + echo "Configuring the firewall and routing: $1" + echo "============================================================" + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + echo " SUSEfirewall2 is present and enabled." + echo " Using SUSEfirewall2 for firewall and routing:" + case $1 in + prestart) + handle_sf2 stop + update_sf2_config start + ;; + poststart) + handle_sf2 start + ;; + prestop) + handle_sf2 stop + update_sf2_config stop + ;; + poststop) + handle_sf2 start + ;; + esac + ;; + *) + case $1 in + prestart) + if [ -e /etc/init.d/SuSEfirewall2_setup ] + then + echo + echo " SuSEfirewall2 is present but not enabled:" + echo " (Updating SuSEfirewall2 just in case.)" + update_sf2_config start + fi + # Backup and flush existing firewall rules + manage_iptables stop + + # Enable ip forwarding if required + configure_routing start + ;; + poststart) + # Configure NAT if required + configure_nat + ;; + prestop) + if [ -e /etc/init.d/SuSEfirewall2_setup ] + then + echo + echo "SuSEfirwall2 is present but not enabled:" + # Restore original SuSEfirewall2 configuration + update_sf2_config stop + fi + # Restore ip forwarding to the origiunal state + configure_routing stop + ;; + poststop) + # Restore original firewall rules + manage_iptables start + ;; + esac + ;; + esac +} + #***** Traditional Bridge Helper Functions ******************************** setup_bridge_port() { - local dev="$1" +# This function configures a network interface to be a port on +# a bridge by removing any IP addresses bound to it. +# +# Usage: setup_bridge_port + + local DEV="$1" # take interface down ... - ip link set ${dev} down + ip link set ${DEV} down # ... and configure it - ip link set ${dev} arp off - ip link set ${dev} multicast off - ip link set ${dev} addr fe:ff:ff:ff:ff:ff - ip addr flush ${dev} + ip addr flush ${DEV} > /dev/null 2>&1 } -create_bridge () { -# Usage: create_bridge bridge - local bridge=$1 +create_bridge() { +# This function creates a bridge. +# +# Usage: create_bridge $BRIDGE +# +# Vars: $BRIDGE -Name of the bridge - # Don't create the bridge if it already exists. - if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then - brctl addbr ${bridge} - brctl stp ${bridge} off - brctl setfd ${bridge} 0 - ip link set ${bridge} arp off - ip link set ${bridge} multicast off - fi - ip link set ${bridge} up + local BRIDGE=$1 + + # Don't create the bridge if it already exists. + if [ ! -e "/sys/class/net/${BRIDGE}/bridge" ] + then + # Create the bridge + #echo "Creating bridge: $BRIDGE";read + brctl addbr ${BRIDGE} + brctl stp ${BRIDGE} off + brctl setfd ${BRIDGE} 0 + + # Create an ifcfg file for the bridge + #echo "Creating $IFCFG_FILE_DIR/ifcfg-${BRIDGE}";read + echo "NAME='Xen Virtual - ${BRIDGE}'" > $IFCFG_FILE_DIR/ifcfg-${BRIDGE} + fi + + # Bring the bridge up + #echo "Bridge $BRIDGE up";read + ip link set ${BRIDGE} up } -add_to_bridge () { -# Usage: add_to_bridge bridge dev - local bridge=$1 - local dev=$2 +delete_bridge() { +# This function deletes a bridge. +# +# Usage: delete_bridge $BRIDGE +# +# Vars: $BRIDGE -Name of the bridge - # Don't add $dev to $bridge if it's already on a bridge. - if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then - ip link set ${dev} up || true - return - fi - brctl addif ${bridge} ${dev} - ip link set ${dev} up + local BRIDGE=$1 + + # Don't try to delete the bridge if it doesn't exist. + if [ -e "/sys/class/net/${BRIDGE}/bridge" ]; then + # Remove any remaining bridge ports + #echo "Removing any remaining bridge ports";read + local BRIDGE_PORTS="`ls /sys/class/net/${BRIDGE}/brif`" + for PORT in $BRIDGE_PORTS + do + brctl delif $BRIDGE $PORT + done + + # Bring the bridge down + #echo "Bringing down $BRIDGE";read + ip link set ${BRIDGE} down + + # Bring the bridge down + #echo "Remove any addresses from $BRIDGE";read + ip addr flush ${BRIDGE} > /dev/null 2>&1 + + # Remove the bridge + #echo "Removing $BRIDGE";read + brctl delbr ${BRIDGE} + + # Remove the bridge's ifcfg file + #echo "Removing $IFCFG_FILE_DIR/ifcfg-${BRIDGE}";read + rm -f $IFCFG_FILE_DIR/ifcfg-${BRIDGE} + fi +} + +add_to_bridge() { +# This function adds a network interface to a bridge as a bridge port. +# +# Usage: add_to_bridge $BRIDGE $DEV +# +# Vars: $BRIDGE -Name of the bridge +# $DEV -Interface to add to the bridge + + local BRIDGE=$1 + local DEV=$2 + + # Don't add $dev to $bridge if it's already on a bridge. + if [ -e "/sys/class/net/${BRIDGE}/brif/${DEV}" ]; then + ip link set ${DEV} up || true + return + fi + brctl addif ${BRIDGE} ${DEV} + ip link set ${DEV} up } add_to_bridge2() { - local bridge=$1 - local dev=$2 - local maxtries=10 +# This function waits for a network interface to come up and then adds it +# to a bridge as a bridge port by calling the add_to_bridge function. +# +# Usage: add_to_bridge2 $BRIDGE $DEV +# +# Vars: $BRIDGE -Name of the bridge +# $DEV -Name of the interface to add to the bridge - echo -n "Waiting for ${dev} to negotiate link." - ip link set ${dev} up - for i in `seq ${maxtries}` ; do - if ifconfig ${dev} | grep -q RUNNING ; then - break - else - echo -n '.' - sleep 1 - fi - done + local BRIDGE=$1 + local DEV=$2 + local MAXTRIES=10 - if [ ${i} -eq ${maxtries} ] ; then echo '(link isnt in running state)' ; fi + echo -n " Waiting for ${DEV} to negotiate link." + ip link set ${DEV} up + for i in `seq ${MAXTRIES}` ; do + if ifconfig ${DEV} | grep -q RUNNING ; then + break + else + echo -n '.' + sleep 1 + fi + done - add_to_bridge ${bridge} ${dev} + if [ ${i} -eq ${MAXTRIES} ] + then + echo '(link isnt in running state)' + fi + + add_to_bridge ${BRIDGE} ${DEV} } -transfer_addrs () { -# Usage: transfer_addrs src dst -# Copy all IP addresses (including aliases) from device $src to device $dst. - local src=$1 - local dst=$2 - # Don't bother if $dst already has IP addresses. - if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then - return - fi - # Address lines start with 'inet' and have the device in them. - # Replace 'inet' with 'ip addr add' and change the device name $src - # to 'dev $src'. - ip addr show dev ${src} | egrep '^ *inet ' | sed -e " +rename_interfaces() { +# This function renames network interface DST SRC +# +# Usage: rename_interfaces $SRC $DST +# +# Vars: SRC -Name of the sourec interface +# DST -Name of the destination interface + + local DEV=$1 + local NEW_DEV=$2 + + # Bring down interface + #echo "Bring down ${DEV}";read + ip link set ${DEV} down + + # Rename physical and virtual interfaces + #echo "Rename ${DEV} to ${NEW_DEV}";read + ip link set ${DEV} name ${NEW_DEV} + + # Bring interface back up + #echo "Bring ${NEW_DEV} back up";read + ip link set ${NEW_DEV} up +} + +transfer_mac() { +# This function transfers the mac address from one network interface +# to another +# +# Usage: transfer_mac $SRC $DST +# +# Vars: SRC -Name of the sourec interface +# DST -Name of the destination interface +# MAC -MAC address to transfer + + local SRC=$1 + local DST=$2 + + # Find MAC Address + #echo "Find MAC address of ${SRC}";read + local MAC=`ip link show ${SRC} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` + + # Assign the physical MAC to the new interface + #echo "Assign the physical MAC to ${DST}";echo "ip link set ${DST} down";echo "ip link set ${DST} addr ${MAC}";echo "ip link set ${DST} arp on";echo "ip link set ${DST} up";read + ip link set ${DST} down + ip link set ${DST} addr ${MAC} + ip link set ${DST} arp on + ip link set ${DST} multicast on + ip link set ${DST} up +} + +transfer_addrs() { +# This function transfers all IP addresses (including aliases) from one +# network interface to another +# +# Usage: transfer_addrs $DEV $BRIDGE +# transfer_addrs $BRIDGE $DEV +# +# Vars: $DEV/$SRC -Source interface +# $BRIDGE/$DST -Destination interface + + local SRC=$1 + local DST=$2 + + # Ensure their is an address to transfer + # echo "Ensure there is an address to transfer";echo "ifup ${SRC}";echo "ip link set ${DST} up";read + ifup $SRC > /dev/null 2>&1 + ip link set $DST up + + # Don't bother if $DST already has IP addresses. + if ip addr show dev ${DST} | egrep -q '^ *inet ' ; then + return + fi + + # Find the IP Address and Subnet Mask + #echo "Find the IP address and Subnet Mask";read + local IPADDR="`ip addr show dev ${SRC} | grep 'inet ' | sed 's/^ *//g' | cut -d ' ' -f 2 | cut -d '/' -f 1`" + local SNM="`ipcalc $IPADDR | grep Netmask | sed 's/Netmask: *//g' | cut -d ' ' -f 1`" + + # Address lines start with 'inet' and have the device in them. + # Replace 'inet' with 'ip addr add' and change the device name $SRC + # to 'dev $SRC'. + ip addr show dev ${SRC} | egrep '^ *inet ' | sed -e " s/inet/ip addr add/ s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ -s/${src}/dev ${dst}/ +s/${SRC}/dev ${DST} label ${DST}/ +s/secondary// " | sh -e - # Remove automatic routes on destination device - ip route list | sed -ne " -/dev ${dst}\( \|$\)/ { + # Remove automatic routes on destination device + ip route list | sed -ne " +/dev ${DST}\( \|$\)/ { s/^/ip route del / p }" | sh -e + + # Remove IP address and Subnet Mask from SRC ifcfg file + #echo "Remove IP Address and Subnet Mask from $IFCFG_FILE_DIR/ifcfg-${SRC}";read + #sed -i '/^IPADDR=.*/d' $IFCFG_FILE_DIR/ifcfg-${SRC} + #sed -i '/^NETMASK=.*/d' $IFCFG_FILE_DIR/ifcfg-${SRC} + + # Write IP Address and Subnet mask out to ifcfg file + #echo "Write out IP Address and Subnet Mask to $IFCFG_FILE_DIR/ifcfg-${DST}";read + if [ -e $IFCFG_FILE_DIR/ifcfg-${DST} ] + then + grep -q "IPADDR=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "IPADDR='$IPADDR'" >> $IFCFG_FILE_DIR/ifcfg-${DST} + grep -q "NETMASK=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "NETMASK='$SNM'" >> $IFCFG_FILE_DIR/ifcfg-${DST} + grep -q "BOOTPROTO=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "BOOTPROTO='static'" >> $IFCFG_FILE_DIR/ifcfg-${DST} + grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-${DST} || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-${DST} + fi + + # Bring the interface down and back up again + #echo "Bring ${DST} down and back up again";read + ip link set ${DST} down + ifup ${DST} > /dev/null 2>&1 } -transfer_routes () { -# Usage: transfer_routes src dst -# Get all IP routes to device $src, delete them, and -# add the same routes to device $dst. +transfer_routes() { +# This function transfers the routes from one network interface to another +# by doing the following: +# +# Get all IP routes to device $SRC, delete them, and +# add the same routes to device $DST. # The original routes have to be deleted, otherwise adding them # for $dst fails (duplicate routes). - local src=$1 - local dst=$2 - # List all routes and grep the ones with $src in. - # Stick 'ip route del' on the front to delete. - # Change $src to $dst and use 'ip route add' to add. - ip route list | sed -ne " -/dev ${src}\( \|$\)/ { +# +# Usage: transfer_routes $SRC $DST + + local SRC=$1 + local DST=$2 + # List all routes and grep the ones with $src in. + # Stick 'ip route del' on the front to delete. + # Change $src to $dst and use 'ip route add' to add. + ip route list | sed -ne " +/dev ${SRC}\( \|$\)/ { h s/^/ip route del / P g - s/${src}/${dst}/ + s/${SRC}/${DST}/ s/^/ip route add / P d @@ -353,11 +875,11 @@ transfer_routes () { } link_exists() { -## -# link_exists interface -# -# Returns 0 if the interface named exists (whether up or down), 1 otherwise. +# This function returns 0 if the interface named exists +# (whether up or down), 1 otherwise. # +# Usage: link_exists + if ip link show "$1" >/dev/null 2>/dev/null then return 0 @@ -366,415 +888,224 @@ link_exists() { fi } -antispoofing () { -# Set the default forwarding policy for $dev to drop. +antispoofing() { +# This fuction sets the default forwarding policy for $dev to drop. # Allow forwarding to the bridge. - iptables -P FORWARD DROP - iptables -F FORWARD - iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT - iptables -A FORWARD -m physdev --physdev-in ${vif0} -j ACCEPT + + iptables -P FORWARD DROP + iptables -F FORWARD + iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT + iptables -A FORWARD -m physdev --physdev-in ${vif0} -j ACCEPT } find_active_vlans() { - local netdev=$1 - local vlan - local vlans - vlans="" - for vifcfg in /etc/sysconfig/network/ifcfg-vlan* ; do - vlan=${vifcfg/*\/ifcfg-} - if [ "$vlan" = "vlan*" ]; then - continue - fi - . $vifcfg - etherdevice="$ETHERDEVICE" - if [ -x /sbin/getcfg-interface ]; then - etherdevice=$(/sbin/getcfg-interface "$ETHERDEVICE") - fi - if [ "$ETHERDEVICE" = "$netdev" ] || [ "$etherdevice" = "$netdev" ] ; then - link_exists "$vlan" && vlans="$vlans $vlan" - fi - done - echo "$vlans" +# This function discovers active vlans and returns them +# +# Usage: find_active_vlans $DEV +# +# Vars: $DEV +# $VLAN +# $VLANS + + local DEV=$1 + local VLAN + local VLANS + VLANS="" + for vifcfg in /etc/sysconfig/network/ifcfg-vlan* ; do + VLAN=${vifcfg/*\/ifcfg-} + if [ "$VLAN" = "vlan*" ]; then + continue + fi + . $vifcfg + etherdevice="$ETHERDEVICE" + if [ -x /sbin/getcfg-interface ] + then + etherdevice=$(/sbin/getcfg-interface "$ETHERDEVICE") + fi + if [ "$ETHERDEVICE" = "$DEV" ] || [ "$etherdevice" = "$DEV" ] + then + link_exists "$VLAN" && VLANS="$VLANS $VLAN" + fi + done + echo "$VLANS" } -get_ifcfg_file() { - local HWD_CONFIG_0= - local netdev="$DEV" - eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- "$netdev" | grep "HWD_CONFIG_0="` - if [ -n "$HWD_CONFIG_0" ]; then - hwddev="$HWD_CONFIG_0" - fi -} +find_bridged_netdev() { +# This function finds the network interface ($netdev) that is associated +# with the bridge by matching MAC addresses. +# +# Usage: find_bridges_netdev -find_bridged_netdev () { -# Find the netdev that is associated with the bridge by matching MAC addresses. - local bridge=$1 + local bridge=$1 - bmac=`ip link show ${bridge} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - for i in `ls /sys/class/net/${bridge}/brif` ; do - mac=`ip link show ${i} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - if [ "${bmac}" = "$MAC" ] && [ ! "${bridge}" = "${i}" ] ; then - netdev=${i} - return 0 - fi - done - return 1 -} - -create_bonded_bridge() { - - # passed in variabiles: - # start|stop $DEV $VDEV $PDEV $BRIDGE $VIF0 - - local netdev="$2" - local vdev="$3" - local pdev="$4" - local bridge="$5" - local vif0="$6" - - vlans=$(find_active_vlans "${netdev}") - for vlan in $vlans ; do ifdown $vlan ; done - - case $1 in - start) - local NETDEV_IP=`ip addr show dev ${netdev}|egrep '^ *inet '|sed "s/^ *inet //"|cut -d " " -f 1` - local BONDSLAVE_LIST=`ifstatus ${netdev} | egrep -i "slave interface" | cut -d ":" -f 2 | sed "s/ //"` - local MAC=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - local BRIDGE_NUM=${netdev##${netdev%%[0-9]*}} - local GATEWAY=`ip route show | grep "^default" | cut -d " " -f 3` - PDEV=eth${BRIDGE_NUM} - new_netdev=eth${BRIDGE_NUM} - - #echo "netdev = ${netdev}" - #echo "NETDEV_IP = $NETDEV_IP" - #echo "GATEWAY = $GATEWAY" - #echo "BONDSLAVE_LIST = $BONDSLAVE_LIST" - #echo "MAC = $MAC" - #echo "BRIDGE_NUM = $BRIDGE_NUM" - #echo "new_netdev = $new_netdev" - #echo "vdev = $vdev" - #echo "pdev = $pdev" - #echo "bridge = $bridge" - #echo "vif0 = $vif0" - #read - - #ip link set ${bridge} arp on - - ##### We must reconfigure the bonded interface first ##### - #echo "bring bonded interface ${netdev} down";read - ip link set ${netdev} down - ip link set ${netdev} arp off - ip link set ${netdev} multicast off - ip link set ${netdev} addr fe:ff:ff:ff:ff:ff - ip addr flush ${netdev} - - #echo "rename the bondslave interfaces";read - for DEV in $BONDSLAVE_LIST - do - ip link set ${DEV} name p${DEV} - done - - #echo "bring ${netdev} back up with new bondslave names";read - ifup ${netdev} - #ip link set ${netdev} arp on - #ip link set ${netdev} multicast on - - ##### Here is where we attach the bridge ports to the bridge ##### - #echo "bring up the bridge ${bridge}";read - ip link set ${bridge} up - - #echo "add ${netdev} to bridge as a bridge port";read - add_to_bridge2 ${bridge} ${netdev} - - #echo "add ${vif0} to bridge as a ${bridge} port";read - add_to_bridge ${bridge} ${vif0} - - #echo "clean up ${vif0} (arp off, change MAC, flush IP address, etc.)";read - setup_bridge_port ${vif0} - - #echo "bring ${vif0} up";read - ip link set ${vif0} up - - ##### Next we must configure the new interface for Dom0 ##### - #echo "make sure the ${vdev} interface is down";read - ip link set ${vdev} down - - #echo "rename ${vdev} to ${pdev}";read - ip link set ${vdev} name ${pdev} - - #echo "transfer ${netdev}'s MAC address to ${pdev} and turn arp on";read - ip link set ${pdev} addr $MAC arp on - - #echo "bring new ${pdev} interface up";read - ip link set ${pdev} up - - #echo "transfer ${netdev}'s IP address to ${pdev}";read - ip addr add dev ${pdev} $NETDEV_IP brd + - - #echo "remove ${netdev}'s IP address";read - ip addr del dev ${netdev} $NETDEV_IP - - #echo "transfer ${netdev}'s routes to ${pdev}";read - #if ! echo ${netdev} | grep -qi "bond" - #then - transfer_routes ${netdev} ${pdev} - #fi - - #echo "add new default route via ${pdev}";read - ip route add default via $GATEWAY - ;; - stop) - local BRIDGE_NUM=${netdev##${netdev%%[0-9]*}} - local pdev=eth${BRIDGE_NUM} - local new_netdev=eth${BRIDGE_NUM} - local GATEWAY=`ip route show | grep "^default" | cut -d " " -f 3` - local NETDEV_IP=`ip addr show dev ${pdev}|egrep '^ *inet '|sed "s/^ *inet //"|cut -d " " -f 1` - local BONDSLAVE_LIST=`ifstatus ${netdev} | egrep -i "slave interface" | cut -d ":" -f 2 | sed "s/ //"` - local MAC=`ip link show ${pdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - - #echo "netdev = ${netdev}" - #echo "NETDEV_IP = $NETDEV_IP" - #echo "BONDSLAVE_LIST = $BONDSLAVE_LIST" - #echo "MAC = $MAC" - #echo "BRIDGE_NUM = $BRIDGE_NUM" - #echo "new_netdev = $new_netdev" - #echo "vdev = $vdev" - #echo "pdev = $pdev" - #echo "bridge = $bridge" - #echo "vif0 = $vif0" - #read - - ##### First we reset the virtual interface ${pdev} ##### - #echo "bring ${pdev} down";read - ip link set ${pdev} down arp off - ip link set ${pdev} addr fe:ff:ff:ff:ff:ff - ip addr flush ${pdev} - - ##### Then we reset the bridge port ${vif0} ##### - #echo "bring ${vif0} down";read - ip link set dev ${vif0} down - - ##### Then we reset the bonded interface ${netdev} ##### - #echo "bring the bonded interface ${netdev} down";read - ip link set ${netdev} down - #ip link set ${netdev} down arp off - #ip link set ${netdev} addr fe:ff:ff:ff:ff:ff - ip addr flush ${netdev} - - ##### Then we remove the bridge port interfaces from the bridge ##### - #echo "removing ${netdev} from ${bridge}";read - brctl delif ${bridge} ${netdev} - - #echo "removing ${vif0} from ${bridge}";read - brctl delif ${bridge} ${vif0} - - ##### Then we rename the virtual interface back to its original name ##### - #echo "rename ${pdev} to ${vdev}";read - ip link set ${pdev} name ${vdev} - - ##### Then we reset the renamed bond slave interface ${pdev} - for DEV in $BONDSLAVE_LIST - do - local OLD_DEV=`echo ${DEV}|sed "s/p//"` - #echo "bring the bond slave ${DEV} down";read - ip link set ${DEV} down - #echo "rename the bond slave ${DEV} to ${OLD_DEV}";read - ip link set ${DEV} name ${OLD_DEV} - done - - ##### And then we restart the bonded interface ##### - #echo "bring bonded interface back up";read - ifup ${netdev} - - ##### Then we bring the bridge ${bridge} down ##### - #echo "bring the bridge ${bridge} down";read - ip link set ${bridge} down - ;; - esac - - for vlan in $vlans ; do ifup $vlan ; done + bmac=`ip link show ${bridge} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` + for i in `ls /sys/class/net/${bridge}/brif` ; do + mac=`ip link show ${i} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` + if [ "${bmac}" = "$MAC" ] && [ ! "${bridge}" = "${i}" ] ; then + netdev=${i} + return 0 + fi + done + return 1 } create_normal_bridge() { +# This fuction creates a bridge on a normal network interface +# +# Usage: create_normal_bridge start|stop $DEV $PDEV $BRIDGE +# +# Vars: $DEV -Network interface name +# $PDEV -Name interface will be renamed to +# $BRIDGE -Name of the bridge - # passed in variabiles: - # start|stop $DEV $VDEV $PDEV $BRIDGE $VIF0 - - local netdev="$2" - local vdev="$3" - local pdev="$4" - local bridge="$5" - local vif0="$6" + local DEV="$2" + local PDEV="$3" + local BRIDGE="$4" + + # Find and bring down any active VLANs + local VLANS=$(find_active_vlans "${DEV}") + for VLAN in $VLANS + do + ifdown $VLAN > /dev/null 2>&1 + done case $1 in start) - local mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` + # Ensure there is a bridge to transfer to + #echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read + create_bridge ${BRIDGE} + + # Transfer the IP address to the virtual interface + #echo "Transfer the IP address from ${DEV} to ${BRIDGE}";read + transfer_addrs ${DEV} ${BRIDGE} - # Ensure there is an IP to transfer - #echo "Ensure there is an IP to transfer. (ifup ${netdev})";read - ifup ${netdev} + # Rename physical and virtual interfaces + #echo "Rename ${DEV} to ${PDEV}";read + rename_interfaces ${DEV} ${PDEV} - # Transfer the IP address to the virtual interface - #echo "Transfer the IP address from ${netdev} to ${vdev}";read - transfer_addrs ${netdev} ${vdev} + # Configure $PDEV as a bridge port + #echo "Configure ${PDEV} as a bridge port";read + setup_bridge_port ${PDEV} - # Find and bring down any active VLANs - #echo "Find and bring down any active VLANs";read - local vlans=$(find_active_vlans "${netdev}") - for vlan in $vlans ; do ifdown $vlan ; done - - # Bring down interface - #echo "Bring down interface (ifdown ${netdev})";read - ifdown ${netdev} - - # Rename physical and virtual interfaces - #echo "Rename ${netdev} to ${pdev} & ${vdev} to ${netdev}";read - ip link set ${netdev} name ${pdev} - ip link set ${vdev} name ${netdev} - - # Configure $pdev and $vif0 as bridge ports - #echo "Configure ${pdev} and ${vif0} as bridge ports";read - setup_bridge_port ${pdev} - setup_bridge_port ${vif0} - - # Assign the physical MAC to the new interface - #echo "Assign the physical MAC to ${netdev}";read - ip link set ${netdev} addr ${mac} arp on - - # Bring bridge up and add interfaces to it - #echo "Bring ${bridge} up and add ${vif0} and ${pdev} to it";read - ip link set ${bridge} up - add_to_bridge ${bridge} ${vif0} - add_to_bridge2 ${bridge} ${pdev} - - # Bring new interface up - #echo "Bring up ${netdev} and ${hwddev}";read - ip link set ${netdev} up - ifup ${hwddev} - - # Bring VLANs back up - #echo "Bring VLANs back up";read - for vlan in $vlans ; do ifup $vlan ; done + # Bring bridge up and add interfaces to it + #echo "Bring ${BRIDGE} up and add ${PDEV} to it";read + ip link set ${BRIDGE} up + add_to_bridge2 ${BRIDGE} ${PDEV} ;; stop) - # Bring down ${vif0} - #echo "Bring down ${vif0}";read - ip link set dev ${vif0} down - - local mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - + # Remove interface from bridge + #echo "Remove interface ${PDEV} from ${BRIDGE}";read + brctl delif ${BRIDGE} ${PDEV} + # Transfer IP address back to original interface - #echo "Transfer IP address from ${netdev} to ${pdev}";read - transfer_addrs ${netdev} ${pdev} + #echo "Transfer IP address from ${BRIDGE} to ${PDEV}";read + transfer_addrs ${BRIDGE} ${PDEV} - # Find and bring down any active VLANs - #echo "Find and bring down any active VLANs";read - vlans=$(find_active_vlans "${netdev}") - for vlan in $vlans ; do ifdown $vlan ; done + # Configure $PDEV as a bridge port + #echo "Configure ${BRIDGE} as a bridge port";read + #setup_bridge_port ${BRIDGE} - # Bring down virtual network interface - #echo "Bring down ${netdev}";read - ifdown ${netdev} - - # Clean up virtual network interfaces (MAC, arp, etc.) - #echo "Clean up virtual network interfaces (MAC, arp, etc.)";read - ip link set ${netdev} down arp off - ip link set ${netdev} addr fe:ff:ff:ff:ff:ff - - # Bring down physical network interface - #echo "Bring down ${pdev}";read - ip link set ${pdev} down - - # Flush address(es) from virtual network interface - #echo "Flush address(es) from ${netdev}";read - ip addr flush ${netdev} - - # Change MAC address on physical interface - #echo "Change MAC address on ${pdev}";read - ip link set ${pdev} addr ${mac} arp on - - # Remove interfaces from bridge - #echo "Remove interfaces ${pdev} and ${vif0} from ${bridge}";read - brctl delif ${bridge} ${pdev} - brctl delif ${bridge} ${vif0} - - # Bring down bridge - #echo "Bring down ${bridge}";read - ip link set ${bridge} down + # Remove bridge ${BRIDGE} + #echo "Remove the bridge";read + delete_bridge ${BRIDGE} # Rename physical and virtual network interfaces - #echo "Rename ${netdev} to ${vdev} & ${pdev} to ${netdev}";read - ip link set ${netdev} name ${vdev} - ip link set ${pdev} name ${netdev} + #echo "Rename ${PDEV} to ${DEV}";read + #ip link set ${PDEV} name ${DEV} + rename_interfaces ${PDEV} ${DEV} # Bring renamed physical interface up - #echo "Bring up ${netdev}";read - ifup ${netdev} - - # Bring VLANs back up - #echo "Bring VLANs back up";read - for vlan in $vlans ; do ifup $vlan ; done + #echo "Bring up ${DEV}";read + ifup ${DEV} > /dev/null 2>&1 ;; esac + # Bring VLANs back up + #echo "Bring VLANS back up";read + for VLAN in $VLANS + do + #echo $VLAN + ifup $VLAN > /dev/null 2>&1 + done } #***** NAT/HostOnly Helper Functions ************************************** -setup_host_interface() { -# Configure the MAC and IP address of a virtual device. +configure_bridge_as_dom0_interface() { +# This function configures the MAC and IP address of a bridge to be a +# network interface in Dom0. # -# This function is called by other fuctions. +# Usage: configure_dom0_bridge_interface $BRIDGE $IPADDR $MAC # -# usage: setup_host_interface +# Vars: $BRIDGE -bridge name +# $IPADDR -IP address to assign to the bridge +# $MAC -MAC address to assign to the bridge - local DEV="$1" - local MAC="$2" - local IPADDR="$3" + local BRIDGE="$1" + local IPADDR="$2" + local MAC="$3" case $CMD_OPT in - start) - # take the interface down - ip link set $DEV down + start) + # Take the bridge down + #echo "Taking the $BRIDGE down";read + ip link set $BRIDGE down - # ... and configure it - ip link set $DEV addr $MAC - ip addr flush $DEV - ip addr add $IPADDR brd + dev $DEV + # Assifge bridge a MAC address + #echo "Assign $BRIDGE a MAC address";read + ip link set $BRIDGE addr $MAC + + # Assign the bridge an IP address + #echo"Assign $BRIDGE the IP address: $IPADDR";read + ip addr flush $BRIDGE > /dev/null 2>&1 + ip addr add $IPADDR brd + dev $BRIDGE - # bring it back up - ip link set $DEV up - ip link set $DEV arp on + # Bring the brisge back up + #echo "Bridge $BRIDGE back up";read + ip link set $BRIDGE up + + # Enable ARP in the bridge + #echo "Enable ARP on $BRIDGE";read + ip link set $BRIDGE arp on ;; stop) - # take the interface down - ip link set $DEV down + # Take the bridge down + #echo "Taking $BRIDGE down";read + ip link set $BRIDGE down - # unconfigure it - ip link set $DEV addr fe:ff:ff:ff:ff:ff - ip addr flush $DEV + # Remove MAC address from bridge + #echo "Remove MAC address from $BRIDGE";read + ip link set $BRIDGE addr fe:ff:ff:ff:ff:ff + + # Remove IP address from the bridge + #echo "Remove teh IP address from $BRIDGE";read + ip addr flush $BRIDGE > /dev/null 2>&1 ;; status) - ip addr show $DEV + ip addr show $BRIDGE ;; esac } -#***** Network Type Creation Functions ************************************ +#***** Network Type Configuration Functions ******************************* -create_bridged_networks() { -# Creates traditional bridges on physical devices in Dom0. +configure_bridged_networks() { +# This function creates traditional bridges on physical interfaces (eth) in Dom0. # -# Variables passed in in order: $NET_DEV $NET_NUMBER +# Usage: configure_bridged_networks start|stop|status $NET_DEV $NET_NUMBER +# +# Vars: $DEV -Network device to create the bridge on +# $NUMBER -Number of the bridge being created/removed +# $BRIDGE -Name of the bridge +# $PDEV -What to rename the interface attached to the bridge to - local DEV=$1 - local NUMBER=$2 - local NAME=$BRIDGE_NAME$NUMBER - local BRIDGE="$NAME" - local VDEV="veth$VIF_COUNT" + # Set local function variables + local DEV=$2 + local NUMBER=$3 + local BRIDGE=$BRIDGE_NAME$NUMBER local PDEV="p$DEV" - local VIF0="vif0.$VIF_COUNT" - local VIF_NUM=$VIF_COUNT + + local BRIDGE_IFCFG_FILE="ifcfg-$BRIDGE" # Test if $BRIDGE is set if [ "$BRIDGE" = "null" ] @@ -782,123 +1113,61 @@ create_bridged_networks() { return fi - case $CMD_OPT in + case $1 in start) + # Test if $BRIDGE already exists + if [ -e "/sys/class/net/${BRIDGE}/bridge" ]; then + return + fi + if /sbin/ip link show $DEV | grep -qw UP then echo "" echo "============================================================" - echo "Configuring Virtual Network: $NAME" - echo " of type: $TYPE" + echo "Configuring Virtual Network: $BRIDGE" + echo " of type: bridge" echo " on- Physical Interface: $DEV" - echo " Virtual Interface: vif$NUMBER" echo "============================================================" echo "" - #$SCRIPT_PATH/network_bridge $CMD_OPT netdev=$DEV bridge=$NAME vifnum=$VIF_NUM - #network_bridge $DEV $NAME $VIF_NUM - - # Check if vethX exists and if pethX exists and is up. Fail if not - if ! link_exists "$VDEV" - then - if link_exists "$PDEV" - then - # The device is already up. - return - else - # output error message - echo " -Link $VDEV is missing. -This may be because you have reached the limit of the number of interfaces -that the loopback driver supports. If the loopback driver is a module, you -may raise this limit by passing it as a parameter (nloopbacks=); if the -driver is compiled statically into the kernel, then you may set the parameter -using loopback.nloopbacks= on the domain 0 kernel command line. -" >&2 - exit 1 - fi - fi - - # Create the bridge - create_bridge $BRIDGE - - # Find the corresponding ifcfg-eth-xxx file and source it - get_ifcfg_file - . /etc/sysconfig/network/ifcfg-${hwddev} - - # Check if physical interface is bonded or not and in vethX exists - # Create bridge appropriately - if [ ! "$BONDING_MASTER" = "yes" ] && link_exists "$VDEV" - then - # Create bridge with nornal network interface (i.e. ethX) - create_normal_bridge start $DEV $VDEV $PDEV $BRIDGE $VIF0 - elif [ "$BONDING_MASTER" = "yes" ] - then - # Create bridge with bonded network interface - create_bonded_bridge start $DEV $VDEV $PDEV $BRIDGE $VIF0 - else - # Create old style bridge without $VDEV - transfer_addrs ${netdev} $BRIDGE - transfer_routes ${netdev} $BRIDGE - fi + + # Create bridge + create_normal_bridge start $DEV $PDEV $BRIDGE if [ "${antispoof}" = "yes" ] then antispoofing fi - - echo "" + + # Write entry into networktab + #--------------------------------------------------------------------- + echo "$BRIDGE,bridge,$NUMBER,$DEV,,,dhcp-off" >> $NETWORKTAB + echo "" else - echo " Physical Interface $DEV is not up. Skipping $NAME" + echo " Physical Interface $DEV is not up. Skipping $BRIDGE" fi ;; stop) # Check if bridge exists. Fail if not + #--------------------------------------------------------------------- if ! link_exists "$BRIDGE"; then + echo "$BRIDGE does not exist. Skipping." return fi echo "" echo "============================================================" - echo "Removing Virtual Network: $NAME" - echo " of type: $TYPE" + echo "Removing Virtual Network: $BRIDGE" + echo " of type: bridge" echo "from- Physical Interface: $DEV" - echo " Virtual Interface: vif$NUMBER" echo "============================================================" echo "" - # Find the corresponding ifcfg-eth-xxx file and source it - if brctl show | grep "$BRIDGE" | grep -q "bond[0-9]" - then - hwddev=`brctl show | grep "$BRIDGE" | sed '/s.*bond\(.*\)/bond\1/g'` - netdev=${hwddev} - else - get_ifcfg_file - fi - . /etc/sysconfig/network/ifcfg-${hwddev} - - # Check if physical interface is bonded or not and in pethX exists - # Remove bridge appropriately - if [ ! "$BONDING_MASTER" = "yes" ] && link_exists "$PDEV" - then - # Remove bridge with normal network interface (i.e. ethX) - create_normal_bridge stop $DEV $VDEV $PDEV $BRIDGE $VIF0 - elif [ "$BONDING_MASTER" = "yes" ] - then - # Remove brisge with bonded network interface - create_bonded_bridge stop $DEV $VDEV $PDEV $BRIDGE $VIF0 - else - # Remove old style bridge without $VDEV - if [ ${netdev} = $BRIDGE ] - then - find_bridged_netdev $BRIDGE - fi - ip link set dev ${vif0} down - transfer_routes $BRIDGE ${netdev} - ip link set $BRIDGE down - fi - - # Remove the bridge - brctl delbr $BRIDGE + # Remove bridge with normal network interface (i.e. ethX) + create_normal_bridge stop $DEV $PDEV $BRIDGE + + # Remove entry from networktab file + #--------------------------------------------------------------------- + sed -i "/$BRIDGE/d" $NETWORKTAB ;; status) @@ -912,149 +1181,248 @@ using loopback.nloopbacks= on the domain 0 kernel command line. esac } -create_local_networks() { -# Creates bridges attached to virtual devices in Dom0 and enables nat or routing -# on the bridges if specified. +configure_local_networks() { +# This function creates bridges as network interfaces in Dom0 and +# enables nat or routing on the bridges if specified. # -# This fuction reads the start,stop,status parameter from the $CMD_OPT variable -# and responds respectively. -# -# Variables passed in in order: -# $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV - +# Usage: +# create_local_networks start|stop|status $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_IP $NET_DHCP_SRV # Set local function variables - local DEV=$1 - local TYPE=$2 - local NUMBER=$3 + local DEV=$2 + local TYPE=$3 + local NUMBER=$4 case $TYPE in hostonly) - local NAME=$HOSTONLY_NAME$NUMBER + local BRIDGE=$HOSTONLY_NAME$NUMBER ;; nat) - local NAME=$NAT_NAME$NUMBER + local BRIDGE=$NAT_NAME$NUMBER ;; route) - local NAME=$ROUTE_NAME$NUMBER + local BRIDGE=$ROUTE_NAME$NUMBER ;; esac - local MAC=$4 + #local MAC=$5 local IPADDR=$5 local DHCP_SRV=$6 - local VIF=vif0.$VIF_COUNT + + local IP="`echo $IPADDR | cut -d '/' -f 1`" + local SNM="`ipcalc $IPADDR | grep Netmask | sed 's/Netmask: *//g' | cut -d ' ' -f 1`" local NAT_GW_IP=`echo $IPADDR|cut -d "," -f 3|cut -d "/" -f 1` local NAT_INTIF=$DEV local ROUTE_INTIF=$DEV - case $CMD_OPT in + # Determine what the NAT external interface is + case $NAT_EXTERNAL_INTERFACE in + default) + # Set NAT interface to the interface with the default route + local NAT_DEV=`ip route list | awk '/^default / { print $NF }'` + ;; + *) + # Set the NAT interface to the specified interface + NAT_DEV=$NAT_EXTERNAL_INTERFACE + ;; + esac + + #---- do start or stop -------------------------------------------- + case $1 in start) - if ! brctl show | grep -qw $DEV && /sbin/ip address show $DEV > /dev/null + if ! brctl show | grep -qw $BRIDGE || /sbin/ip address show $BRIDGE > /dev/null then - #------------------------------------------------------------------ - # Create the bridge + # Create the network #------------------------------------------------------------------ echo "" echo "============================================================" - echo "Configuring Virtual Network: $NAME" + echo "Configuring Virtual Network: $BRIDGE" echo " of type: $TYPE" - echo "" - echo " on- Virtual Interface: $VIF" - echo " Virtual Device: $DEV" - create_bridge $NAME > /dev/null 2>&1 - setup_bridge_port $VIF > /dev/null 2>&1 - add_to_bridge $NAME $VIF > /dev/null 2>&1 - setup_host_interface $DEV $MAC $IPADDR > /dev/null 2>&1 + # Create the bridge + create_bridge $BRIDGE > /dev/null 2>&1 + + # Configure the bridge as a Dom0 network interface + configure_bridge_as_dom0_interface $BRIDGE $IPADDR $MAC > /dev/null 2>&1 - #------------------------------------------------------------------ # Set up the bridge as a hostonly / NAT / Routed network - #------------------------------------------------------------------ case $TYPE in NAT|nat) # Set up the bridge as NATed network echo " Gateway: $NAT_GW_IP" - echo " External Interface: $NAT_EXTERNAL_INTERFACE" + echo " External Interface: $NAT_DEV" + + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces start $DEV $TYPE $IPADDR + #fi + + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + esac ;; ROUTE|route) # Set up the bridge as Routed network echo " Gateway: $NAT_GW_IP" - echo " External Interface: $NAT_EXTERNAL_INTERFACE" - iptables -t nat -A PREROUTING -i $ROUTE_INTIF -j ACCEPT - #iptables -t filter -A FORWARD -i $NAT_INTIF -j ACCEPT - #iptables -t filter -A FORWARD -i $NAT_INTIF -j ACCEPT + echo " External Interface: $NAT_DEV" + + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces start $DEV $TYPE $IPADDR + #fi + + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + *) + #iptables -t nat -A PREROUTING -i $ROUTE_INTIF -j ACCEPT + iptables -t nat -A PREROUTING -o $BRIDGE -j ACCEPT + #iptables -t filter -A PREROUTING -i $ROUTE_INTIF -j ACCEPT + #iptables -t filter -A PREROUTING -o $DEV -j ACCEPT + ;; + esac ;; HOSTONLY|hostonly) # Set up the bridge as hostonly network - if [ "$IP_FWD" = "on" ] - then - iptables -t nat -A PREROUTING -i $NAT_INTIF -j DROP - fi + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces start $DEV $TYPE $IPADDR + #fi + + # Restart SuSEfirewall2 if we are using it or add custom iptables rules if not + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + *) + if [ "$IP_FWD" = "on" ] + then + iptables -t nat -A PREROUTING -i $BRIDGE -j DROP + fi + ;; + esac ;; esac + + # Write out new ifcfg file for the bridge + #--------------------------------------------------------------------- + echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "IPADDR=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "IPADDR='$IP'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "NETMASK=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "NETMASK='$SNM'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "BOOTPROTO=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "BOOTPROTO='static'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + + # Configure DHCP for the network + #--------------------------------------------------------------------- + #if ! [ "$DHCP_SRV" = "dhcp-on" ] + #then + # echo + # echo "DHCP disabled on this network." + #else + # create_xen_dhcp_config start $BRIDGE $DEV $TYPE $NUMBER $MAC $IPADDR $DHCP_SRV $IFCFG_FILE_NAME + # + # # Restart the dhcp server + # /etc/init.d/dhcpd restart + #fi + + # write entry into networktab + #--------------------------------------------------------------------- + echo "$BRIDGE,$TYPE,$NUMBER,$DEV,,$IPADDR,$DHCP_SRV" >> $NETWORKTAB + echo "============================================================" else - #------------------------------------------------------------------ # Skip this bridge #------------------------------------------------------------------ - echo " Virtual Interface $DEV is already attached to a bridge or it does not exist." - echo " Skipping $NAME" + echo " Virtual Interface $BRIDGE exists and is already configured." + echo " Skipping $BRIDGE" fi ;; stop) - #------------------------------------------------------------------ - # Remove the bridge + # Remove the network #------------------------------------------------------------------ echo "" echo "============================================================" - echo "Removing Virtual Network: $NAME" + echo "Removing Virtual Network: $BRIDGE" echo " of type: $TYPE" - echo "" - echo " from- Virtual Interface: $VIF" - echo " Virtual Device: $DEV" - #------------------------------------------------------------------ # First remove the hostonly / NAT / Routed configuration - #------------------------------------------------------------------ case $TYPE in NAT|nat) - + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces stop $DEV $TYPE $IPADDR + #fi + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + esac ;; ROUTE|route) - # Clean out the bridge specific routing iptables rule - iptables -t nat -D PREROUTING -i $ROUTE_INTIF -j ACCEPT - #iptables -t filter -D FORWARD -i $DEV -j ACCEPT - #iptables -t filter -D FORWARD -i $NAT_INTIF -j ACCEPT + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces stop $DEV $TYPE $IPADDR + #fi + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + *) + # Clean out the bridge specific routing iptables rule + #iptables -t nat -D PREROUTING -i $ROUTE_INTIF -j ACCEPT + iptables -t nat -D PREROUTING -i $BRIDGE -j ACCEPT + #iptables -t filter -D FORWARD -i $DEV -j ACCEPT + #iptables -t filter -D FORWARD -i $NAT_INTIF -j ACCEPT + ;; + esac + ;; HOSTONLY|hostonly) - # Clean out the bridge specific nat iptables rule - iptables -t nat -D PREROUTING -i $NAT_INTIF -j DROP + # Update SuSEfirewall2 if it exists + #if [ -e "/etc/init.d/SuSEfirewall2_setup" ] + #then + # update_sf2_interfaces stop $DEV $TYPE $IPADDR + #fi + + # Restart SuSEfirewall2 if we are using it or remove custom iptables rules if not + case `cat $NETWORK_SAVE_PATH/use_sf2` in + yes) + handle_sf2 restart + ;; + *) + if [ "$IP_FWD" = "on" ] + then + # Clean out the bridge specific nat iptables rule + iptables -t nat -D PREROUTING -i $BRIDGE -j DROP + fi + ;; + esac ;; esac - + + #create_xen_dhcp_config stop $DEV $TYPE $NUMBER $MAC $IPADDR $DHCP_SRV + echo "============================================================" - #------------------------------------------------------------------ - # Then unconfigure the veth - #------------------------------------------------------------------ - setup_host_interface $DEV $MAC $IPADDR > /dev/null 2>&1 + # unconfigure the veth + configure_bridge_as_dom0_interface $DEV $IPADDR $MAC > /dev/null 2>&1 - #------------------------------------------------------------------ - # remove vif from the bridge - #------------------------------------------------------------------ - brctl delif $NAME $VIF - - #------------------------------------------------------------------ - # unconfigure the vif - #------------------------------------------------------------------ - ip link set $VIF down - ip link set $VIF addr fe:ff:ff:ff:ff:ff - ip link set $VIF multicast on - ip link set $VIF arp on - ip addr flush $VIF - - #------------------------------------------------------------------ - # and finaly unconfigure the bridge - #------------------------------------------------------------------ - ip link set $NAME down - brctl delbr $NAME + # Remove the bridge + #echo "Removing $BRIDGE";read + delete_bridge $BRIDGE + + # Remove network ifcfg config file + #--------------------------------------------------------------------- + rm -f $IFCFG_FILE_DIR/ifcfg-$BRIDGE + + # Remove entry from networktab file + #--------------------------------------------------------------------- + sed -i "/$BRIDGE/d" $NETWORKTAB + ;; status) #------------------------------------------------------------------ @@ -1062,153 +1430,350 @@ create_local_networks() { #------------------------------------------------------------------ echo "" echo "============================================================" - echo "Status of Virtual Network: $NAME" + echo "Status of Virtual Network: $BRIDGE" echo " of type: $TYPE" - echo " on- Virtual Interface: $VIF" - echo " Virtual Device: $DEV" echo "============================================================" - brctl show | grep -w "^$NAME" + brctl show | grep -w "^$BRIDGE" echo "" - ip addr show $DEV + ip addr show $BRIDGE echo "============================================================" ;; *) - echo "The function create_local_networks requires the CMD_OPT variable" - echo "to be set to one of the following: start|stop|status" + echo "The function requires one of the following options:" + echo "start|stop|status" exit 1 ;; esac } -create_nohost_networks() { -# Creates bridges attached to an external interface but no devices in Dom0. +configure_nohost_networks() { +# This function creates bridges attached to an external interface but +# no interfaces in Dom0. # # This function reads the start,stop,status parameter from the $CMD_OPT # variable and responds respectively. # -# Variables passed in in order: $NET_DEV $NET_NUMBER +# Usage: create_nohost_networks start|stop|status $NET_DEV $NET_NUMBER echo "" echo "============================================================" - local DEV=$1 - local PDEV=p$DEV - local MAC=`ip link show $DEV | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - local NUMBER=$2 - local NAME=$NOHOST_NAME$NUMBER + local DEV=$2 + local PDEV="p${DEV}" + local MAC=`ip link show ${DEV} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` + local NUMBER=$3 + local BRIDGE=${NOHOST_NAME}${NUMBER} - case $CMD_OPT in + case $1 in start) - if ! brctl show | grep -qw "^$NAME" + if ! brctl show | grep -qw "^${BRIDGE}" then echo "" echo "============================================================" - echo "Configuring Virtual Network: $NAME" - echo " of type: $TYPE" - echo " on- Virtual Device: $DEV" + echo "Configuring Virtual Network: ${BRIDGE}" + echo " of type: nohost" + echo " on- Physical Interface: ${DEV}" - # create the bridge - create_bridge $NAME - - # back up the interface's info (MAC, etc) - echo $MAC > $NETWORK_SAVE_PATH/$DEV-info - - # configure the interface as a bridge port - setup_bridge_port $DEV - - # rename the physical interface - ip link set $DEV name $PDEV - - # add the interface to the bridge - add_to_bridge $NAME $PDEV + # Create the network + #--------------------------------------------------------------------- + + # Ensure there is a bridge to transfer to + #echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read + create_bridge ${BRIDGE} + + # Rename physical and virtual interfaces + #echo "Rename ${DEV} to ${PDEV}";read + rename_interfaces ${DEV} ${PDEV} + + # Configure $PDEV as a bridge port + #echo "Configure ${PDEV} as a bridge port";read + setup_bridge_port ${PDEV} + + # Bring bridge up and add interfaces to it + #echo "Bring ${BRIDGE} up and add ${PDEV} to it";read + ip link set ${BRIDGE} up + add_to_bridge2 ${BRIDGE} ${PDEV} + + # Write out new ifcfg file for the bridge + #--------------------------------------------------------------------- + #echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + + # Write entry into networktab file + #--------------------------------------------------------------------- + echo "${BRIDGE},nohost,${NUMBER},${DEV},,,," >> ${NETWORKTAB} + fi ;; stop) - if brctl show | grep -qw "^$NAME" + if brctl show | grep -qw "^${BRIDGE}" then echo "============================================================" - echo "Removing Virtual Network: $NAME" - echo " of type: $TYPE" + echo "Removing Virtual Network: ${BRIDGE}" + echo " of type: nohost" echo "" + + # Remove the network + #--------------------------------------------------------------------- + + # Remove interface from bridge + #echo "Remove interface ${PDEV} from ${BRIDGE}";read + brctl delif ${BRIDGE} ${PDEV} + + # Remove bridge ${BRIDGE} + #echo "Remove the bridge";read + delete_bridge ${BRIDGE} + + # Rename physical and virtual network interfaces + #echo "Rename ${PDEV} to ${DEV}";read + #ip link set ${PDEV} name ${DEV} + rename_interfaces ${PDEV} ${DEV} + + # Bring renamed physical interface up + #echo "Bring up ${DEV}";read + ifup ${DEV} > /dev/null 2>&1 - # bring the bridge down - ip link set $NAME down - - # remove the interface from the bridge - brctl delif $NAME $PDEV - - # remove the bridge - brctl delbr $NAME - - # bring the interface down - ip link set down $PDEV - - # reset the interface back to normal - ip link set $PDEV arp on - ip link set $PDEV multicast on - - # reset the interface back to its original name and MAC - ip link set $PDEV name $DEV - ip link set $DEV addr `cat $NETWORK_SAVE_PATH/$DEV-info` - rm -f `cat $NETWORK_SAVE_PATH/$DEV-info` - - # bring the interface back up - ifup $DEV + # Remove entry from networktab file + #--------------------------------------------------------------------- + sed -i "/${BRIDGE}/d" $NETWORKTAB + fi ;; status) - brctl show $NAME | grep -w "^$NAME" + brctl show $BRIDGE | grep -w "^$BRIDGE" ;; *) - echo "The function create_nohost_networks requires the CMD_OPT variable" - echo "to be set to one of the following: start|stop|status" + echo "The function requires one of the following options:" + echo "start|stop|status" exit 1 ;; esac echo "============================================================" } -create_empty_networks() { -# Creates bridges attached to no devices in Dom0. +configure_empty_networks() { +# This function creates bridges attached to no devices in Dom0. # -# This function reads the start,stop,status parameter from the $CMD_OPT -# variable and responds respectively. -# -# Variables passed in in order: $NET_NUMBER +# Usage: create_empty_networks start|stop|status $NET_NUMBER echo "" echo "============================================================" - local NUMBER=$1 - local NAME=$EMPTY_NAME$NUMBER + local NUMBER=$2 + local BRIDGE=$EMPTY_NAME$NUMBER - case $CMD_OPT in + case $1 in start) - if ! brctl show | grep -qw "^$NAME" + if ! brctl show | grep -qw "^$BRIDGE" then - echo "Configuring Virtual Network: $NAME" - echo " of type: $TYPE" - create_bridge $NAME + echo "Configuring Virtual Network: $BRIDGE" + echo " of type: empty" + + # Create the network + #--------------------------------------------------------------------- + + # create the bridge + create_bridge $BRIDGE + + # Write out new ifcfg file for the bridge + #--------------------------------------------------------------------- + #echo "NAME='XEN Virtual Network - $BRIDGE'" > $IFCFG_FILE_DIR/ifcfg-$BRIDGE + grep -q "STARTMODE=" $IFCFG_FILE_DIR/ifcfg-$BRIDGE || echo "STARTMODE='manual'" >> $IFCFG_FILE_DIR/ifcfg-$BRIDGE + + # Write entry into networktab file + #--------------------------------------------------------------------- + echo "$BRIDGE,empty,$NUMBER,,,,," >> $NETWORKTAB + fi ;; stop) - if brctl show | grep -qw "^$NAME" + if brctl show | grep -qw "^$BRIDGE" then - echo "Removing Virtual Network: $NAME" - echo " of type: $TYPE" - ip link set $NAME down - brctl delbr $NAME + echo "Removing Virtual Network: $BRIDGE" + echo " of type: empty" + ip link set $BRIDGE down + + # Remove the network + #--------------------------------------------------------------------- + + # remove the bridge + delete_bridge $BRIDGE + + # Remove entry from networktab file + #--------------------------------------------------------------------- + sed -i "/$BRIDGE/d" $NETWORKTAB + fi ;; status) - brctl show $NAME | grep -w "^$NAME" + brctl show $BRIDGE | grep -w "^$BRIDGE" ;; *) - echo "The function create_empty_networks requires the CMD_OPT variable" - echo "to be set to one of the following: start|stop|status" + echo "The function requires one fo the following options:" + echo "start|stop|status" exit 1 ;; esac echo "============================================================" } +#***** Network Removal Functions ****************************************** + +remove_all_networks() { +# This fuction removes all networks listed in the networktab file by calling +# the network creation functions with the CMD_OPT variable set to "stop" + + CMD_OPT="stop" + + echo "============================================================" + echo "Removing all virtual networks" + echo "============================================================" + + for NETWORK in `cat $NETWORKTAB` + do + local NET_NAME="`echo $NETWORK | cut -d "," -f 1`" + + local NET_TYPE="`echo $NETWORK | cut -d "," -f 2`" + local NET_NUMBER="`echo $NETWORK | cut -d "," -f 3`" + local NET_DEV="`echo $NETWORK | cut -d "," -f 4`" + local NET_DEV_MAC="`echo $NETWORK | cut -d "," -f 5`" + local NET_DEV_IP="`echo $NETWORK | cut -d "," -f 6`" + local NET_DHCP_SRV="`echo $NETWORK | cut -d "," -f 7`" + + # Remove the network + #--------------------------------------------------------------------- + case $NET_TYPE in + bridge) + configure_bridged_networks stop $NET_DEV $NET_NUMBER + ;; + nat|hostonly|route) + configure_local_networks stop $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_MAC $NET_DEV_IP $NET_DHCP_SRV + ;; + nohost) + configure_nohost_networks stop $NET_DEV $NET_NUMBER + ;; + empty) + configure_empty_networks stop $NET_NUMBER + ;; + esac + done + + # Remove any remaining networks + #--------------------------------------------------------------------- + local LEFTOVER_NETS="`find /sys/class/net/ -name brif | cut -d '/' -f 5`" + + for NET in $LEFTOVER_NETS + do + delete_bridge $NET + done +} + +#***** DHCP Functions ***************************************************** + +create_xen_dhcp_config() { +# This function enables/disables the DHCP server on virtual networks. +# +# Usage: +# create_xen_dhcp_config start|stop $NET_NAME $NET_DEV_IP $NET_DHCP_SRV + + # Set local function variables + #--------------------------------------------------------------------- + local NAME=$1 + local BRIDGE="$2" + local IPCIDR="$3" + local DHCPON="$4" + + local IFCFG_FILE_NAME="ifcfg-$DEV" + + 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="$NUMBER" + + # Define DNS servers + #--------------------------------------------------------------------- + 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 + + case $1 in + start) + # Echo out what we are doing + #--------------------------------------------------------------------- + echo "------------------------------------------------------------" + echo " Enabling DHCP" + echo " -------------------" + echo " Subnet: $SUBNET" + echo " Netmask: $NETMASK" + echo " Range: $RANGE" + echo " DNS Servers: $DNS" + echo " Gateway: $IPADDR" + echo "------------------------------------------------------------" + + # Create the dhcpd-xen.$DEV.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 $DHCP_SYSCONFIG_FILE";read + sed -i "s/^DHCPD_INTERFACE=\"\([^\"]*\)\"/DHCPD_INTERFACE=\"\1 $IFCFG_FILE_NAME\"/" $DHCP_SYSCONFIG_FILE + + #echo "editing DHCPD_CONF_INCLUDE_FILES in $DHCP_SYSCONFIG_FILE";read + sed -i "s/^DHCPD_CONF_INCLUDE_FILES=\"\([^\"]*\)\"/DHCPD_CONF_INCLUDE_FILES=\"\1\/etc\/dhcpd-xen.$DEV.conf\"/" $DHCP_SYSCONFIG_FILE + + # Edit the dhcpd.conf file to include additional dhcpd configs for xen + #--------------------------------------------------------------------- + #echo "editing $DHCPD_CONF_FILE to add included config files";read + echo "include \"/etc/dhcpd-xen.$DEV.conf\";" >> $DHCPD_CONF_FILE 2>/dev/null + + ;; + stop) + + # delete the config file + #--------------------------------------------------------------------- + rm -f /etc/dhcpd-xen.$DEV.conf + + # remove the interface file from the /etc/sysconfig file + #--------------------------------------------------------------------- + sed -i "s/$IFCFG_FILE_NAME//g" $DHCP_SYSCONFIG_FILE + + # remove the included config file from the /etc/sysconfig file + #--------------------------------------------------------------------- + sed -i "s/\/etc\/dhcpd-xen.$DEV.conf//g" $DHCP_SYSCONFIG_FILE + + # remove the included config file from the dhcpd.conf file + #--------------------------------------------------------------------- + sed -i "/^include \"\/etc\/dhcpd-xen.$DEV.conf\"/d" $DHCPD_CONF_FILE 2>/dev/null + + ;; + status) + . $DHCPD_CONF_FILE + + echo + echo "DHCP is running on the following interfaces:" + echo " $DHCP_INTERFACE" + echo + ;; + esac +} diff --git a/multinet-include.template b/multinet-include.template new file mode 100644 index 0000000..16119a0 --- /dev/null +++ b/multinet-include.template @@ -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 \ No newline at end of file diff --git a/netfront_mac.patch b/netfront_mac.patch deleted file mode 100644 index a745dcc..0000000 --- a/netfront_mac.patch +++ /dev/null @@ -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); - diff --git a/network-multinet b/network-multinet index c99b8e2..176a037 100644 --- a/network-multinet +++ b/network-multinet @@ -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 diff --git a/pv-driver-build.patch b/pv-driver-build.patch index 7c7b4d3..e2c9bfc 100644 --- a/pv-driver-build.patch +++ b/pv-driver-build.patch @@ -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 + diff --git a/pv-drv-mkbuildtree.patch b/pv-drv-mkbuildtree.patch new file mode 100644 index 0000000..25ad56d --- /dev/null +++ b/pv-drv-mkbuildtree.patch @@ -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 diff --git a/svm-lmsl.patch b/svm-lmsl.patch deleted file mode 100644 index 0c1e685..0000000 --- a/svm-lmsl.patch +++ /dev/null @@ -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); diff --git a/sysconfig.xend b/sysconfig.xend index 460102b..fbc54e9 100644 --- a/sysconfig.xend +++ b/sysconfig.xend @@ -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: # -# ,,,,, +# ,,,, # # Where: # = bridge|nat|route|hostonly|nohost|empty # = The network number (0,1,2,etc.) of that type of # network (i.e. xennat0, xenbr1, xenhost3, etc.) -# = 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 -# = The MAC address to assign to +# = 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 # = The IP address and Subnet Mask to assign to # format= 1.2.3.4/24 # = 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: -# -# ,,,, -# -# 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" - diff --git a/vnc-i18n-keys.diff b/vnc-i18n-keys.diff index 88bba68..f1bf46c 100644 --- a/vnc-i18n-keys.diff +++ b/vnc-i18n-keys.diff @@ -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') diff --git a/x86_64-syscall-clear-df.patch b/x86_64-syscall-clear-df.patch deleted file mode 100644 index 6e46083..0000000 --- a/x86_64-syscall-clear-df.patch +++ /dev/null @@ -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" diff --git a/x86_emulate.patch b/x86_emulate.patch index fe3a2d1..203826d 100644 --- a/x86_emulate.patch +++ b/x86_emulate.patch @@ -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 #include #include +#include #undef cmpxchg - #undef cpuid ++#undef cpuid +#undef wbinvd #endif --#undef wbinvd /* Macro'ed in include/asm-x86/system.h */ #include - /* 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. */ diff --git a/xen-3.2-testing-src.tar.bz2 b/xen-3.2-testing-src.tar.bz2 index 8190c2d..e3140ac 100644 --- a/xen-3.2-testing-src.tar.bz2 +++ b/xen-3.2-testing-src.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7da7e0b2e35bba8e475d26a062540e83b76868bbcc3d3d3d7d1f447ce685115 -size 6404909 +oid sha256:8861bb05830342cad2424e1c1d26ce002fbbbaffbb5c7bfcc08ffd6f52dbccfb +size 5460134 diff --git a/xen-blktab-subtype-strip.patch b/xen-blktab-subtype-strip.patch new file mode 100644 index 0000000..1681b53 --- /dev/null +++ b/xen-blktab-subtype-strip.patch @@ -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); + } diff --git a/xen-dhcpd b/xen-dhcpd deleted file mode 100644 index 783e89d..0000000 --- a/xen-dhcpd +++ /dev/null @@ -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 - - diff --git a/xen-domUloader.diff b/xen-domUloader.diff index 4959ec1..0a235dc 100644 --- a/xen-domUloader.diff +++ b/xen-domUloader.diff @@ -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() diff --git a/xen-fbback-resize.patch b/xen-fbback-resize.patch index 548ab6c..ddfa382 100644 --- a/xen-fbback-resize.patch +++ b/xen-fbback-resize.patch @@ -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 + #include + #include ++#include + #include + #include + #include +@@ -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]; }; diff --git a/xen-hvm-default-bridge.diff b/xen-hvm-default-bridge.diff index 165856d..412d74b 100644 --- a/xen-hvm-default-bridge.diff +++ b/xen-hvm-default-bridge.diff @@ -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') # diff --git a/xen-hvm-netfront.diff b/xen-hvm-netfront.diff deleted file mode 100644 index f261411..0000000 --- a/xen-hvm-netfront.diff +++ /dev/null @@ -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)) { diff --git a/xen-max-free-mem.diff b/xen-max-free-mem.diff index 2359fe5..bc049b2 100644 --- a/xen-max-free-mem.diff +++ b/xen-max-free-mem.diff @@ -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 diff --git a/xen-warnings.diff b/xen-warnings.diff index ada1667..1e58cdd 100644 --- a/xen-warnings.diff +++ b/xen-warnings.diff @@ -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 - #include - #undef cmpxchg -+#undef cpuid - #endif -+#undef wbinvd /* Macro'ed in include/asm-x86/system.h */ - #include - - /* 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 diff --git a/xen.changes b/xen.changes index 8a9b11e..93f5016 100644 --- a/xen.changes +++ b/xen.changes @@ -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 diff --git a/xen.spec b/xen.spec index 5ed22bb..d8cf133 100644 --- a/xen.spec +++ b/xen.spec @@ -1,5 +1,5 @@ # -# spec file for package xen (Version 3.2.0_16701) +# spec file for package xen (Version 3.2.0_16718_02) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -13,7 +13,7 @@ Name: xen %define xvers 3.2 %define xvermaj 3 -%define changeset 16701 +%define changeset 16718 %define xen_build_dir xen-3.2-testing %if %sles_version %define with_kmp 1 @@ -32,7 +32,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit %if %{?with_kmp}0 BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11 %endif -Version: 3.2.0_16701 +Version: 3.2.0_16718_02 Release: 1 License: GPL v2 only Group: System/Kernel @@ -53,12 +53,24 @@ Source11: block-nbd Source12: block-iscsi Source13: block-npiv Source16: xmclone.sh -Source17: sysconfig.xend -Source18: network-multinet -Source19: multinet-common.sh -Source20: xen-dhcpd -Source21: xend-relocation.sh +Source17: xend-relocation.sh +# network-multinet sources +Source18: sysconfig.xend +Source19: network-multinet +Source20: multinet-common.sh +Source21: multinet-include.template +Source22: xend-network # Upstream patches +Patch0: 16716-xend-version.patch +Patch1: 16718-batched-mmu-updates.patch +Patch2: 16777-xend-block-attach.patch +Patch3: 16873-net-nat.patch +Patch4: 16877-blktap.patch +Patch5: 16883-xend-crashed-state.patch +Patch6: 16884-xend-rename-restart.patch +Patch7: 16885-xend-config-comments.patch +Patch8: 16886-xenstore-leak.patch +Patch9: 16890-xenapi-version.patch # Our patches Patch100: xen-config.diff Patch101: xend-config.diff @@ -80,10 +92,9 @@ Patch121: xen-lowmem-emergency-pool.diff Patch122: block-losetup-retry.diff Patch123: block-flags.diff Patch124: xen-hvm-default-bridge.diff -Patch125: xen-hvm-netfront.diff -Patch126: xen-hvm-default-pae.diff -Patch127: xm-test-cleanup.diff -Patch128: cross-build-fix.diff +Patch125: xen-hvm-default-pae.diff +Patch126: xm-test-cleanup.diff +Patch127: cross-build-fix.diff Patch130: xen-generate-foreign-headers.diff Patch131: tools-xc_kexec.diff Patch132: tools-kboot.diff @@ -94,10 +105,9 @@ Patch136: xen-disable-qemu-monitor.diff Patch137: supported_module.diff Patch138: disable_emulated_device.diff Patch140: qemu-security-etch1.diff -Patch141: netfront_mac.patch -Patch142: vnc-i18n-keys.diff -Patch143: rpmlint.diff -Patch144: cdrom-removable.patch +Patch141: vnc-i18n-keys.diff +Patch142: rpmlint.diff +Patch143: cdrom-removable.patch Patch150: bridge-suse.diff Patch151: bridge-bonding.diff Patch152: bridge-hostonly.diff @@ -105,16 +115,18 @@ Patch153: bridge-vlan.diff Patch154: keymap_nl-be.patch Patch155: svm-cr8-performance.diff Patch156: xen-fbback-resize.patch +Patch157: xend-core-dump-loc.diff +Patch158: blktap.patch +Patch159: xen-blktab-subtype-strip.patch # Patches from Jan Patch240: xenctx.patch Patch241: const-callback-arg.patch Patch242: const-set-trap-table-arg.patch -Patch243: svm-lmsl.patch -Patch244: x86_emulate.patch -Patch245: x86-extra-trap-info.patch -Patch290: x86_64-syscall-clear-df.patch -Patch291: 32on64-extra-mem.patch -Patch292: blktap.patch +Patch243: hypercall-check.patch +Patch244: pv-drv-mkbuildtree.patch +Patch245: x86_emulate.patch +Patch246: x86-extra-trap-info.patch +Patch247: 32on64-extra-mem.patch # Ky PV Driver Patches Patch350: pv-driver-build.patch Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ @@ -181,7 +193,7 @@ Authors: %package libs Summary: Xen Virtualization: Libraries Group: System/Kernel -Requires: xen >= 3.2.0_16500 +Requires: xen = %{version} AutoReqProv: on %description libs @@ -230,7 +242,7 @@ Authors: %package tools Summary: Xen Virtualization: Control tools for domain 0 Group: System/Kernel -Requires: xen-libs >= 3.2.0_16500 +Requires: xen-libs = %{version} Requires: bridge-utils multipath-tools python python-curses python-xml pyxml AutoReqProv: on @@ -296,59 +308,6 @@ the virtualized environment. -Authors: --------- - Ian Pratt - -%package tools-ioemu -Summary: Xen Virtualization: BIOS and device emulation for unmodified guests -Group: System/Kernel -Requires: xen-tools >= 3.2.0_16500 -AutoReqProv: on - -%description tools-ioemu -Xen is a virtual machine monitor for x86 that supports execution of -multiple guest operating systems with unprecedented levels of -performance and resource isolation. - -This package contains the needed BIOS and device emulation code to -support unmodified guests. (You need virtualization support in hardware -to make use of this.) - -Modern computers are sufficiently powerful to use virtualization to -present the illusion of many smaller virtual machines (VMs), each -running a separate operating system instance. Successful partitioning -of a machine to support the concurrent execution of multiple operating -systems poses several challenges. Firstly, virtual machines must be -isolated from one another: It is not acceptable for the execution of -one to adversely affect the performance of another. This is -particularly true when virtual machines are owned by mutually -untrusting users. Secondly, it is necessary to support a variety of -different operating systems to accommodate the heterogeneity of popular -applications. Thirdly, the performance overhead introduced by -virtualization should be small. - -Xen uses a technique called paravirtualization: The guest OS is -modified, mainly to enhance performance. - -The Xen hypervisor (microkernel) does not provide device drivers for -your hardware (except for CPU and memory). This job is left to the -kernel that's running in domain 0. Thus the domain 0 kernel is -privileged; it has full hardware access. It's started immediately after -Xen starts up. Other domains have no access to the hardware; instead -they use virtual interfaces that are provided by Xen (with the help of -the domain 0 kernel). - -Xen does support booting other Operating Systems; ports of NetBSD -(Christian Limpach), FreeBSD (Kip Macy), and Plan 9 (Ron Minnich) -exist. A port of Windows XP was developed for an earlier version of -Xen, but is not available for release due to license restrictions. - -In addition to this package you need to install kernel-xen, xen, and -xen-tools to use Xen. - - - Authors: -------- Ian Pratt @@ -489,6 +448,16 @@ Authors: %prep %setup -q -n %xen_build_dir +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %patch100 -p1 %patch101 -p1 %patch102 -p1 @@ -512,7 +481,6 @@ Authors: %patch125 -p1 %patch126 -p1 %patch127 -p1 -%patch128 -p1 %patch130 -p1 %patch131 -p1 %patch132 -p1 @@ -526,7 +494,6 @@ Authors: %patch141 -p1 %patch142 -p1 %patch143 -p1 -%patch144 -p1 %patch150 -p1 #%patch151 -p1 # dump if all goes well with defaulting to network-multinet #%patch152 -p1 # dump if all goes well with defaulting to network-multinet @@ -534,15 +501,17 @@ Authors: %patch154 -p1 #%patch155 -p1 # AMD CR8 Performance - not clean for unstable %patch156 -p1 +%patch157 -p1 +%patch158 -p1 +%patch159 -p1 %patch240 -p1 %patch241 -p1 %patch242 -p1 %patch243 -p1 %patch244 -p1 %patch245 -p1 -%patch290 -p1 -%patch291 -p1 -%patch292 -p1 +%patch246 -p1 +%patch247 -p1 %patch350 -p1 %build @@ -648,10 +617,16 @@ mkdir -p $RPM_BUILD_ROOT/etc/xen/{vm,examples} mv $RPM_BUILD_ROOT/etc/xen/xmexample* $RPM_BUILD_ROOT/etc/xen/examples rm $RPM_BUILD_ROOT/etc/xen/examples/*nbd install -m644 %SOURCE9 %SOURCE10 $RPM_BUILD_ROOT/etc/xen/examples/ -install -m644 %SOURCE17 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend +install -m644 %SOURCE18 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend # scripts rm $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd -install -m755 %SOURCE11 %SOURCE12 %SOURCE13 %SOURCE16 %SOURCE18 %SOURCE19 %SOURCE20 %SOURCE21 $RPM_BUILD_ROOT/etc/xen/scripts/ +install -m755 %SOURCE11 %SOURCE12 %SOURCE13 %SOURCE16 %SOURCE17 $RPM_BUILD_ROOT/etc/xen/scripts/ +# network-multinet scripts +mkdir -p $RPM_BUILD_ROOT/etc/xen/scripts/multinet.d/{post-start,post-stop,pre-start,pre-stop} +install -m644 %SOURCE18 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.xend +install -m755 %SOURCE19 %SOURCE20 $RPM_BUILD_ROOT/etc/xen/scripts/ +install -m644 %SOURCE21 $RPM_BUILD_ROOT/etc/xen/scripts/multinet.d/ +install -m755 %SOURCE22 $RPM_BUILD_ROOT/usr/sbin/ # logrotate install -m644 -D %SOURCE7 $RPM_BUILD_ROOT/etc/logrotate.d/xen # directories @@ -782,16 +757,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info %{_defaultdocdir}/xen/boot.xen %{_defaultdocdir}/xen/misc %dir %pysite/xen -%pysite/xen/* -/usr/lib/xen/boot/domUloader.py - -%files tools-domU -%defattr(-,root,root) -/usr/bin/xen-detect -/bin/xenstore-* - -%files tools-ioemu -%defattr(-,root,root) +# formerly tools-ioemu %dir %{_datadir}/xen %dir %{_datadir}/xen/qemu %dir %{_datadir}/xen/qemu/keymaps @@ -804,6 +770,13 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /usr/lib/xen/bin/xc_kexec %endif /usr/lib/xen/boot/hvmloader +%pysite/xen/* +/usr/lib/xen/boot/domUloader.py + +%files tools-domU +%defattr(-,root,root) +/usr/bin/xen-detect +/bin/xenstore-* %files devel %defattr(-,root,root) @@ -853,118 +826,121 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /sbin/ldconfig %changelog -* Sat Jan 12 2008 - carnold@suse.de +* Fri Feb 01 2008 carnold@novell.com +- Update to xen 3.2 FCS. Changeset 16718 +- Merge xen-tools and xen-tools-ioemu into xen-tools. +* Fri Jan 11 2008 carnold@suse.de - Update to xen 3.2 RC5. Changeset 16701 -* Wed Dec 19 2007 - carnold@novell.com +* Wed Dec 19 2007 carnold@novell.com - Update to xen 3.2 RC2. Changeset 16646 -* Thu Nov 29 2007 - carnold@novell.com +* Thu Nov 29 2007 carnold@novell.com - Added part of upstream c/s 15211. Fixed open call with O_CREAT because it had no mode flags. -* Mon Nov 05 2007 - jfehlig@novell.com +* Mon Nov 05 2007 jfehlig@novell.com - Added upstream c/s 15434 to allow access to serial devices. Bug #338486. -* Thu Nov 01 2007 - carnold@novell.com +* Thu Nov 01 2007 carnold@novell.com - 334445: xenbaked: Fix security vulnerability CVE-2007-3919. -* Thu Nov 01 2007 - carnold@novell.com +* Thu Nov 01 2007 carnold@novell.com - #310279: Kernel Panic while booting Xen -* Tue Oct 02 2007 - ccoffing@novell.com +* Tue Oct 02 2007 ccoffing@novell.com - #286859: Fix booting from SAN -* Thu Sep 13 2007 - ccoffing@novell.com +* Thu Sep 13 2007 ccoffing@novell.com - #310338: Fix "No such file or directory" in network-multinet -* Wed Sep 12 2007 - jfehlig@novell.com +* Wed Sep 12 2007 jfehlig@novell.com - #309940: Fix 'xm reboot' - Moved hvm_vnc.diff and xend_mem_leak.diff to 'Upstream patches' section of spec file since both have been accepted upstream now. -* Mon Sep 10 2007 - jfehlig@novell.com +* Mon Sep 10 2007 jfehlig@novell.com - #289283: Fix memory leak in xend -* Fri Sep 07 2007 - jfehlig@novell.com +* Fri Sep 07 2007 jfehlig@novell.com - #297125: Expose 'type vnc' in vfb device sexp for HVM guests. -* Thu Sep 06 2007 - ccoffing@novell.com +* Thu Sep 06 2007 ccoffing@novell.com - #302106: Update network-multinet -* Wed Sep 05 2007 - carnold@novell.com +* Wed Sep 05 2007 carnold@novell.com - #307458: AMD-V CR8 intercept reduction for HVM windows 64b guests -* Wed Aug 29 2007 - ccoffing@novell.com +* Wed Aug 29 2007 ccoffing@novell.com - Update block-iscsi to match changes to open-iscsi. -* Mon Aug 27 2007 - carnold@novell.com +* Mon Aug 27 2007 carnold@novell.com - #289275 - domu will not reboot if pci= is passed in at boot time. -* Fri Aug 24 2007 - carnold@novell.com +* Fri Aug 24 2007 carnold@novell.com - #297345: Added several upstream patches for hvm migration. -* Fri Aug 17 2007 - jfehlig@novell.com +* Fri Aug 17 2007 jfehlig@novell.com - Added upstream c/s 15128, 15153, 15477, and 15716. These patches provide foundation for bug #238986 - Renamed xend_dev_destroy_cleanup.patch to reflect the upstream c/s number and moved it to "upstream patches" section of spec file. -* Mon Aug 13 2007 - carnold@novell.com +* Mon Aug 13 2007 carnold@novell.com - hvm svm: Log into 'xm dmesg' that SVM NPT is enabled. -* Fri Aug 10 2007 - ccoffing@novell.com +* Fri Aug 10 2007 ccoffing@novell.com - Honor RPM_OPT_FLAGS better -* Thu Aug 09 2007 - ccoffing@novell.com +* Thu Aug 09 2007 ccoffing@novell.com - #298176: Do not enable NX if CPU/BIOS does not support it - #289569: Modify network-bridge to handle vlan - #297295: Fix bridge setup: stop using getcfg -* Tue Aug 07 2007 - olh@suse.de +* Tue Aug 07 2007 olh@suse.de - remove inclusion of linux/compiler.h and linux/string.h remove ExclusiveArch and fix prep section for quilt setup *.spec -* Thu Aug 02 2007 - jfehlig@novell.com +* Thu Aug 02 2007 jfehlig@novell.com - Added patch to fix/cleanup destoryDevice code path in xend. Patch was submitted upstream. Aids in fixing several bugs, e.g. [#217211] and #242953. -* Tue Jul 31 2007 - ccoffing@novell.com +* Tue Jul 31 2007 ccoffing@novell.com - Update Ron Terry's network-multi script - Fix insserv -* Tue Jul 31 2007 - jfehlig@novell.com +* Tue Jul 31 2007 jfehlig@novell.com - Added following upstream patches: + 15642 - Fixes bug 289421 found in SLES10 SP1 but applies to Xen 3.1.0 as well. + 15649, 15650, 15651 - Fixes/enhancements to Xen API required by Xen CIM providers -* Fri Jul 27 2007 - ccoffing@novell.com +* Fri Jul 27 2007 ccoffing@novell.com - #242953: Allow HVM to use blktap - #239173: block-attach as RW for domUloader to avoid failures with reiserfs (since blktap does not yet correctly communicate RO to the kernel) -* Mon Jul 23 2007 - ccoffing@novell.com +* Mon Jul 23 2007 ccoffing@novell.com - Drop xen-bootloader-dryrun.diff; not needed for xen 3.1 - rpmlint: Actually apply patch for #280637 - rpmlint: Rename logrotate config from xend to xen - Don't package xenperf twice - xen-detect is a domU tool -* Mon Jul 23 2007 - jfehlig@novell.com +* Mon Jul 23 2007 jfehlig@novell.com - Added upstream patches that fix various bugs + 15168 fixes check for duplicate domains + 15587 resets domain ID and fixes problems with domain state via Xen API + 15609 stores memory values changed via Xen API -* Thu Jul 19 2007 - ccoffing@novell.com +* Thu Jul 19 2007 ccoffing@novell.com - BuildRequires LibVNCServer-devel - Rotate all logs. - Fix network data corruption on Win2003 with rtl8139. (#254646) - Xen fails to create VM due to "out of memory" errors. (#280637) -* Tue Jul 17 2007 - plc@novell.com +* Tue Jul 17 2007 plc@novell.com - Added CDROM removable media patch from 3.0.4 -* Fri Jul 06 2007 - ccoffing@novell.com +* Fri Jul 06 2007 ccoffing@novell.com - xensource bug #858: Disable strict aliasing for xenstore, to avoid domU hangs. -* Tue Jul 03 2007 - ccoffing@novell.com +* Tue Jul 03 2007 ccoffing@novell.com - #285929: Bad "xendomains status" output w/ empty XENDOMAINS_SAVE -* Tue Jul 03 2007 - carnold@novell.com +* Tue Jul 03 2007 carnold@novell.com - Changes necessary to support EDD and EDID from Jan. -* Wed Jun 20 2007 - jfehlig@novell.com +* Wed Jun 20 2007 jfehlig@novell.com - Added upstream changesets 15273, 15274, and 15275. - Removed the modified 15157 patch. This patch was actually a consolidation of changesets 15157 and 15250. These changesets are now discrete patches to ease subsequent updates of Xen. -* Wed Jun 20 2007 - ccoffing@novell.com +* Wed Jun 20 2007 ccoffing@novell.com - Split vm-install off as a separate package. - Update man page. - Update Ron Terry's network-multi script. -* Mon Jun 18 2007 - ccoffing@novell.com +* Mon Jun 18 2007 ccoffing@novell.com - Fix compiler warnings. - Update block-npiv. -* Mon Jun 11 2007 - ccoffing@novell.com +* Mon Jun 11 2007 ccoffing@novell.com - Fix more warn_unused_value compiler warnings. -* Fri Jun 08 2007 - ccoffing@novell.com +* Fri Jun 08 2007 ccoffing@novell.com - Update to official rc10 (changeset 15042). - Updated vm-install: + easier to exit with Ctrl-C @@ -977,36 +953,36 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info bootsector (consider: no media in /dev/cdrom) + always remove PV kernel and initrd from /tmp + #279153: Support disks on iscsi/qcow/vmdk/nbd/file/phy/... -* Fri Jun 08 2007 - jfehlig@novell.com +* Fri Jun 08 2007 jfehlig@novell.com - Added a modified version of upstream c/s 15157. Original version of c/s 15157 fixed bug #262805 but also broke 'xm block-detach dom dev_name'. Modified version fixes bug 262805 without introducing regression. Patch fixing c/s 15157 has been submitted upstream. -* Wed May 23 2007 - ccoffing@novell.com +* Wed May 23 2007 ccoffing@novell.com - Drop xen-messages.diff; Xen now supports HVM save/restore. -* Tue May 22 2007 - ccoffing@novell.com +* Tue May 22 2007 ccoffing@novell.com - Update Ron Terry's network-multi script. - Drop xen-doc-ps. (#267948) - Update init scripts. - Tidy spec file to fix rpmlint errors. - Updated patches from Jan. -* Mon May 21 2007 - ccoffing@novell.com +* Mon May 21 2007 ccoffing@novell.com - vm-install bug fixes: + #211342: better progress bar + #259994: disk size would reset when editing path + #247073: handle autoyast URLs + #254311: physical disks were showing as 0.0 GB -* Wed May 16 2007 - ccoffing@novell.com +* Wed May 16 2007 ccoffing@novell.com - Properly quote pathnames in domUloader to fix EVMS. (#274484) - Allow user to specify a default 'keymap' in xend's configuration file. (#258818 and 241149) -* Mon May 14 2007 - plc@novell.com +* Mon May 14 2007 plc@novell.com - Added upstream python patches for keymap specification in PV config file. Added upstream ALTGR fix, sign extension fix and modified patch 323 so that upstream patches applied cleanly. (#258818) -* Fri May 11 2007 - ccoffing@novell.com +* Fri May 11 2007 ccoffing@novell.com - Update to xen-3.1-testing rc10 (changeset 15040). - Update .desktop with proper group. (#258600) - Include Kurt's updated block-iscsi. (#251368) @@ -1017,86 +993,86 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info being read incorrectly from xenstore by PV driver. (#272351) - For FV SLES 9, default apic=1 to allow x86_64 SLES 9 to boot. (#264183) -* Fri May 04 2007 - carnold@novell.com +* Fri May 04 2007 carnold@novell.com - Added security fixes for problems found Travis Orandy (#270621) CVE-2007-1320, CVE-2007-1321, CVE-2007-1322, CVE-2007-1323, CVE-2007-1366 -* Thu May 03 2007 - ccoffing@novell.com +* Thu May 03 2007 ccoffing@novell.com - Update to xen-3.1-testing rc7 (changeset 15020). - Fix identification of virt-manager windows. (#264162) -* Tue May 01 2007 - jfehlig@novell.com +* Tue May 01 2007 jfehlig@novell.com - Integrated domUloader with 3.0.5. Updated xen-domUloader.diff. -* Mon Apr 30 2007 - ccoffing@novell.com +* Mon Apr 30 2007 ccoffing@novell.com - Update to xen-3.0.5-testing rc4 (changeset 14993). -* Thu Apr 26 2007 - jfehlig@novell.com +* Thu Apr 26 2007 jfehlig@novell.com - Fixed autobuild error in function that returns random data. File tools/ioemu/hw/piix4acpi.c line 72. Fix added to xen-warnings.diff. -* Thu Apr 26 2007 - ccoffing@novell.com +* Thu Apr 26 2007 ccoffing@novell.com - Fix build on SLES 10 SP1. -* Wed Apr 25 2007 - ccoffing@novell.com +* Wed Apr 25 2007 ccoffing@novell.com - Update to xen-3.0.5-testing rc3 (changeset 14934). - Switch BuildRequires to texlive. -* Fri Apr 20 2007 - ccoffing@novell.com +* Fri Apr 20 2007 ccoffing@novell.com - Updated README. (#250705) - Fix vm-install's detection of PV RHEL4/5 kernels. (#260983) -* Thu Apr 19 2007 - ccoffing@novell.com +* Thu Apr 19 2007 ccoffing@novell.com - Place xenstore-* tools in new xen-tools-domU package, to be used by suse_register. (#249157) -* Tue Apr 17 2007 - ccoffing@novell.com +* Tue Apr 17 2007 ccoffing@novell.com - Update translations. -* Thu Apr 12 2007 - ccoffing@novell.com +* Thu Apr 12 2007 ccoffing@novell.com - Combine two xenstore reads into one transaction, which causes xenstored to not thrash so badly, and makes virt-manager more responsive and less likely to time out or lock up. Partial fix for #237406. - If disk is read-only, pass -r to losetup. (#264158) -* Thu Apr 05 2007 - ccoffing@novell.com +* Thu Apr 05 2007 ccoffing@novell.com - Update vm-install: + #260510: do not delete xml settings file + #260579: write correct vif line for PV NIC in FV VM + #261288: re-enable add disk buttons after deleting a disk + #192272, #222765, #250618: Update OS list and their defaults -* Tue Apr 03 2007 - ccoffing@novell.com +* Tue Apr 03 2007 ccoffing@novell.com - Could not do simultaneous installs via virt-manager. (#259917) -* Mon Apr 02 2007 - jfehlig@novell.com +* Mon Apr 02 2007 jfehlig@novell.com - Fix improper handling of guest kernel arguments in domUloader. Bug #259810 -* Mon Apr 02 2007 - ccoffing@novell.com +* Mon Apr 02 2007 ccoffing@novell.com - Update vm-install: + #259420: refresh available memory more often + #259972: cannot enter autoyast url -* Mon Apr 02 2007 - ccoffing@novell.com +* Mon Apr 02 2007 ccoffing@novell.com - Update translations for RC2. -* Fri Mar 30 2007 - ccoffing@novell.com +* Fri Mar 30 2007 ccoffing@novell.com - Fix "cannot allocate memory" when starting VMs. (#229849, 258743) -* Thu Mar 29 2007 - ccoffing@novell.com +* Thu Mar 29 2007 ccoffing@novell.com - Fix quoting of args for child processes during VM install. (#258376) - Fix retry logic in block hotplug script. (#257925) -* Wed Mar 28 2007 - ccoffing@novell.com +* Wed Mar 28 2007 ccoffing@novell.com - Updated vm-install's icon name. - Updated translations. -* Fri Mar 23 2007 - ccoffing@novell.com +* Fri Mar 23 2007 ccoffing@novell.com - Disable aspects of qemu's console that can affect domain 0. (#256135) - Fix xmclone.sh to work with managed domains. (#253988) - Update to xen-unstable changeset 14535. -* Mon Mar 19 2007 - ccoffing@novell.com +* Mon Mar 19 2007 ccoffing@novell.com - Update to xen-unstable changeset 14444. - Include Ron Terry's network-multi_bridge -* Fri Mar 09 2007 - jfehlig@novell.com +* Fri Mar 09 2007 jfehlig@novell.com - Added lame patch to handle showing suspended state via Xen API. The patch only affects Xen API and is thus low risk. Bug #237859 -* Fri Mar 09 2007 - carnold@novell.com +* Fri Mar 09 2007 carnold@novell.com - Added AMD support for Vista 64 installation and boot. -* Fri Mar 09 2007 - ccoffing@novell.com +* Fri Mar 09 2007 ccoffing@novell.com - Make vm-install support NFS for SUSE (#241251). -* Fri Mar 09 2007 - jfehlig@novell.com +* Fri Mar 09 2007 jfehlig@novell.com - Fixed bug #250522 + Upstream c/s 13557 stores model attribute of vif in xenstore. -* Thu Mar 08 2007 - ccoffing@novell.com +* Thu Mar 08 2007 ccoffing@novell.com - Update vm-install: + Better description on "Virtual Disk" drop-down (not "xvda") + Proper separation of recording options versus calculating @@ -1106,58 +1082,58 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info PV installation disk) + #252437: Allow virtual CDROM to be added (via ISO) even if physical CDROM doesn't exist -* Wed Mar 07 2007 - jfehlig@novell.com +* Wed Mar 07 2007 jfehlig@novell.com - Fixed bug #252396 + Added upstream c/s 14021. Applies to Xen API c-bindings - low risk. + Added local patch to correctly set Xen API Console.protocol property -* Wed Mar 07 2007 - jfehlig@novell.com +* Wed Mar 07 2007 jfehlig@novell.com - Added upstream patch that fixes save/restore on 32pae guests. Upstream c/s 14150. Bug #237859 -* Tue Mar 06 2007 - carnold@novell.com +* Tue Mar 06 2007 carnold@novell.com - Remove a debug message which is spamming the logs during live migration. -* Mon Mar 05 2007 - jfehlig@novell.com +* Mon Mar 05 2007 jfehlig@novell.com - Fixed handling of vbd type in Xen API <-> sexpr integration. Bug #250351 + Updated an existing patch (xend_disk_decorate_rm.patch) and then renamed patch to xend_vbd_type.patch to better reflect purpose of patch. -* Mon Mar 05 2007 - ccoffing@novell.com +* Mon Mar 05 2007 ccoffing@novell.com - Default apic=0 for SLES 8 and 9, for performance. (#228133) -* Fri Mar 02 2007 - carnold@novell.com +* Fri Mar 02 2007 carnold@novell.com - Xen kernel crashes at domain creation time. Bug #248183. Fix mouse for win2k hvm guest. -* Fri Mar 02 2007 - jfehlig@novell.com +* Fri Mar 02 2007 jfehlig@novell.com - Incorrect values returned for actions_after_* in Xen API. Added patch xend-actions-after.patch for fix. Patch submitted upstream as well. Bug #250870. -* Fri Mar 02 2007 - ccoffing@novell.com +* Fri Mar 02 2007 ccoffing@novell.com - Update vm-install: + Fixed possible "tree path exception" when editing disk + Fixed failure to properly refresh fields when editing disk + #248356: allow specifying bridge -* Fri Mar 02 2007 - jfehlig@novell.com +* Fri Mar 02 2007 jfehlig@novell.com - Add check for HVM domain in domain_save. The check is performed in domain_suspend and should be included here as well. -* Thu Mar 01 2007 - ccoffing@novell.com +* Thu Mar 01 2007 ccoffing@novell.com - Update vm-install: + #250201: for linux PVFB, pass xencons=tty if graphics=none + #250016: honor non-sparse flag -* Thu Mar 01 2007 - jfehlig@novell.com +* Thu Mar 01 2007 jfehlig@novell.com - Fix exception caused by incorrect method name in xen-messages.diff. This is one of perhaps several problems with save/restore, bug #237859 -* Thu Mar 01 2007 - dpmerrill@novell.com +* Thu Mar 01 2007 dpmerrill@novell.com - Add xen-ioemu-hvm-pv-support.diff This patch allows for shutting down the IDE drive. -* Thu Mar 01 2007 - jfehlig@novell.com +* Thu Mar 01 2007 jfehlig@novell.com - Fix bug #243667 + Updated domUloader to accept '--args' parameter. The args provided as an option to --args are simply added to the sexpr returned by domUloader. pygrub has similar behavior. -* Wed Feb 28 2007 - ccoffing@novell.com +* Wed Feb 28 2007 ccoffing@novell.com - Update vm-install: + #249013, #228113: default to realtek instead of pcnet + #249124: write os-type to config files @@ -1166,37 +1142,37 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info model exceptions + Add "Add" button to Operating System Installation page, based on usability feedback -* Wed Feb 28 2007 - jfehlig@novell.com +* Wed Feb 28 2007 jfehlig@novell.com - Added changeset 13786 and 14022 from xen-unstable. These changesets affect the Xen API C bindings only and are low risk. This is a continuation of support for FATE feature 110320. ECO has been approved for late arrival of this feature. -* Mon Feb 26 2007 - ccoffing@novell.com +* Mon Feb 26 2007 ccoffing@novell.com - Update vm-install: + #244772: display error message in GUI if xen isn't running + #246049: better error message when OS==SUSE but ISO looks wrong + Fix printing of jobid when run with --background -* Wed Feb 21 2007 - ccoffing@novell.com +* Wed Feb 21 2007 ccoffing@novell.com - Don't allow "xm create" of running VM. (#245253) - Update vm-install: + Fix inability to use already-extracted SUSE kernel/initrds + Fix accumulation of 0-byte tmp files + #237063: close fds before running vncviewer + default apic=0 for Windows, due to performance -* Tue Feb 20 2007 - carnold@novell.com +* Tue Feb 20 2007 carnold@novell.com - Domain0 reboots after 2-6 hours of running guests. (#246160) -* Tue Feb 20 2007 - ccoffing@novell.com +* Tue Feb 20 2007 ccoffing@novell.com - Fix typo in xendomains. (#246107) - Fix order in which vm-install processes command-line arguments. -* Fri Feb 16 2007 - jfehlig@novell.com +* Fri Feb 16 2007 jfehlig@novell.com - Added changeset 13775 from xen-unstable. This patch fixes the last known issue with the Xen API patchset backported from xen-unstable. -* Fri Feb 16 2007 - jfehlig@novell.com +* Fri Feb 16 2007 jfehlig@novell.com - Added c/s 13226 from xen-unstable. It affects Xen API only. - Added patch to remove ':disk' and 'tap:qcow' from stored domain config. Fixes bug #237414 and helps with bug #242953. -* Thu Feb 15 2007 - jfehlig@novell.com +* Thu Feb 15 2007 jfehlig@novell.com - Backported Xen API functionality from xen-unstable to support hosting CIM providers. This functionality is required for FATE feature 110320. ECO has been approved. @@ -1204,14 +1180,14 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info specific to Xen API. + Includes 1 patch that relaxes parsing of xml response in Xen API c-bindings. -* Thu Feb 15 2007 - carnold@novell.com +* Thu Feb 15 2007 carnold@novell.com - Added x86-nmi-inject.patch for NW debuging. (#245942) -* Thu Feb 15 2007 - carnold@novell.com +* Thu Feb 15 2007 carnold@novell.com - kernel panic in DomU while installing 32bit DomU on 64bit Dom0. (#244055) Patches 13630-domctl.patch, 13903-domctl.patch and 13908-domctl.patch - Updated patch pae-guest-linear-pgtable.patch -* Mon Feb 12 2007 - ccoffing@novell.com +* Mon Feb 12 2007 ccoffing@novell.com - Load xenblk at dom0 start to support bootstrapping from non-loopback devices. (#242963, #186696) - Update vm-install: @@ -1221,9 +1197,9 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + #240984: properly detach vncviewer + #240387: default to absolute coordinate mouse for Windows - Drop logging patch. (#245150) -* Mon Feb 12 2007 - ro@suse.de +* Sun Feb 11 2007 ro@suse.de - remove -fstack-protector from RPM_OPT_FLAGS for now -* Thu Feb 08 2007 - ccoffing@novell.com +* Thu Feb 08 2007 ccoffing@novell.com - Update vm-install: + Allow specifing disk (and disk size) vs. cdrom from CLI + Add missing -M/--max-memory parameter to CLI to match GUI @@ -1239,21 +1215,21 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + Output VNC info for backgrounded job + Fix method of waiting for VM to exit when --no-autoconsole + #239582: Use extracted kernel-xen/initrd-xen if present -* Tue Feb 06 2007 - ro@suse.de +* Tue Feb 06 2007 ro@suse.de - disable commented out buildreq for kernel for the moment to workaround endless rebuild -* Tue Feb 06 2007 - ccoffing@novell.com +* Tue Feb 06 2007 ccoffing@novell.com - xm-test should clean up xenstore better (#180138) -* Thu Feb 01 2007 - ccoffing@novell.com +* Thu Feb 01 2007 ccoffing@novell.com - Implement better job support for CIM (#241197) - Temporary fix to allow PV VMs to reboot (#237414) - Delete PYTHONOPTIMIZE for good; callers don't set it. -* Wed Jan 31 2007 - ccoffing@novell.com +* Wed Jan 31 2007 ccoffing@novell.com - Update xen-3.0.4 (changeset 13138); includes migration bugfix. -* Tue Jan 30 2007 - ccoffing@novell.com +* Tue Jan 30 2007 ccoffing@novell.com - Enable building KMP. - Fix xendomains to work with managed domains. (#238781) -* Thu Jan 25 2007 - ccoffing@novell.com +* Thu Jan 25 2007 ccoffing@novell.com - Various bug fixes of 32on64, from Jan and Keir. - Gerd's fix for domain builder with > 4 GB RAM (#233761) - Update xen-vm-install: @@ -1262,7 +1238,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info [#239196]: Support SLED [#239275]: Fix .desktop file [#240064]: Clean up VMs better after failed install -* Tue Jan 23 2007 - ccoffing@novell.com +* Tue Jan 23 2007 ccoffing@novell.com - Update xen-vm-install: [#237370]: Can now install 32pae SLES 10 on x86_64 hypervisor [#237396]: Be able to use an existing disk, bypass OS installation @@ -1271,256 +1247,256 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info Currently conditionalized. - Drop unused patches xen-io-register-context.diff and xen-console.diff -* Sat Jan 20 2007 - brogers@novell.com +* Sat Jan 20 2007 brogers@novell.com - Fix handling of localtime config file parameter for PV guests (#234376) -* Fri Jan 19 2007 - ccoffing@novell.com +* Fri Jan 19 2007 ccoffing@novell.com - Update xen-vm-install (NIC UI work; do not require tcp port bz [#236517]; integrate with virt-manager) -* Wed Jan 17 2007 - ccoffing@novell.com +* Wed Jan 17 2007 ccoffing@novell.com - Update xen-vm-install (more disk UI work; support NetWare response files and licenses) -* Tue Jan 16 2007 - ccoffing@novell.com +* Tue Jan 16 2007 ccoffing@novell.com - Major fixes to xen-vm-install (adding disks in the UI now works, and fixed several CLI exceptions) - Microcode does not need to be exactly 2048 bytes (changeset 13079; Kurt) -* Fri Jan 12 2007 - ccoffing@novell.com +* Fri Jan 12 2007 ccoffing@novell.com - Include script to clone SLES 10 domU, from coolsolutions (fate [#301742]) - Updated patches from Gerd and Jan, including PAE > 4 gig fix, updated VGA console patch. - Updated xen-vm-install with finalized strings and desktop file. -* Thu Jan 11 2007 - ccoffing@novell.com +* Thu Jan 11 2007 ccoffing@novell.com - Include xen-unstable patches for HVM save/restore and 32-on-64 HVM. - Update to xen-3.0.4-1 (changeset 13132). -* Wed Jan 10 2007 - ccoffing@novell.com +* Wed Jan 10 2007 ccoffing@novell.com - Update xen-vm-install and domUloader to support NetWare. - Include AMD's nested page table patches. -* Mon Jan 08 2007 - ccoffing@novell.com +* Mon Jan 08 2007 ccoffing@novell.com - Update to xen-3.0.4 (changeset 13129). - Fix from upstream for mis-emulation of x86-64 pop. -* Fri Jan 05 2007 - carnold@novell.com +* Fri Jan 05 2007 carnold@novell.com - Many patches from Jan Beulich and Gerd Hoffmann in support of 32 on 64 pv guests. These patches apply to both the hypervisor and the tools. -* Fri Dec 22 2006 - ccoffing@novell.com +* Fri Dec 22 2006 ccoffing@novell.com - Do not require authentication on XenAPI socket, since CIMOM does not support authentication. Socket is only accessible to root. -* Wed Dec 20 2006 - ccoffing@novell.com +* Wed Dec 20 2006 ccoffing@novell.com - Update to xen-3.0.4 (changeset 13100). - Update xen-vm-install tools. - Include Jim's 2 xen-tools patches for CIM provider issues. -* Mon Dec 18 2006 - ccoffing@novell.com +* Mon Dec 18 2006 ccoffing@novell.com - Update to xen-3.0.4-rc3 (changeset 13087). - Fix line terminators in block-iscsi (#228864) - Make domUloader work with blktap support in xend. -* Fri Dec 15 2006 - ccoffing@novell.com +* Fri Dec 15 2006 ccoffing@novell.com - Update to xen-3.0.4-rc2 (changeset 13067). -* Thu Dec 14 2006 - ccoffing@novell.com +* Thu Dec 14 2006 ccoffing@novell.com - Update to xen-3.0.4-rc1 (changeset 12901). -* Wed Dec 13 2006 - brogers@novell.com +* Wed Dec 13 2006 brogers@novell.com - Patch for loading bimodal PAE kernel to suuport NetWare -* Thu Dec 07 2006 - ccoffing@novell.com +* Thu Dec 07 2006 ccoffing@novell.com - Update to xen-unstable (changeset 12757). - Enable LIBXENAPI_BINDINGS and XENFB_TOOLS. - Enable unix domain socket for xend; needed by tools. -* Tue Dec 05 2006 - ccoffing@novell.com +* Tue Dec 05 2006 ccoffing@novell.com - Update to xen-unstable (changeset 12734; feature freeze for 3.0.4) - Make /etc/xen mode 0700 to protect vnc passwords. -* Mon Nov 27 2006 - ccoffing@novell.com +* Mon Nov 27 2006 ccoffing@novell.com - Fix how bootloader is called by the xend during restarts. (#223850) -* Wed Nov 22 2006 - ccoffing@novell.com +* Wed Nov 22 2006 ccoffing@novell.com - Series of patches from Jan to address selectors with non-zero- bases and other related issues in HVM. (#214568) - Default pae=1, otherwise 64 bit HVM does not work at all. (#217160) -* Fri Nov 17 2006 - ccoffing@novell.com +* Fri Nov 17 2006 ccoffing@novell.com - Backport several HVM fixes. (#176171?) -* Thu Nov 16 2006 - ccoffing@novell.com +* Thu Nov 16 2006 ccoffing@novell.com - Fix some problems in the xen-hvm-default-bridge patch. (#219092) - xmlrpc isn't 64-bit clean, causing xend to get exceptions when PFN is > 2 GB. (#220418) -* Mon Nov 13 2006 - kallan@novell.com +* Mon Nov 13 2006 kallan@novell.com - Backport changesets 11847, 11888, 1189[6-9], 119[00-18], 11974, 1203[0-2], and 12205 from xen-unstable so that the PV drivers can compile on older kernels such as sles9 and rhel4 - Fix netfront.c to fail the probe if it is called for an ioemu type device. This allows both PV and FV drivers to exist at same time in the FV guest. -* Thu Nov 09 2006 - ccoffing@novell.com +* Thu Nov 09 2006 ccoffing@novell.com - Add xen-vm-install. - Default bridge correctly for HVM guests. (#219092) -* Wed Nov 08 2006 - aj@suse.de +* Wed Nov 08 2006 aj@suse.de - Set correct permissions on man files. -* Tue Nov 07 2006 - ccoffing@novell.com +* Tue Nov 07 2006 ccoffing@novell.com - Update name of blktap.ko in xend init script. (#215384) - Remove some extraneous bad chars in xm manpage. (#218440) - Update logrotate.conf. - Update spec file. -* Wed Nov 01 2006 - kallan@novell.com +* Wed Nov 01 2006 kallan@novell.com - Backport xen-unstable changesets 12040 to address spurious interrupts with PV drivers in HVM guests. -* Tue Oct 31 2006 - ccoffing@novell.com +* Tue Oct 31 2006 ccoffing@novell.com - Backport xen-unstable changesets 1184[1-3] to address SVM interrupt injection issues. Replaces earlier (broken) patches. -* Mon Oct 30 2006 - ccoffing@novell.com +* Mon Oct 30 2006 ccoffing@novell.com - /var/lib/xen/images should not be world readable. (#214638) - Update to xen-3.0.3-0 (changeset 11774; no code changes). -* Mon Oct 16 2006 - ccoffing@novell.com +* Mon Oct 16 2006 ccoffing@novell.com - Update to xen-3.0.3-testing changeset 11772 (rc5). - Fix several possible type errors when running domUloader. - Remove pygrub. Was broken on reiserfs and never had ext2 support, so it is useless. (#173384) - First attempt at moving domUloader to blktap. Still disabled due to block-detach failing. -* Fri Oct 13 2006 - ccoffing@novell.com +* Fri Oct 13 2006 ccoffing@novell.com - Update to xen-3.0.3-testing changeset 11760 (rc4). -* Tue Oct 10 2006 - ccoffing@novell.com +* Tue Oct 10 2006 ccoffing@novell.com - Update to xen-3.0.3-testing changeset 11740 (rc3). - Fix crash on PAE when specifying dom0_mem=4096M. (#211399) - Make xend.balloon aware of kernel's memory floor, to fix "Privileged domain did not balloon" errors. (#184727) -* Mon Oct 09 2006 - ccoffing@novell.com +* Mon Oct 09 2006 ccoffing@novell.com - Include AMD's interrupt injection fix. -* Wed Oct 04 2006 - ccoffing@novell.com +* Wed Oct 04 2006 ccoffing@novell.com - Imported keymap patch. (#203758) - Account for minimum memory required by dom0 kernel. (#184727) - Package /usr/include/xen/hvm/*.h -* Tue Oct 03 2006 - ccoffing@novell.com +* Tue Oct 03 2006 ccoffing@novell.com - Update to xen-3.0.3-testing changeset 11686. -* Tue Oct 03 2006 - kallan@novell.com +* Tue Oct 03 2006 kallan@novell.com - Updated README.SuSE to reflect the current method of handling Xen network-bridging when using SuSEfirewall2. (#205092) -* Sat Sep 30 2006 - aj@suse.de +* Sat Sep 30 2006 aj@suse.de - Cleanup BuildRequires. -* Thu Sep 28 2006 - ccoffing@novell.com +* Thu Sep 28 2006 ccoffing@novell.com - Only "eval" disks once in domUloader, to match current Xen. -* Wed Sep 27 2006 - ccoffing@novell.com +* Wed Sep 27 2006 ccoffing@novell.com - Switch to xen-3.0.3-testing tree; changeset 11633. - Update (but disable) paravirtualized framebuffer patches. -* Tue Sep 26 2006 - ccoffing@novell.com +* Tue Sep 26 2006 ccoffing@novell.com - Update to xen-unstable changeset 11623. - Fix domUloader typo introduced in last update. - Build debug version of xen-pae. -* Mon Sep 25 2006 - ccoffing@novell.com +* Mon Sep 25 2006 ccoffing@novell.com - Update to xen-unstable changeset 11616. -* Tue Sep 12 2006 - ccoffing@novell.com +* Tue Sep 12 2006 ccoffing@novell.com - Update check_python script to identify Python 2.5 RCs as valid. -* Mon Sep 11 2006 - ccoffing@novell.com +* Mon Sep 11 2006 ccoffing@novell.com - Update to xen-unstable changeset 11440. - xen-tools conflicts with qemu. Do not package qemu.1 manpage. (#204758) - Include Jan's updated patch for #192150 (to preserve register context when doing IO). -* Tue Sep 05 2006 - ccoffing@novell.com +* Tue Sep 05 2006 ccoffing@novell.com - Update block-nbd and xmexample.nbd, and add block-iscsi and xmexample.iscsi (from Kurt). -* Thu Aug 31 2006 - ccoffing@novell.com +* Thu Aug 31 2006 ccoffing@novell.com - Automatically create/destroy virtual frame buffer viewer. Add "sdl=1" to config file of a paravirtualized VM to get the viewer. - Log files have moved to /var/log/xen. -* Tue Aug 29 2006 - ccoffing@novell.com +* Tue Aug 29 2006 ccoffing@novell.com - xendomains does not actually save domains. (#201349) - Update to xen-unstable changeset 11299. -* Tue Aug 29 2006 - ccoffing@novell.com +* Mon Aug 28 2006 ccoffing@novell.com - Fix incorrect path on x86_64 for vncfb and sdlfb. -* Thu Aug 17 2006 - ccoffing@novell.com +* Thu Aug 17 2006 ccoffing@novell.com - Improve xendomains init script, to handle unset sysconfig vars. - Import virtual framebuffer patches. - Drop reboot patch; resync patches. -* Wed Aug 16 2006 - ccoffing@novell.com +* Wed Aug 16 2006 ccoffing@novell.com - Update to xen-unstable changeset 11134. - Drop xen-reverse-10064.diff now that kernel is updated. -* Tue Aug 08 2006 - ccoffing@novell.com +* Tue Aug 08 2006 ccoffing@novell.com - Re-enabled patch for #184175. - Update to xen-unstable changeset 10986. - Include Jan's patch to preserve register context when doing IO. (#192150) -* Fri Jul 28 2006 - ccoffing@novell.com +* Fri Jul 28 2006 ccoffing@novell.com - Add support to domUloader for "xm create --dry-run". Based on patch from HP. -* Thu Jul 27 2006 - ccoffing@novell.com +* Thu Jul 27 2006 ccoffing@novell.com - Add link for qemu-dm that is invariant across architectures, so that VM config files can be simple key/value pairs parsable by yast, and still be movable to another arch. (#193854) - Add loop.ko to rescue image created by mk-xen-rescue-img, and remove usbfs from image's /etc/fstab since USB isn't yet supported, to avoid errors during boot. (#191627) -* Mon Jul 17 2006 - ccoffing@novell.com +* Mon Jul 17 2006 ccoffing@novell.com - Update to xen-unstable changeset 10712. - Update domUloader and rcxend to work with blktap. -* Fri Jul 14 2006 - ccoffing@novell.com +* Fri Jul 14 2006 ccoffing@novell.com - When waiting for domains to shut down, must also wait for loopback devices to be torn down, otherwise higher-level tools may migrate a VM before the disk image is flushed. (#185557) - More updates to the README. -* Thu Jul 13 2006 - kallan@novell.com +* Thu Jul 13 2006 kallan@novell.com - Added for loop to retry the losetup -d in /etc/xen/scripts/block. It is possible for the losetup -d to fail if another process is examining the loopback devices e.g. losetup -a. (#151105) -* Wed Jul 12 2006 - ccoffing@novell.com +* Wed Jul 12 2006 ccoffing@novell.com - Corrected and updated README. -* Mon Jul 10 2006 - ccoffing@novell.com +* Mon Jul 10 2006 ccoffing@novell.com - Add Jeff Mahoney's block-sync.diff, to give control of "losetup -y" to the user (and potentially yast). Defaults to old async behavior. (#190869) -* Thu Jul 06 2006 - ccoffing@novell.com +* Thu Jul 06 2006 ccoffing@novell.com - Update to xen-unstable tree. Revert changeset 10064, to maintain backwards compatibility with SLES 10. -* Wed Jul 05 2006 - ccoffing@novell.com +* Wed Jul 05 2006 ccoffing@novell.com - Do not open migration port by default. (#190170) - Update patch for migration oops, to latest version in bug [#162865]. -* Mon Jul 03 2006 - okir@suse.de +* Mon Jul 03 2006 okir@suse.de - xen-losetup-sync.diff: use the new "losetup -y" option to force the loop device to use synchronous I/O (#189051) -* Fri Jun 30 2006 - ccoffing@novell.com +* Fri Jun 30 2006 ccoffing@novell.com - Increase balloon timeout value. (#189815) - Update to xen-3.0-testing tree, changeset 9762. -* Thu Jun 29 2006 - ccoffing@novell.com +* Thu Jun 29 2006 ccoffing@novell.com - Fix some loopback races in domUloader. (#151105) -* Tue Jun 27 2006 - ccoffing@novell.com +* Tue Jun 27 2006 ccoffing@novell.com - Add "max_para_memory" and "max_hvm_memory" to output of "xm info" for bug #184727. - Include Jan's patches for bug #184175. Improves PAE guest support on HVM. -* Mon Jun 26 2006 - ccoffing@novell.com +* Mon Jun 26 2006 ccoffing@novell.com - Include patch from HP to fix a domU migration failure ("Kernel BUG at mm/mmap.c:1961"). Force L1/L2 page tables to be updated at the end, to avoid them from being dirtied and not transferred. (#162865) -* Fri Jun 23 2006 - kallan@novell.com +* Fri Jun 23 2006 kallan@novell.com - Updated xen-bonding.diff to enable bonding again after the latest patches to network-bridge etc. (#161888) -* Wed Jun 21 2006 - ccoffing@novell.com +* Wed Jun 21 2006 ccoffing@novell.com - Clean up the useless "Nothing to flush" messages, from 'ip addr flush', in /var/log/xen-hotplug.log - Fix race condition in domUloader.py, when another process did losetup -d while domUloader was running. This would result in the mount failing, and so the VM would fail to start. -* Tue Jun 20 2006 - ccoffing@novell.com +* Tue Jun 20 2006 ccoffing@novell.com - Revamp balloon.py to account for pages currently being scrubbed. (#185135) -* Mon Jun 19 2006 - ccoffing@novell.com +* Mon Jun 19 2006 ccoffing@novell.com - Update to xen-3.0-testing tree, changeset 9749. - DomUs are getting starved for CPU (up to 40 seconds was seen) when dom0 has a load. This can cause pathological behavior, and can cause OCFS2 to fence (panic) the domain. (#179368, #178884) - Import Gerd's fix to network-bridge script for bug #161888. -* Wed Jun 14 2006 - ccoffing@novell.com +* Wed Jun 14 2006 ccoffing@novell.com - Pull out accidentally-included debugging code. - Drop xenvers patch; this was for backwards compatibility for some early internal builds. - Update from Jan on the console patch. Not all graphics cards / drivers properly reflect the state in the register being tested. Improved the check, to prevent screen corruption. (#161541) -* Tue Jun 13 2006 - ccoffing@novell.com +* Tue Jun 13 2006 ccoffing@novell.com - Resync with new tarball from xen-3.0-testing; changeset 9738. -* Mon Jun 12 2006 - ccoffing@novell.com +* Mon Jun 12 2006 ccoffing@novell.com - Drop BUILD_BUG_ON and pirq-shared patches. Last week's pirq sharing patch from upstream (for bug #152892) makes these patches redundant. Dropping these makes our shared_info structure match @@ -1535,7 +1511,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info Without this, process run-time accounting on secondary CPUs is completely wrong. - Updated README: Documented work-around for bug #180058. -* Fri Jun 09 2006 - ccoffing@novell.com +* Fri Jun 09 2006 ccoffing@novell.com - Include Jan's patch: "IOPL is ignored for VM86 mode port accesses. Fix Xen emulation to match native behaivour." Fixes some X lockup issues. (#179045) @@ -1553,16 +1529,16 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info dropped the HT CPUID masking code, which we then inheirited. Re-add HT CPUID masking. (#162244) - Updated README: VNC installations, known issues. -* Thu Jun 08 2006 - ccoffing@novell.com +* Thu Jun 08 2006 ccoffing@novell.com - Drop our XCHG patch for the equivalent upstream patch, to fix patch application order. No code change. -* Wed Jun 07 2006 - ccoffing@novell.com +* Wed Jun 07 2006 ccoffing@novell.com - Updated README: HVM issues/tips, CDROM tips, known issues. - Add patch from Intel to decode LODS/STOS instructions to fix Windows installation. Only affects HVM. Xen changeset #9725 consolidates this patch and xen-hvm-decode.diff; drop our 2 in favor of the consolidated upstream patch. (#176717) -* Tue Jun 06 2006 - ccoffing@novell.com +* Tue Jun 06 2006 ccoffing@novell.com - Drop xen-8-way-bios patch, because it breaks Windows HVM installation. The patch was only necessary when running SMP HVM with "acpi=0" on the kernel command line. (#181974) @@ -1578,7 +1554,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Removed pointless whitespace changes from xen-removable.diff, for better maintainability. Cut the patch size in half; no code changes. -* Mon Jun 05 2006 - ccoffing@novell.com +* Mon Jun 05 2006 ccoffing@novell.com - Include select patches from xen-3.0-testing: + 9698: Official fix for bug #159001. Dropped our patch. + 9702: Fix MMU_NORMAL_PT_UPDATE when passed a page that is no @@ -1593,16 +1569,16 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + 9708: HVM: Fix a hang when doing an "xm destroy" of Windows VM. + 9717: HVM: Interrupts must be kept disabled when entering Xen for external interrupt processing. -* Fri Jun 02 2006 - ccoffing@novell.com +* Fri Jun 02 2006 ccoffing@novell.com - Include xen-3.0-testing changeset 9693. This scales the ballooning timeout with the amount of memory being requested (necessary for large memory machines). This is a more proper fix for Novell bug #175805, and addresses XenSource bug #650. -* Thu Jun 01 2006 - ccoffing@novell.com +* Thu Jun 01 2006 ccoffing@novell.com - Update the README, regarding how to make the mouse work properly with VNC in HVM. - Update help text in mk-xen-rescue-img. -* Wed May 31 2006 - ccoffing@novell.com +* Wed May 31 2006 ccoffing@novell.com - Jan's backport of xen-unstable changesets 9517, 9518, and 9529. This allows Xen to boot on 4-node configurations without crashing. (#150114) @@ -1616,7 +1592,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Add CPUID masking patches from AMD and Intel for HVM. This prevents the OS from seeing (and trying to use) various hardware features that are not supported within the VM. (#180879) -* Fri May 26 2006 - ccoffing@novell.com +* Fri May 26 2006 ccoffing@novell.com - Fix deadlock between xm and qemu. Qemu should not call xm; issue xc commands directly. This deadlock was exposed when making qemu exit nicely and clean up. (#176400) @@ -1638,7 +1614,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info functions. This is prep work from Jan for bug #160066. + 9695: Updates in the hypervisor to EDI and ESI could be incorrect, due to sign not being handled correctly. -* Fri May 19 2006 - ccoffing@novell.com +* Fri May 19 2006 ccoffing@novell.com - Update from Intel to previous patch to fix installation of HVM W2k. Adds decoding for two more instructions. (#176717) - Updated the README. @@ -1648,7 +1624,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info adjusted. (#175124) - Include Intel's patch for unchecked allocations in shadow*.c. (#149179) -* Thu May 18 2006 - ccoffing@novell.com +* Thu May 18 2006 ccoffing@novell.com - Include Intel's patch to fix installation of HVM W2k. This patch adds decoding for 'xor' and 'and' instructions. Without this, the VM crashes when W2k attempts to install network components. @@ -1672,14 +1648,14 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + 9685,9686: This patch only affects full virtualization on Intel. Fixes VM's segment base address, to avoid vmentry failure. Also remove 32/64 differences in vmx reg store/load. -* Wed May 17 2006 - ccoffing@novell.com +* Wed May 17 2006 ccoffing@novell.com - When auto-ballooning domain 0's memory for a new HVM domain, all memory (including memory intended for overhead) was given to the VM itself. So increasing the memory size calculations did not actually free up any more memory. Now, treat the amount to balloon and the amount to give to the VM as separate values. (#149179) -* Tue May 16 2006 - ccoffing@novell.com +* Tue May 16 2006 ccoffing@novell.com - Include Gerd's fix for HVM emulation of REP MOVS when the copy spans a page. If the direction flag was set, the emulation code broke. This caused the VM to freeze when configuring firewall @@ -1690,10 +1666,10 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Increase maximum time auto-ballooning will wait for domain 0 to respond, otherwise large VMs will fail to start from yast (#175805). -* Mon May 15 2006 - ccoffing@novell.com +* Mon May 15 2006 ccoffing@novell.com - Update memory size calculations when auto-ballooning for HVM to make more stable (#149179). -* Fri May 12 2006 - ccoffing@novell.com +* Fri May 12 2006 ccoffing@novell.com - Include select patches from xen-3.0-testing: + 9674: xc_ptrace: Fix reversed conditional, which broke single- stepping. @@ -1701,58 +1677,58 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + 9678: Fix the performance issues of 2-level paging HVM guests on the PAE Xen. - Update man pages. -* Wed May 10 2006 - brogers@novell.com +* Wed May 10 2006 brogers@novell.com - Fix loading of binary images which either require PAE or dynamically support running on both PAE hypervisor and non-PAE hypervisors. (#174080) -* Wed May 10 2006 - carnold@novell.com +* Wed May 10 2006 carnold@novell.com - Handle memory failure when staring fully virtualized guests to prevent reboot of the box (AMD) or hanging the box (VT) (#149179). -* Tue May 09 2006 - ccoffing@novell.com +* Tue May 09 2006 ccoffing@novell.com - Include select patches from xen-3.0-testing: + 9665: Fix pciif parsing for compatibility variable. + 9666: Fix HVM hang; was broken due to previous "hda lost interrupt" patch. (#169146) + 9667: Do not set GP fault in VMCS for VMX (no bug#; from Intel) -* Thu May 04 2006 - cgriffin@novell.com +* Thu May 04 2006 cgriffin@novell.com - Update xen-3.0-testing tree, changeset 9664: + Changesets 9663 and 9664 fix AMD fully virtualized guests causing the system to reboot when first starting up. (#169855) -* Thu May 04 2006 - cgriffin@novell.com +* Thu May 04 2006 cgriffin@novell.com - With a Xen domain set up with a loop-mountable file as rootfs, the "xm start " invocation fails. The cause is a bug domUloader.py (#172586) -* Thu May 04 2006 - rmaxfiel@novell.com +* Thu May 04 2006 rmaxfiel@novell.com - Added the ability to 'attach' and 'detach' removable media devices to hvm guests. Also made cdrom eject when the eject request comes from the hvm guest. (#159907) - Fixed the loss of mouse when a SDL session ends with 'grab' in effect. (#159001) -* Thu May 04 2006 - cgriffin@novell.com +* Thu May 04 2006 cgriffin@novell.com - Update xen-3.0-testing tree, changeset 9661: + Drop patches merged upstream + Took Kier's official patches for dropped patches most notably spurious interrupts (#152892) - Took Intel's patch to fix screen corruption when resizing the screen of windows hvm guests (#164573) -* Wed May 03 2006 - kallan@novell.com +* Wed May 03 2006 kallan@novell.com - Added configuring network interfaces when using Xen bridging instructions to the README.SuSE file as requested by bug #171533. -* Mon May 01 2006 - tthomas@novell.com +* Mon May 01 2006 tthomas@novell.com - Added message to xm save to indicate that save is not currently supported for fully virtualized guests. (#161661) -* Fri Apr 28 2006 - ccoffing@novell.com +* Fri Apr 28 2006 ccoffing@novell.com - Close fds before exec-ing vncviewer, so yast2-vm doesn't hang when viewing fully-virtualized console (#168392). -* Thu Apr 27 2006 - ccoffing@novell.com +* Thu Apr 27 2006 ccoffing@novell.com - Update xen-3.0-testing tree, changeset 9656: + Drop patches merged upstream. + Fix reboot on large SMP machines (IBM, no bug #). - Integrate Jan's patches: + Spurious interrupt roundup (#152892). -* Mon Apr 24 2006 - ccoffing@novell.com +* Mon Apr 24 2006 ccoffing@novell.com - Integrate Jan's patches: + FXSR patch (#135677). + APIC option patch (work-around #150114). @@ -1761,7 +1737,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info + Avoid spurious timer activations in hypervisor. + Fix xen command line parsing (lapic / nolapic parsing). + Fix inverted BUG_ON w.r.t. SiS APIC bug. -* Fri Apr 21 2006 - ccoffing@novell.com +* Fri Apr 21 2006 ccoffing@novell.com - Update to 3.0.2-2 (xen-3.0-testing tree, changeset 9640): + Fix for "hda lost interrupt" for PAE VMX. + Increase L2 PDE to 1 GB; allows x86_64 to boot larger dom0. @@ -1770,115 +1746,115 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Add Jan's port of spurious interrupt patch (#152892). - Add /etc/xen/images link for convenience (#168070). - Updated README. -* Thu Apr 20 2006 - ccoffing@novell.com +* Thu Apr 20 2006 ccoffing@novell.com - SiS APIC bug patch (Jan Beulich, #116485). -* Wed Apr 19 2006 - agruen@suse.de -- Create /boot symlinks in the %%install section instead of in - %%post so that they will end up in the package file list. -* Wed Apr 19 2006 - ccoffing@novell.com +* Wed Apr 19 2006 ccoffing@novell.com - Don't kill xenstored and xenconsoled when stopping xend. (#158562, #156261) -* Wed Apr 19 2006 - ccoffing@novell.com +* Wed Apr 19 2006 ccoffing@novell.com - Update to 3.0.2-2 (xen-3.0-testing tree, changeset 9629): + Fix for SMP IA32 VMX guest booting. + KY's SETMAXMEM fix. -* Wed Apr 19 2006 - cgriffin@novell.com +* Wed Apr 19 2006 cgriffin@novell.com - Removed HTT bit from cpuid and set logical processor count to 1. Also fixed logic problem in svm code where apic=0 was not handled (#162244). -* Tue Apr 18 2006 - ccoffing@novell.com +* Wed Apr 19 2006 agruen@suse.de +- Create /boot symlinks in the %%install section instead of in + %%post so that they will end up in the package file list. +* Tue Apr 18 2006 ccoffing@novell.com - Add /etc/xen/vm to vm config file search path (#167208). -* Fri Apr 14 2006 - kallan@novell.com +* Fri Apr 14 2006 kallan@novell.com - Add support for bonding in network-bridge. (#161678). -* Fri Apr 14 2006 - ccoffing@novell.com +* Fri Apr 14 2006 ccoffing@novell.com - Update to 3.0.2-2 (xen-3.0-testing tree, changeset 9620): + Fixes stack corruption in libxs (XenSource #411). -* Thu Apr 13 2006 - rmaxfiel@novell.com +* Thu Apr 13 2006 rmaxfiel@novell.com - Fixed a problem in ioemu which exited when the cdrom line was found in the guest def file but the cd device contained no media. (#161210) -* Wed Apr 12 2006 - ccoffing@novell.com +* Wed Apr 12 2006 ccoffing@novell.com - Auto-balloon domain 0 for HVM domains (#149179). - Update to 3.0.2-1 (xen-3.0-testing tree, changeset 9612): + Fixes xmlrpc issues. + Fixes several emulated instructions for HVM. + Fixes for x86_64 inline assembly. -* Tue Apr 11 2006 - ccoffing@novell.com +* Tue Apr 11 2006 ccoffing@novell.com - Fix "jitter" and race in dom0's memory target calculation, which could cause auto-ballooning to fail (#164714). -* Tue Apr 11 2006 - brogers@novell.com +* Tue Apr 11 2006 brogers@novell.com - Fix problem where localtime=1 results in zombie domains after they shutdown (#164960) -* Mon Apr 10 2006 - ccoffing@novell.com +* Mon Apr 10 2006 ccoffing@novell.com - Update to hg 9598 (xen-3.0-testing tree; 3.0.2-rc). Discounting Linux changes and patches we already carry, this update contains: + Saner error handling in iret hypercall (x86/64). + Make root page table sanity check on restore more generic. + Additional sanity / compatability checks during guest build. + IO-APIC update hypercall fixes. -* Fri Apr 07 2006 - ccoffing@novell.com +* Fri Apr 07 2006 ccoffing@novell.com - Don't throw an exception if 'xm top' is run by non-root; print error message instead (#164224). - Change localtime patch to account for daylight savings time (Bruce Rogers). - Re-add patch to make tightvnc work. It was accidentally dropped recently (#149556). -* Thu Apr 06 2006 - ccoffing@novell.com +* Thu Apr 06 2006 ccoffing@novell.com - Update to hg 9590 (xen-3.0-testing tree; 3.0.2-rc). - Fix type error in localtime patch for para (Bruce Rogers). - Fix default localtime for full (Bruce Rogers). - Fix path in mk-xen-resue-img.sh (#163622). - Update README (pathnames, yast2-vm descriptions, terminology). -* Tue Apr 04 2006 - garloff@suse.de +* Mon Apr 03 2006 garloff@suse.de - init script: Test for control_d in capabilities to determine dom0 rather than privcmd. - init script: Try loading netloop and backend modules. - mk-xen-rescue-img.sh: Copy frontend drivers, remove stale files. - example config files: provide commented out domUloader exmaples. -* Mon Apr 03 2006 - ccoffing@novell.com +* Mon Apr 03 2006 ccoffing@novell.com - Update to hg 9514 (xen-unstable tree; 3.0.2-rc). - Fix for rebooting (Jan Beulich; #160064). -* Fri Mar 31 2006 - ccoffing@novell.com +* Fri Mar 31 2006 ccoffing@novell.com - Update to hg 9502 (xen-unstable tree; 3.0.2-rc). - Update man page (#162402). - xen-tools requires python-xml (#161712). - Include localtime patch to support NetWare (Bruce Rogers). -* Thu Mar 30 2006 - ccoffing@novell.com +* Thu Mar 30 2006 ccoffing@novell.com - Update to hg 9481 (xen-unstable tree; 3.0.2-rc). - Correctly default XAUTHORITY if it is not set. This allows the GUI to come up for fully virtualized guests (was especially problematic when VM was started from YaST). (#142472) -* Wed Mar 29 2006 - ccoffing@novell.com +* Wed Mar 29 2006 ccoffing@novell.com - Fixed reversed "Do I have enough memory?" test when creating new VMs (#156448). -* Tue Mar 28 2006 - ccoffing@novell.com +* Tue Mar 28 2006 ccoffing@novell.com - Pick up two critical fixes for AMD to fix full virtualization: c/s 9453 & c/s 9456. -* Thu Mar 23 2006 - ccoffing@novell.com +* Thu Mar 23 2006 ccoffing@novell.com - Update to hg 9434 (xen-unstable tree; 3.0.2-rc). - Fix /etc/xen/scripts/block to properly check if devices can be shared. - Default XENDOMAINS_AUTO_ONLY to true; previous setting contradicts yast2-vm's claim that only VM's marked auto will be auto-started. -* Mon Mar 20 2006 - ccoffing@novell.com +* Mon Mar 20 2006 ccoffing@novell.com - Update to hg 9329 (xen-unstable tree). -* Wed Mar 15 2006 - ccoffing@novell.com +* Wed Mar 15 2006 ccoffing@novell.com - Update to hg 9251 (xen-unstable tree). - Update to latest versions of Intel's VNC patches: patch-vga-sse2-0314.l, patch-vnc_loop-0314.l, patch-vncmouse-0315.l - Gather example files in /etc/xen/examples. -* Tue Mar 14 2006 - rmaxfiel@novell.com +* Tue Mar 14 2006 rmaxfiel@novell.com - Removed the intermediate sym-link between xen.gz and xen--.gz. Grub 0.97 XFS can not handle a double indirect to a file. (#151792) -* Tue Mar 14 2006 - garloff@suse.de +* Mon Mar 13 2006 garloff@suse.de - Update README.SuSE: Document limits (mem, cpu hotplug, max_loop), more network troubleshooting, update security info. - Be more tolerant against errors in ifdown/ifup to better coexist with non-std network setups (e.g. ifplugd/NetworkManager). -* Tue Mar 07 2006 - ccoffing@novell.com +* Tue Mar 07 2006 ccoffing@novell.com - Update to hg 9172 (xen-unstable tree). - Create new xen-libs package, split from xen-tools (#154473). - Update mk-xen-rescume-img and xmexample.rescue to work with @@ -1895,16 +1871,16 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info whole script (Kirk Allan) (#154115). - Make network-bridge script more robust, by checking /sys instead of grep-ing. -* Mon Mar 06 2006 - ccoffing@novell.com +* Mon Mar 06 2006 ccoffing@novell.com - Update to hg 9148 (xen-unstable tree). Drop patches merged upstream. - More README improvements (#154134). - Fix "vncviewer=1" to bring up vncviewer (#149556). -* Mon Mar 06 2006 - ccoffing@novell.com +* Mon Mar 06 2006 ccoffing@novell.com - Fix build of hvmloader and vmxassist by removing external CFLAGS (XS changeset #9110). - Fix build by forcing --prefix during installation of *.py. -* Wed Mar 01 2006 - ccoffing@novell.com +* Wed Mar 01 2006 ccoffing@novell.com - Update to hg 9029 (xen-unstable tree). Adds support for HVM on 64 bit hardware. - Update vncmouse diff to 20060301 from Intel; compensates for lack @@ -1912,7 +1888,7 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Fix many bugs in lomount. - Cap maximum value of "xm mem-set" for domain 0, based on size of dom0's page tables (#152667). -* Mon Feb 27 2006 - ccoffing@novell.com +* Mon Feb 27 2006 ccoffing@novell.com - Update to hg 9015 (xen-unstable tree). More bug fixes. - Update patch to better honor RPM_OPT_FLAGS. - Updated README (#154134). @@ -1920,37 +1896,37 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info corrupting the display. - Change max mouse polling time from 1ms to 10ms to reduce CPU load (from Intel). -* Thu Feb 23 2006 - ccoffing@novell.com +* Thu Feb 23 2006 ccoffing@novell.com - Update to hg 8954 (xen-unstable tree). More bug fixes. - Don't use a dummy IP of 1.2.3.4 for NFS server when booting domU with DHCP. Seems to hang x86_64 Linux. - Remove unnecessary x86_64 patch. - Fix auto-ballooning of dom0 memory for HVM domUs (XenSource bug 521). -* Tue Feb 21 2006 - ccoffing@novell.com +* Tue Feb 21 2006 ccoffing@novell.com - Update to hg 8920 (xen-unstable tree). Fixes instruction decode for fully virtualized guests, fixing booting from CDs. - Integrate 3 patches from Intel, to improve VNC performance. -* Tue Feb 21 2006 - ccoffing@novell.com +* Tue Feb 21 2006 ccoffing@novell.com - Update to hg 8910 (xen-unstable tree). fixes 32 on 32, 32 pae on 32pae, 64 on 64, 32 on 64. critical HVM fixes, for fully virtualized guests. -* Fri Feb 17 2006 - ccoffing@novell.com +* Fri Feb 17 2006 ccoffing@novell.com - Update to hg 8870 (xen-unstable tree). More HVM fixes. - Remove duplicate balloon.free call. - Add patch from Intel to fix dom0 crash on 64 bit SMP HVM. -* Thu Feb 16 2006 - carnold@novell.com +* Thu Feb 16 2006 carnold@novell.com - Update to hg 8858 (xen-unstable tree). -* Wed Feb 15 2006 - ccoffing@novell.com +* Wed Feb 15 2006 ccoffing@novell.com - Update to hg 8857 (xen-unstable tree). Syncs hypervisor core with Linux 2.6.16, which may fix some ACPI issues. Fixes HVM. - Fix uninitialized variable in xc_load_bin (from Bruce Rogers). - Auto-balloon dom0 for fully virtualized domains (#149179). - xen-doc-html was missing image files. -* Mon Feb 13 2006 - ccoffing@novell.com +* Mon Feb 13 2006 ccoffing@novell.com - Update to hg 8830 (xen-unstable tree). - Restore cs 8783/8792 to match kernel. -* Wed Feb 08 2006 - ccoffing@novell.com +* Wed Feb 08 2006 ccoffing@novell.com - Update to hg 8800 (xen-unstable tree). - Update BuildRequires. - Add "max-free-memory" to "xm info", to support yast2-vm (#147612) @@ -1959,9 +1935,9 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Revert cs 8783/8792 to allow xenstore to start (until kernel catches up). - Ensure eth0 aka veth0 really comes up in network-bridge. -* Sat Feb 04 2006 - mls@suse.de +* Sat Feb 04 2006 mls@suse.de - converted neededforbuild to BuildRequires -* Fri Jan 27 2006 - ccoffing@novell.com +* Fri Jan 27 2006 ccoffing@novell.com - Update to hg 8728 (xen-unstable tree). - Improve network-bridge: + Ensure netdev really is up, to fix STARTMODE="manual". @@ -1973,235 +1949,235 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - Revamp mk-xen-rescue-img.sh (#118566). - Revamp rcxendomains: improved output, error checking, return values (#143754, #105677). -* Tue Jan 24 2006 - ccoffing@novell.com +* Tue Jan 24 2006 ccoffing@novell.com - Update to hg 8659 (xen-unstable tree). -* Mon Jan 23 2006 - ccoffing@novell.com +* Mon Jan 23 2006 ccoffing@novell.com - Correct return values and improve messages of init scripts. -* Fri Jan 20 2006 - ccoffing@novell.com +* Fri Jan 20 2006 ccoffing@novell.com - Use domUloader instead of pygrub. -* Thu Jan 19 2006 - carnold@novell.com +* Thu Jan 19 2006 carnold@novell.com - Build based on the xen-unstable.hg 8628 -* Wed Jan 18 2006 - carnold@novell.com +* Wed Jan 18 2006 carnold@novell.com - Update to hg 8646 xen-unstable-hvm.hg tree. -* Fri Jan 13 2006 - ccoffing@novell.com +* Fri Jan 13 2006 ccoffing@novell.com - Allow version string "XEN_VER=3.0" instead of just "XEN_VER=xen-3.0" for backwards compatibility. - Correctly set changeset in compile.h. -* Thu Jan 12 2006 - carnold@novell.com +* Thu Jan 12 2006 carnold@novell.com - Added two patches from AMD that apply to the 8513 changeset. -* Thu Jan 12 2006 - kukuk@suse.de +* Thu Jan 12 2006 kukuk@suse.de - Add libreiserfs-devel to nfb. -* Wed Jan 11 2006 - carnold@novell.com +* Wed Jan 11 2006 carnold@novell.com - Update to hg 8513 xen-unstable-hvm.hg tree. -* Tue Jan 10 2006 - ccoffing@novell.com +* Tue Jan 10 2006 ccoffing@novell.com - Update to hg 8269 (xen-3.0-testing). - Support try-restart in init scripts. - Clean up installation of udev rules. -* Wed Dec 14 2005 - ccoffing@novell.com +* Wed Dec 14 2005 ccoffing@novell.com - Update to hg 8257 (xen-3.0-testing). - Update documentation. - Fix gcc 4.1 warnings. -* Wed Dec 07 2005 - ccoffing@novell.com +* Wed Dec 07 2005 ccoffing@novell.com - Update to hg 8241 (xen-3.0-testing). -* Mon Nov 28 2005 - ccoffing@novell.com +* Mon Nov 28 2005 ccoffing@novell.com - Update to hg 8073. - Rationalize command names (eg, setsize -> xentrace-setsize). - Fix gcc 4.1 warnings. -* Wed Nov 16 2005 - ccoffing@novell.com +* Wed Nov 16 2005 ccoffing@novell.com - Update to hg 7782. - Honor RPM_OPT_FLAGS better. - Include a few simple, obvious fixes from upstream. - Build xm-test package. - Update udev scripts. -* Mon Nov 14 2005 - ccoffing@novell.com +* Mon Nov 14 2005 ccoffing@novell.com - Includes upstream fixes to fix i586 save/restore. -* Thu Nov 10 2005 - ccoffing@novell.com +* Thu Nov 10 2005 ccoffing@novell.com - Include a few simple, obvious fixes: 7609, 7618, 7636, 7689, 7690, 7692, 7696 -* Thu Nov 03 2005 - ccoffing@novell.com +* Thu Nov 03 2005 ccoffing@novell.com - Update to hg 7608. - Fix warn_unused_result warnings. - Drop some patches (merged upstream) - Tidy README.SuSE. -* Tue Nov 01 2005 - ccoffing@novell.com +* Tue Nov 01 2005 ccoffing@novell.com - Update to hg 7583. -* Thu Oct 20 2005 - ccoffing@novell.com +* Thu Oct 20 2005 ccoffing@novell.com - Don't mention unwritten man pages. - Update xmexample* to match SUSE paths. - Update xs-include patch. -* Wed Oct 19 2005 - garloff@suse.de +* Wed Oct 19 2005 garloff@suse.de - Avoid race in watchdog functionality. - Improve network-bridge script. -* Tue Oct 18 2005 - garloff@suse.de +* Tue Oct 18 2005 garloff@suse.de - Ignore zombies in the xendomains shutdown procedure and have a configurable timeout for the commands. Make xendomains status report something useful. - Make xendomains script comaptible to non-SUSE distros. -* Mon Oct 17 2005 - garloff@suse.de +* Mon Oct 17 2005 garloff@suse.de - Update to hg 7398. -* Mon Oct 17 2005 - garloff@suse.de +* Mon Oct 17 2005 garloff@suse.de - Create useful xendomains init script and sysconfig file. -* Mon Oct 17 2005 - garloff@suse.de +* Mon Oct 17 2005 garloff@suse.de - Create symlinks also for -pae and -dbg hypervisor. - Build doxygen documentation. - Include block-nbd script and xen-nbd example config. - Include patchset info. -* Wed Oct 12 2005 - garloff@suse.de +* Wed Oct 12 2005 garloff@suse.de - Update docu. - Enable xen-dbg hypervisor for gdbserver domU debugging. -* Tue Oct 11 2005 - garloff@suse.de +* Tue Oct 11 2005 garloff@suse.de - Update docu. - Update to hg 7313. - Move libxenstore.so to xen-tools. -* Tue Oct 11 2005 - garloff@suse.de +* Tue Oct 11 2005 garloff@suse.de - Fix buglet in /sbin/xen-vbd. -* Mon Oct 10 2005 - garloff@suse.de +* Mon Oct 10 2005 garloff@suse.de - Downgrade to hg 7267. - Add troubleshooting section to README.SUSE. -* Mon Oct 10 2005 - garloff@suse.de +* Mon Oct 10 2005 garloff@suse.de - Fix typo in SrvDomain for mem-set operation. - Workaround: write directly to balloon in dom0 setMemoryTarget. - Kill xenconsoled and xenstored in rcxend stop. -* Sun Oct 09 2005 - garloff@suse.de +* Sun Oct 09 2005 garloff@suse.de - Update to hg 7278. - Provide udev rules to setup vifs and vbds in dom0 when domUs boot (kraxel). - Change default FS size for rescue images to 80MB. -* Sat Sep 10 2005 - garloff@suse.de +* Sat Sep 10 2005 garloff@suse.de - Update to hg 6715. - Fix network-bridge down. -* Thu Sep 08 2005 - garloff@suse.de +* Wed Sep 07 2005 garloff@suse.de - Build PAE version along non-PAE version of Hypervisor. -* Tue Sep 06 2005 - garloff@suse.de +* Tue Sep 06 2005 garloff@suse.de - Try to fix network bridge down issue. - Document netowrking and firewalling caveats in README.SUSE. - Enable PAE. -* Tue Sep 06 2005 - garloff@suse.de +* Tue Sep 06 2005 garloff@suse.de - Update to hg 6644. -* Sun Sep 04 2005 - garloff@suse.de +* Sun Sep 04 2005 garloff@suse.de - Update to hg 6610. - Rename default name of xen-br0 to xenbr0. - Fix pygrub installation. - Use libreiserfs to support pygrub on reiser. -* Mon Aug 29 2005 - ccoffing@novell.com +* Mon Aug 29 2005 ccoffing@novell.com - xen-bridge-net.diff: do not destroy domain 0's network setup when starting xend. -* Mon Aug 29 2005 - garloff@suse.de +* Mon Aug 29 2005 garloff@suse.de - Update to hg 6458. - Drop privileged port check -- we use Unix dom sockets anyway (#105178). - init.xend: Fix linebreaks in PID list. - Correctly assign insserv to xen-tools subpackage. -* Thu Aug 25 2005 - garloff@suse.de +* Thu Aug 25 2005 garloff@suse.de - Add dirs /var/run/xenstored and /var/lib/xenstored. -* Thu Aug 25 2005 - garloff@suse.de +* Thu Aug 25 2005 garloff@suse.de - Update to hg 6393. -* Mon Aug 22 2005 - garloff@suse.de +* Mon Aug 22 2005 garloff@suse.de - Update to hg 6315. - Include linux-public headers in xen-devel package. -* Sun Aug 21 2005 - garloff@suse.de +* Sun Aug 21 2005 garloff@suse.de - Update to hg 6305. -* Sun Aug 21 2005 - garloff@suse.de +* Sat Aug 20 2005 garloff@suse.de - Update to hg 6299. - Enable VNC support (depending on LibVNCServer). -* Sun Aug 21 2005 - garloff@suse.de +* Sat Aug 20 2005 garloff@suse.de - Split off xen-tools-ioemu for supporting unmodified guests. -* Sat Aug 20 2005 - garloff@suse.de +* Fri Aug 19 2005 garloff@suse.de - Enable pygrub (at the cost of depending on e2fsprogs-devel) - Enable VMX ioemu SDL support (at the cost of many dependencies) -* Fri Aug 19 2005 - garloff@suse.de +* Fri Aug 19 2005 garloff@suse.de - Update to mercurial changeset 6223. - Move /usr/libexec/xen/ to /usr/lib[64]/xen/bin/. - Split off -tools package. -* Mon Aug 15 2005 - garloff@suse.de +* Mon Aug 15 2005 garloff@suse.de - Create symlinks in %%post. - Update README.SUSE. - Mark /etc/xen/ as %%config(noreplace). - Fix x86-64 build (movl -> mov, lib vs. lib64 inst dirs). - Remove PYTHONOPTIMIZE. -* Tue Aug 02 2005 - ccoffing@novell.com +* Tue Aug 02 2005 ccoffing@novell.com - Fix warn_unused_result warnings -* Thu Jul 28 2005 - ccoffing@novell.com +* Thu Jul 28 2005 ccoffing@novell.com - Update to latest 3.0-unstable snapshot. -* Wed Jul 13 2005 - ccoffing@novell.com +* Wed Jul 13 2005 ccoffing@novell.com - Fixed bug in glibc24 patch that caused erroneous "out of memory" errors -* Fri Jun 24 2005 - ccoffing@novell.com +* Fri Jun 24 2005 ccoffing@novell.com - Fix gcc4 patch that caused a panic in Xen at boot. -* Fri Jun 24 2005 - ccoffing@novell.com +* Fri Jun 24 2005 ccoffing@novell.com - Fix xen-syms link. -* Fri Jun 17 2005 - ccoffing@novell.com +* Fri Jun 17 2005 ccoffing@novell.com - Fix version-check in NetWare loader (0x336ec577 -> 0x326ec578). -* Fri Jun 17 2005 - ccoffing@novell.com +* Fri Jun 17 2005 ccoffing@novell.com - Backport NetWare-friendly loader from Xen 3.0. -* Thu Jun 16 2005 - ccoffing@novell.com +* Thu Jun 16 2005 ccoffing@novell.com - Destroy domains that failed to be fully created. -* Fri Jun 10 2005 - garloff@suse.de +* Fri Jun 10 2005 garloff@suse.de - Update to latest 2.0-testing snapshot. - Use RPM version and release no as xen version. -* Wed Jun 08 2005 - garloff@suse.de +* Tue Jun 07 2005 garloff@suse.de - Update mk-xen-rescue-img.sh script: Handle SLES9 better. - Export PYTHONOPTIMIZE in xend start script. -* Tue Jun 07 2005 - garloff@suse.de +* Mon Jun 06 2005 garloff@suse.de - Merge _perform_err fixes. -* Mon May 23 2005 - ccoffing@novell.com +* Mon May 23 2005 ccoffing@novell.com - update to 2.0.6 -* Wed Apr 13 2005 - garloff@suse.de +* Wed Apr 13 2005 garloff@suse.de - More gcc4 and binutils related fixes. -* Wed Apr 13 2005 - garloff@suse.de +* Wed Apr 13 2005 garloff@suse.de - Build fixes for gcc4. -* Sun Apr 03 2005 - garloff@suse.de +* Sun Apr 03 2005 garloff@suse.de - Update xen: Various fixes (scheduling, memset, domain crash handling) and enhancements (bg page scrubbing). -* Thu Mar 24 2005 - garloff@suse.de +* Thu Mar 24 2005 garloff@suse.de - xen-bridge-net.diff: Make sure bridge netdev is up after adding addresses to it. -* Wed Mar 23 2005 - garloff@suse.de +* Wed Mar 23 2005 garloff@suse.de - xen-secure.diff: Check for privileged port before allowing certain control operations. - README.SUSE: Document this change. -* Wed Mar 23 2005 - garloff@suse.de +* Wed Mar 23 2005 garloff@suse.de - Require ports < 1024 to allow controlling VMs. -* Mon Mar 21 2005 - garloff@suse.de +* Mon Mar 21 2005 garloff@suse.de - Update xen. -* Wed Mar 16 2005 - garloff@suse.de +* Wed Mar 16 2005 garloff@suse.de - Update xen. - Add /var/lib/xen/xen-db/ subdirs. -* Sun Mar 13 2005 - garloff@suse.de +* Sun Mar 13 2005 garloff@suse.de - Update to post-2.0.5 - Make /usr/sbin/xm root:trusted 0750 - Drop some patches (merged upstream) -* Tue Mar 08 2005 - garloff@suse.de +* Tue Mar 08 2005 garloff@suse.de - Update README with security notes. - Update mk-xen-rescue-image.sh script allowing to specify the kernel version to be used. - Rather than busy-looping, exit console on a domain that has shutdown. -* Mon Mar 07 2005 - garloff@suse.de +* Mon Mar 07 2005 garloff@suse.de - Update xen to latest snapshot. - tgif not needed any more. -* Tue Mar 01 2005 - garloff@suse.de +* Tue Mar 01 2005 garloff@suse.de - Include serial-split from Charles Coffing. -* Tue Mar 01 2005 - garloff@suse.de +* Tue Mar 01 2005 garloff@suse.de - Update xen to latest snapshot. -* Mon Feb 21 2005 - garloff@suse.de +* Mon Feb 21 2005 garloff@suse.de - Update README.SuSE. - Update xen to latest snapshot. -* Sun Feb 13 2005 - garloff@suse.de +* Sun Feb 13 2005 garloff@suse.de - Add init header to xendomains init script. - Add bridge-utils dependency. - Update config file and README. - Activate xend init script on installation. -* Thu Feb 10 2005 - ro@suse.de +* Wed Feb 09 2005 ro@suse.de - remove te_etex and te_pdf from neededforbuild. -* Thu Feb 10 2005 - garloff@suse.de +* Wed Feb 09 2005 garloff@suse.de - Update README about IDE dma. - Default to dhcp. -* Wed Feb 09 2005 - garloff@suse.de +* Wed Feb 09 2005 garloff@suse.de - Update to xen post-2.0.4. - Little bugfix for xen rescue install script. - Update README.SUSE: Better explanation of root FS creation. -* Mon Jan 24 2005 - garloff@suse.de +* Sun Jan 23 2005 garloff@suse.de - Change some defaults to be more secure (xend only binds to localhost, ip spoof protection on). - Avoid ipv6 issue with xend network script. @@ -2209,10 +2185,10 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info - mk-xen-rescue-img.sh creates a xen root fs image from the std SUSE rescue image. - Put boot.local script in root img to parse ip boot par. -* Thu Jan 20 2005 - garloff@suse.de +* Thu Jan 20 2005 garloff@suse.de - Update to newer snapshot. -* Thu Jan 20 2005 - garloff@suse.de +* Wed Jan 19 2005 garloff@suse.de - Update to xen-2.0-unstable (post 2.0.3). -* Thu Dec 09 2004 - garloff@suse.de +* Thu Dec 09 2004 garloff@suse.de - Initial creation of package xen, xen-doc-*. - i686 only for now. diff --git a/xenapi-console-protocol.patch b/xenapi-console-protocol.patch index 6948d8c..5cafa0f 100644 --- a/xenapi-console-protocol.patch +++ b/xenapi-console-protocol.patch @@ -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" diff --git a/xend-config.diff b/xend-config.diff index ebce0e7..d32c200 100644 --- a/xend-config.diff +++ b/xend-config.diff @@ -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. diff --git a/xend-core-dump-loc.diff b/xend-core-dump-loc.diff new file mode 100644 index 0000000..b735be3 --- /dev/null +++ b/xend-core-dump-loc.diff @@ -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): diff --git a/xend-network b/xend-network new file mode 100644 index 0000000..881cba7 --- /dev/null +++ b/xend-network @@ -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 :bridged|nat|hostonly|routed|nohost|empty" + echo " -i :Virtual network interface - vethX" + echo " (for nat, hostonly and routed bridges only)" + echo " -I :Physical network interface - ethX" + echo " (for bridged and nohost bridges only)" + echo " -m :MAC address" + echo " (for nat, hostonly and routed bridges only)" + echo " -a :IP address" + echo " (for nat, hostonly and routed bridges only)" + echo " -n :Bridge number (optional)" + echo " -N :Bridge name (optional)" + echo " -M :New Bridge name (used with rename option only)" + echo " -e :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 diff --git a/xmclone.sh b/xmclone.sh index 3124f75..8d6a597 100644 --- a/xmclone.sh +++ b/xmclone.sh @@ -1,14 +1,29 @@ -#!/bin/bash -################################################################################ -# xmclone by Bob Brandt # -# based on XenClone by Glen Davis # -# Clone a SLES10 domU # -################################################################################ +#! /bin/bash -################################################################################ -# Defaults # -# # -VERSION=0.3.1 +# Script to clone Xen Dom-Us. +# Based on XenClone by Glen Davis; rewritten by Bob Brandt. +# Further extended and restructured by Manfred Hollstein. +# Copyright (C) 2007 Manfred Hollstein, SUSE / Novell Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +# USA. + +# +# Defaults +# +VERSION=0.4.3 XEN_CONFIGS=/etc/xen/vm/ XEN_BASE=/var/lib/xen/images/ SOURCE= @@ -17,262 +32,407 @@ DUPLICATE=0 HOSTNAME= IP= MAC= -################################################################################ +PART=2 +DOMU_IS_FILE_BASED= +DOMU_ROOTDEV= +FORCE=no -################################################################################ -# Subroutines used in this script # -# # -# Display the usage information for this script # -usage() +# +# Subroutines used in this script +# + +# Display the usage information for this script +function usage () { - echo -e "\nUsage: ${0##*/} [-h|?|--help] [-v|--version] [-c dir] [-b dir] [-d]" - echo -e " [-n hostname] [-i address] [-m address]" - echo -e " SourcedomU NewdomU\n" - echo -e "Clones a domU, and gives a new Host name, MAC address and possibly IP address." - echo -e "Once finished the new domU should boot without any additional configuration." - echo -e "Currently works with single NIC, and basic bridge setup. Tested with cloning" - echo -e "a SLES10 install created from the SLES10 YaST Xen module.\n" - echo -e " -h, -?, --help Display this help message." - echo -e " -v, --version Display the version of this program." - echo -e " -c XEN configuration directory which defaults to:" - echo -e " $XEN_CONFIGS" - echo -e " -b XEN image base directory which defaults to:" - echo -e " $XEN_BASE" - echo -e " -d Only Duplicate, do not modify attributes." - echo -e " -n Hostname to be used, if not specified the NewdomU name" - echo -e " will be used." - echo -e " -i IP address to be used, if not specified the IP address" - echo -e " will not be changed." - echo -e " -m MAC address to be used, if not specified a psuedo-random" - echo -e " address will be used based on the ip address with the" - echo -e " format: 00:16:AA:BB:CC:DD" - echo -e " Where AA,BB,CC,DD are the Hex octals of the IP address." - echo -e "From XENSource Networking WIKI (http://wiki.xensource.com/xenwiki/XenNetworking)" - echo -e "Virtualised network interfaces in domains are given Ethernet MAC addresses. When" - echo -e "choosing MAC addresses to use, ensure you choose a unicast address. That is, one" - echo -e "with the low bit of the first octet set to zero. For example, an address" - echo -e "starting aa: is OK but ab: is not." - echo -e 'It is best to keep to the range of addresses declared to be "locally assigned"' - echo -e "(rather than allocated globally to hardware vendors). These have the second" - echo -e "lowest bit set to one in the first octet. For example, aa: is OK, a8: isn't.\n" - echo -e "Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble.\n" + cat << EOF +Usage: ${0##*/} [-h|--help] [-v|--version] [--force] [-c dir] [-b dir] [-d] + [-n hostname] [-i address] [-m address] + [-p number-of-root-partition-within-domU] + [-t target-device] + SourcedomU NewdomU + +Clones a domU, and gives a new Host name, MAC address and possibly IP address. +Once finished the new domU should boot without any additional configuration. +Currently works with single NIC, and basic bridge setup. Tested with cloning +a SLES10 install created from the SLES10 YaST Xen module. + + -h, --help Display this help message. + -v, --version Display the version of this program. + --force Silently overwrite files when destination already exists. + -c Xen configuration directory which defaults to: + $XEN_CONFIGS + -b Xen image base directory which defaults to: + $XEN_BASE + -d Duplicate only, do not modify attributes. + -n Hostname to be used, if not specified the NewdomU name + will be used. + -i IP address to be used, if not specified the IP address + will not be changed. + -m MAC address to be used, if not specified a psuedo-random + address will be used based on the ip address with the + format: 00:16:3e:BB:CC:DD + Where BB,CC,DD are the Hex octals of the IP address. + -p This script assumes that the second partition on any + writable disk of the domU to be cloned holds the root + file system in which attributes have to be changed. + If this is not the case for you, you can specify the + partition number using this flag. + -t If the SourcedomU uses a block device for its root/ + boot directory, you need to specify the new block + device for NewdomU. + +From XENSource Networking WIKI (http://wiki.xensource.com/xenwiki/XenNetworking) +Virtualised network interfaces in domains are given Ethernet MAC addresses. When +choosing MAC addresses to use, ensure you choose a unicast address. That is, one +with the low bit of the first octet set to zero. For example, an address +starting aa: is OK but ab: is not. +It is best to keep to the range of addresses declared to be "locally assigned" +(rather than allocated globally to hardware vendors). These have the second +lowest bit set to one in the first octet. For example, aa: is OK, a8: isn't. + +Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble. +EOF } -# Display the version information for this script # -version() + +# Display the version information for this script +function version () { - echo -e "${0##*/} (XEN vm clone utility) $VERSION" - echo -e "This is free software. You may redistribute copies of it under the terms of" - echo -e "the GNU General Public License ." - echo -e "There is NO WARRANTY, to the extent permitted by law.\n" - echo -e "Written by Bob Brandt, based on work by Glen Davis." + cat << EOF +${0##*/} (Xen VM clone utility) $VERSION +${0##*/} comes with ABSOLUTELY NO WARRANTY. +This is free software, and you are welcome to redistribute it under the terms +of the GNU General Public License . + +Written by Manfred Hollstein, based on work by Glen Davis and Bob Brandt. +EOF } -# Find/Replace text within a file # -replace() + +# Find/Replace text within a file +function replace () { - sed -i -e "s/$1/$2/g" "$3" + sed -i -e "s!$1!$2!g" "$3" +} + +# +# Find the first entry that names a writable image or device, assuming +# the Dom-U is going to boot from it: +# +function get_first_writable_image () +{ + local i + + for i in $@ + do + case $i in + # Match the first entry like "'phy:/dev/md0,xvda,w'," + *",w'," ) + # Strip off the leading "'" character: + i="${i#*\'}" + # Strip off the final trailing "'," + echo "${i%*\',}" + return + ;; + esac + done +} + +# +# Extract just the protocol and the file/device name part from a disk entry: +# +function extract_proto_and_filename () +{ + echo "$1" | cut -d, -f1 } -################################################################################ -################################################################################ -# Make sure the user is root # -# # -if [ `id -u` -ne 0 ]; then - echo -e "You must be root to run this script!\n" +# +# Make sure this script is run by the superuser root +# +if [ `id -u` -ne 0 ] +then + echo "You must be root to run this script!" >&2 exit 1 fi -################################################################################ -################################################################################ -# Process the parameters # -# # -# Must look for double -- arguments before getopts -if [ "$1" = "--version" ]; then +# +# Process the parameters +# +# Must look for double -- arguments before calling getopts +# +if [ "$1" = "--version" ] +then version exit 0 fi -if [ "$1" = "--help" ]; then +if [ "$1" = "--help" ] +then usage exit 0 fi -while getopts ":hvc:b:dn:i:m:" opt; do +if [ "$1" = "--force" ] +then + FORCE=yes + shift +fi +while getopts ":b:c:dhi:m:n:p:t:v" opt +do case $opt in - h | \? ) - usage - exit 0;; - v ) - version - exit 0;; - c ) XEN_CONFIGS=$OPTARG;; - b ) XEN_BASE=$OPTARG;; - d ) DUPLICATE=1;; - n ) HOSTNAME=$OPTARG;; - i ) IP=$OPTARG;; - m ) MAC=$OPTARG;; + b ) + XEN_BASE=$OPTARG + ;; + c ) + XEN_CONFIGS=$OPTARG + ;; + d ) + DUPLICATE=1 + ;; + h ) + usage + exit 1 + ;; + i ) + IP=$OPTARG + ;; + m ) + MAC=$OPTARG + ;; + n ) + HOSTNAME=$OPTARG + ;; + p ) + PART=$OPTARG + ;; + t ) + DOMU_ROOTDEV=$OPTARG + ;; + v ) + version + exit 0 + ;; esac done shift $(($OPTIND-1)) +if [ $# -ne 2 ] +then + echo "Illegal number of arguments passed!" >&2 + echo "" >&2 + usage + exit 1 +fi + SOURCE=$1 DESTINATION=$2 -################################################################################ -################################################################################ -# Verify the Source and Destination parameters # -# # -# The source and destination should be relative directory names without trailing /'s -# If the source does have a full path, use that path as the XEN_BASE -# Otherwise remove all but the last part of the path for both source and destination +# +# Verify the Source and Destination parameters +# +# The source and destination should be relative directory names without +# trailing /'s. If the source does have a full path, use that path as the +# value for XEN_BASE. Otherwise remove all but the last part of the path +# for both source and destination +# SOURCEDIR=${SOURCE%/*} SOURCEBASE=${SOURCE##*/} -if [ "$SOURCEDIR" != "$SOURCEBASE" ]; then +if [ "$SOURCEDIR" != "$SOURCEBASE" ] +then XEN_BASE=$SOURCEDIR"/" SOURCE=$SOURCEBASE fi SOURCE=${SOURCE##*/} DESTINATION=${DESTINATION##*/} -################################################################################ -################################################################################ -# Verify the XEN Config and Source parameters # -# # -# Directories should have a / after them # -if [ "$XEN_CONFIGS" != "" ]; then - XEN_CONFIGS="${XEN_CONFIGS%/}/" -fi -if [ "$XEN_BASE" != "" ]; then - XEN_BASE="${XEN_BASE%/}/" -fi -# Verify the validity of each argument ask the user if there is a problem -while [ ! -d "$XEN_CONFIGS" ]; do - echo -e "\nThe $XEN_CONFIGS directory does not exist. Please enter a valid directory." - read -p "XEN Configuration Directory? " XEN_CONFIGS +# +# Verify the Xen Config and Source parameters +# +# Verify the validity of each argument, ask the user if there is a problem +while [ ! -d "$XEN_CONFIGS" ] +do + cat << EOF >&2 +$XEN_CONFIGS either does not exist or is not a directory. +Please enter a valid directory. +EOF + read -e -p "Xen Configuration Directory? " XEN_CONFIGS done -while [ ! -d "$XEN_BASE" ]; do - echo -e "\nThe $XEN_BASE directory does not exist. Please enter a valid directory." - read -p "XEN Image Base Directory? " XEN_BASE +while [ ! -d "$XEN_BASE" ] +do + cat << EOF >&2 +$XEN_BASE either does not exist or is not a directory. +Please enter a valid directory. +EOF + read -e -p "Xen Image Base Directory? " XEN_BASE done -################################################################################ + +# +# Directories should have a / after them +# +[ "$XEN_CONFIGS" != "" ] && XEN_CONFIGS="${XEN_CONFIGS%/}/" +[ "$XEN_BASE" != "" ] && XEN_BASE="${XEN_BASE%/}/" -################################################################################ -# Verify that actual image and configuration file exist # -# # -while [ ! -d "$XEN_BASE$SOURCE" ] || [ ! -f "$XEN_CONFIGS$SOURCE" ]; do - if [ ! -d "$XEN_BASE$SOURCE" ]; then - echo -e "The directory $XEN_BASE$SOURCE is invalid, please select another." +# +# Verify that actual image and configuration file exist +# +while : +do + if [ ! -f "$XEN_CONFIGS$SOURCE" ] + then + echo "The $XEN_CONFIGS$SOURCE file does not exist." >&2 + echo "Please select a valid file." >&2 FILES= - tmpFILES=`ls $XEN_BASE` - - for FILE in $tmpFILES; do - # If the Entry is a Directory - if [ -d "$XEN_BASE$FILE" ]; then - # And if that Directory is not empty - if [ "`ls $XEN_BASE$FILE`" != "" ]; then - FILES="$FILES $XEN_BASE$FILE" - fi - fi + for FILE in `ls $XEN_CONFIGS` + do + # If the entry is a file + [ -f "$XEN_CONFIGS$FILE" ] && + FILES="$FILES $XEN_CONFIGS$FILE" done - if [ "$FILES" = "" ]; then - echo -e "There are no directories beneath $XEN_BASE" + if [ -z "$FILES" ] + then + echo "There are no suitable files beneath $XEN_CONFIGS" >&2 exit 1 - else - echo -e "Directories beneath $XEN_BASE" - select FILE in $FILES; do - if [ "$FILE" ]; then + fi + echo "Files beneath $XEN_CONFIGS" + select FILE in $FILES + do + if [ -f "$FILE" ] + then + SOURCE=${FILE##*/} + break + fi + echo "Invalid Selection." >&2 + done + else + # + # Figure out what type of image we're using: + # + BOOTENTRY=$(get_first_writable_image $(sed -n -e 's,^disk[ ]*=[ ]*\[\(.*\)\],\1,p' "$XEN_CONFIGS$SOURCE")) + case "$BOOTENTRY" in + phy:* ) + DOMU_IS_FILE_BASED=no + ;; + file:* | \ + tap:aio:* ) + DOMU_IS_FILE_BASED=yes + ;; + * ) + echo "Don't know how to deal with the boot protocol/device you appear to be using: $BOOTENTRY" >&2 + echo "These are the ones this script supports: \"phy:*\", \"file:*\", \"tap:aio:*\"" >&2 + exit 1 + ;; + esac + fi + + + if [ ${DOMU_IS_FILE_BASED} = yes ] + then + if [ ! -d "$XEN_BASE$SOURCE" ] + then + echo "The directory $XEN_BASE$SOURCE is invalid." >&2 + echo "Please select another one." >&2 + FILES= + for FILE in `ls $XEN_BASE` + do + # If the entry is a directory and + # it is not empty + [ -d "$XEN_BASE$FILE" ] && + [ "`ls $XEN_BASE$FILE`" != "" ] && + FILES="$FILES $XEN_BASE$FILE" + done + if [ -z "$FILES" ] + then + echo "There are no suitable directories beneath $XEN_BASE" >&2 + exit 1 + fi + echo "Directories beneath $XEN_BASE" + select FILE in $FILES + do + if [ -d "$FILE" ] + then SOURCE=${FILE##*/} break - else - echo -e "Invalid Selection." fi + echo "Invalid Selection." >&2 done + continue fi - fi + break - if [ ! -f "$XEN_CONFIGS$SOURCE" ]; then - echo -e "\nThe $XEN_CONFIGS$SOURCE file does not exist. Please select a valid file." - FILES= - tmpFILES=`ls $XEN_CONFIGS` - - for FILE in $tmpFILES; do - # If the Entry is a File - if [ -f "$XEN_CONFIGS$FILE" ]; then - FILES="$FILES $XEN_CONFIGS$FILE" - fi + else # DomU is using some block device + while [ ! -b "${DOMU_ROOTDEV}" ] || [ ! -w "${DOMU_ROOTDEV}" ] + do + read -e -p "You need to specify a valid block device for the new target DomU: " DOMU_ROOTDEV done - if [ "$FILES" = "" ]; then - echo -e "There are no files beneath $XEN_CONFIGS" - exit 1 - else - echo -e "Files beneath $XEN_CONFIGS" - select FILE in $FILES; do - if [ "$FILE" ]; then - SOURCE=${FILE##*/} - break - else - echo -e "Invalid Selection." - fi - done + break + + fi +done +BOOTIMAGE="$(echo $BOOTENTRY | awk -F : '{ print $NF }' | sed -e 's:,[^,]*,[^,]*$::')" + + +# +# Verify that the destination location does not already have an image or +# config file +# +while [ -z "$DESTINATION" ] +do + echo "You have not specified a Destination." >&2 + read -e -p "New Destination? " DESTINATION +done +while : +do + if [ -f "$XEN_CONFIGS$DESTINATION" ] && [ $FORCE = no ] + then + echo "The target configuration file $XEN_CONFIGS$DESTINATION already exists!" >&2 + read -e -p "Please select a new Destination? " DESTINATION + fi + if [ ${DOMU_IS_FILE_BASED} = yes ] + then + if [ -d "$XEN_BASE$DESTINATION" ] && [ $FORCE = no ] + then + echo "The target image location $XEN_BASE$DESTINATION already exists!" >&2 + read -p "Please select a new Destination? " DESTINATION + continue fi fi -done -################################################################################ - - -################################################################################ -# That the destination location does not already have a image or config file # -# # -while [ "$DESTINATION" == "" ]; do - echo -e "\nYou have not specified a Destination." - read -p "New Destination? " DESTINATION + break done -while [ -d "$XEN_BASE$DESTINATION" ] || [ -f "$XEN_CONFIGS$DESTINATION" ]; do - if [ -d "$XEN_BASE$DESTINATION" ]; then - echo -e "The image location $XEN_BASE$DESTINATION already exists!" - read -p "Please select a new Destination? " DESTINATION - fi - if [ -f "$XEN_CONFIGS$DESTINATION" ]; then - echo -e "The configuration file $XEN_CONFIGS$DESTINATION already exists!" - read -p "Please select a new Destination? " DESTINATION - fi -done -################################################################################ +# +# Verify the network parameters (if Duplicate Only was not selected) +# +if [ $DUPLICATE -eq 0 ] +then + if [ -z "$HOSTNAME" ] + then + echo "You have not entered a host name. If you wish to, enter one now." >&2 + read -p "New host name? (Default: $DESTINATION) " HOSTNAME + fi + [ -z "$HOSTNAME" ] && HOSTNAME=$DESTINATION -################################################################################ -# Verify the network parameters (if Duplicate Only was not selected) # -# # -if [ "$DUPLICATE" == "0" ]; then - if [ "$HOSTNAME" == "" ]; then - echo -e "\nYou have not entered a Host Name. If you wish to, enter one now." - read -p "New Host Name? (Default: $DESTINATION) " HOSTNAME - fi - if [ "$HOSTNAME" == "" ]; then - HOSTNAME=$DESTINATION - fi - - if [ "$IP" == "" ]; then - echo -e "\nYou have not specified an IP Address. If you wish to change the IP address, enter one now." + if [ -z "$IP" ] + then + echo "You have not specified an IP Address. If you wish to change the IP address, enter one now." read -p "New IP Address? " IP fi - while [ "$IP" != "" ] && [ "${IP/*.*.*.*/ok}" != "ok" ]; do - echo -e "\nThe IP Address you specified is invalid. If you wish, enter a new one now." + while [ -n "$IP" ] && [ "${IP/*.*.*.*/ok}" != "ok" ] + do + echo "The IP Address you specified is invalid. If you wish, enter a new one now." read -p "New IP Address? " IP - if [ "$IP" == "" ]; then - break - fi + [ -z "$IP" ] && break done - if [ "$MAC" == "" ]; then + if [ -z "$MAC" ] + then newMAC="" newMACtext="(format 01:23:45:67:89:AB)" # If the IP Address is specified and the MAC isn't, generate one. - if [ "$IP" != "" ]; then + if [ -n "$IP" ] + then octal1=${IP%%.*} IP=${IP#*.} octal2=${IP%%.*} @@ -280,290 +440,269 @@ if [ "$DUPLICATE" == "0" ]; then octal3=${IP%%.*} octal4=${IP#*.} IP="$octal1.$octal2.$octal3.$octal4" - octal1="00"`echo $octal1 16 o p | dc` - octal2="00"`echo $octal2 16 o p | dc` - octal3="00"`echo $octal3 16 o p | dc` - octal4="00"`echo $octal4 16 o p | dc` - newMAC="00:16:"${octal1:(-2)}":"${octal2:(-2)}":"${octal3:(-2)}":"${octal4:(-2)} + octal1="00"`echo $octal1 16 o p | dc | tr '[:upper:]' '[:lower:]'` + octal2="00"`echo $octal2 16 o p | dc | tr '[:upper:]' '[:lower:]'` + octal3="00"`echo $octal3 16 o p | dc | tr '[:upper:]' '[:lower:]'` + octal4="00"`echo $octal4 16 o p | dc | tr '[:upper:]' '[:lower:]'` + newMAC="00:16:3e:"${octal2:(-2)}":"${octal3:(-2)}":"${octal4:(-2)} newMACtext="(default $newMAC)" fi - echo -e "\nYou have not specified a MAC Address. If you wish to change the MAC address, enter one now." + echo "You have not specified a MAC Address. If you wish to change the MAC address, enter one now." read -p "New MAC Address? $newMACtext " MAC - if [ "$MAC" == "" ]; then - MAC=$newMAC - fi + [ -z "$MAC" ] && MAC=$newMAC fi - - while [ "$MAC" != "" ] && [ "${MAC/[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]/ok}" != "ok" ]; do - echo -e "\nThe MAC Address you specified is invalid. If you wish, enter a new one now." - read -p "New MAC Address? (format 01:23:45:67:89:AB) " MAC - if [ "$MAC" == "" ]; then - break - fi + + while [ "$MAC" != "" ] && [ "${MAC/[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]/ok}" != "ok" ] + do + echo "The MAC Address you specified is invalid. If you wish, enter a new one now." + read -p "New MAC Address? (format 01:23:45:67:89:AB) " MAC + [ -z "$MAC" ] && break done else HOSTNAME= IP= MAC= fi -################################################################################ -################################################################################ -# Make sure that the source VM is not running # -# # +# +# Make sure that the source VM is not running +# xmid=`xm domid "$SOURCE" 2>/dev/null` -if [ $? -eq 0 ] && [ -n "$xmid" ] && [ -z "${xmid//[[:digit:]]/}" ] ; then - echo -e "domU $SOURCE is currently running on Xen, please shutdown before cloning." - echo -e "The command \"xm shutdown $xmid -w\" will shutdown the domU" +if [ $? -eq 0 ] && [ -n "$xmid" ] && [ -z "${xmid//[[:digit:]]/}" ] +then + echo "domU $SOURCE is currently running on Xen, please shutdown before cloning." >&2 + echo "The command \"xm shutdown $xmid -w\" will shutdown the domU" >&2 exit 1 fi -################################################################################ -################################################################################ -# Copy the XEN Config file # -# # +# +# Copy the Xen Config file +# SOURCECONFIG="$XEN_CONFIGS$SOURCE" DESTCONFIG="$XEN_CONFIGS$DESTINATION" -echo -e "Copying Configuration files" +echo "Copying Configuration files" if ! cp -fv "$SOURCECONFIG" "$DESTCONFIG" then - echo -e "The Config file $SOURCECONFIG was unable to be copied to $DESTCONFIG" + echo "The Config file $SOURCECONFIG could not be copied to $DESTCONFIG" >&2 exit 1 fi -################################################################################ -################################################################################ -# Edit newly copied configuration file # -# # -echo -e "Editing config file ($DESTCONFIG), correcting the new domU Name." +# +# Edit newly copied configuration file +# +echo "Editing config file ($DESTCONFIG), correcting the new domU Name." if ! replace "$SOURCE" "$DESTINATION" "$DESTCONFIG" then - echo -e "Unable to change the domU name in $DESTCONFIG from $SOURCE to $DESTINATION" + echo "Unable to change the domU name in $DESTCONFIG from $SOURCE to $DESTINATION" >&2 exit 1 fi -if [ "$DUPLICATE" == "0" ] && [ "$MAC" != "" ]; then +if [ $DUPLICATE -eq 0 ] +then + oldUUID=`grep "^uuid[ ]*=.*$" $DESTCONFIG` + if [ x"${oldUUID}" = x ] + then + echo 'uuid="'`uuidgen`'"' >> $DESTCONFIG + else + sed -i -e 's,^uuid[ ]*=.*$,uuid="'`uuidgen`'",' $DESTCONFIG + fi +fi + +if [ $DUPLICATE -eq 0 ] && [ -n "$MAC" ] +then # Get the vif line in the config file - oldMAC=`grep "vif = " $DESTCONFIG` + oldMAC=`grep "vif[ ]*=[ ]*" $DESTCONFIG` # extract everything between the square brackets oldMAC=${oldMAC#*[} oldMAC=${oldMAC%*]} - # using the single quotes as delimiters, get the second field (this script can only deal with one adapter!) + # using the single quotes as delimiters, get the second field + # (this script can only deal with one adapter!) oldMAC=`echo "$oldMAC" | cut -f2 -d\'` # remove the mac= from the beginning oldMAC=${oldMAC#mac=*} if ! replace "$oldMAC" "$MAC" "$DESTCONFIG" then - echo -e "Unable to change the MAC address in $DESTCONFIG from ($oldMAC) to ($MAC)" + echo "Unable to change the MAC address in $DESTCONFIG from ($oldMAC) to ($MAC)" >&2 exit 1 fi fi -################################################################################ -################################################################################ -# Create and Copy image directory # -# # -SOURCEXEN="$XEN_BASE$SOURCE/" -DESTXEN="$XEN_BASE$DESTINATION/" -echo -e "Creating the new image directory $DESTXEN" -if ! mkdir -pv --mode=775 "$DESTXEN" +# +# Create and Copy image directory +# + +if [ $DOMU_IS_FILE_BASED = yes ] then - echo -e "Unable to create the directory $DESTXEN" - exit 1 -fi -echo -e "Copying complete image. (This may take a few minutes!)" - -if ! cp -fv $SOURCEXEN* $DESTXEN -then - echo -e "Unable to copy the images from $SOURCEXEN to $DESTXEN" - exit 1 -fi -################################################################################ - - -# The rest of the document only applies if we are change the values within the image -if [ "$DUPLICATE" == "0" ] && [ "$MAC" != "" ]; then - ############################################################################ - # Mount the newly copied image file # - # # - # Find a temporary directory name - tmpdir="/mnt/xentmp" - declare -i a=0 - while [ -d "$tmpdir$a" ]; do - a=a+1 - done - tmpdir="$tmpdir$a" - if ! mkdir -pv "$tmpdir" + SOURCEXEN="$XEN_BASE$SOURCE/" + DESTXEN="$XEN_BASE$DESTINATION/" + echo "Creating the new image directory $DESTXEN" + if ! mkdir -pv --mode=755 "$DESTXEN" then - echo -e "Unable to create $tmpdir Directory." + echo "Unable to create the directory $DESTXEN" >&2 exit 1 fi - - # Get the vif line in the config file - DISKIMAGE=`grep "disk = " $DESTCONFIG` - # extract everything between the square brackets - DISKIMAGE=${DISKIMAGE#*[} - DISKIMAGE=${DISKIMAGE%*]} - # extract the first entry that is a file - DISKIMAGE=${DISKIMAGE#*file:*} - # remove the end of the entry - DISKIMAGE=${DISKIMAGE%,w*} - # using the comma as delimiter, get the second field (this script assumes that the first file entry is the boot disk!) - DISKIMAGE=`echo "$DISKIMAGE" | cut -f2 -d\,` - - # Get the vif line in the config file - PARTITION=`grep "bootentry = " $DESTCONFIG` - # using the single quotes as delimiters, extract the data - PARTITION=`echo "$PARTITION" | cut -f2 -d\'` - # using the comma as delimiter, extra the boot partition information - PARTITION=`echo "$PARTITION" | cut -f1 -d\,` - PARTITION=${PARTITION%:*} - PARTITION=${PARTITION#$DISKIMAGE*} - - if ! lomount -diskimage "$DESTXEN$DISKIMAGE" -partition $PARTITION "$tmpdir" + echo "Copying complete image. (This may take a few minutes!)" + + tar -C $SOURCEXEN -cSf - --exclude=lost+found `cd $SOURCEXEN; echo *` \ + | tar -C $DESTXEN -xvBSpf - + if [ $? -ne 0 ] then - echo -e "Unable to mount newly copied image $DESTXEN$DISKIMAGE at $tmpdir" + echo "Unable to copy the images from $SOURCEXEN to $DESTXEN" >&2 exit 1 fi - ############################################################################ - - - ############################################################################ - # Change the Network Configuration in the mounted image file # - # # - sleep 1 - pushd "$tmpdir" - if [ "$MAC" != "" ]; then - echo -e "Changing the Network configuration in the newly copied image." - cd "$tmpdir/etc/sysconfig/network/" - sleep 1 - # Make a backup of the old eth config files in ./othether directory - if mkdir -pv ./oldether/ +else # Deal with block devices + if [ $DUPLICATE -eq 0 ] + then + echo "Editing config file ($DESTCONFIG), correcting the new domU root device name." + if ! replace ":$BOOTIMAGE," ":$DOMU_ROOTDEV," "$DESTCONFIG" then - cp -fv ifcfg-eth* ./oldether/ - fi - - # Find the ifcfg-ethMACADDRESS file in the newly copied image - ETH0=`ls | grep ifcfg-eth | cut -f1` - if [ "$ETH0" = "" ]; then - echo -e "Unable to find ethernet file in image file" + echo "Unable to change the domU root device name in $DESTCONFIG from $BOOTIMAGE to $DOMU_ROOTDEV" >&2 exit 1 fi - # Rename the file to ifcfg-eth0 (if it has not already been done. - # Then delete all the other config files - if [ "$ETH0" != "ifcfg-eth0" ]; then - if mv -f "$ETH0" ifcfg-eth0 + fi + echo "Copying from source block device ($BOOTIMAGE) to the new target device ($DOMU_ROOTDEV)" + echo "(This may take a few minutes!)" + if ! dd if=$BOOTIMAGE of=$DOMU_ROOTDEV + then + echo "Failed to copy from $BOOTIMAGE to $DOMU_ROOTDEV" >&2 + exit 1 + fi +fi + + +# +# The rest of the script only applies if we are actually making changes within +# the image +# +if [ $DUPLICATE -eq 0 ] +then + # + # Create a temporary directory name + # + tmpdir=$(mktemp -d) + if [ $? -ne 0 ] + then + echo "Unable to create temporary directory $tmpdir." >&2 + exit 1 + fi + + if [ $DOMU_IS_FILE_BASED = yes ] + then + set -- $(echo $DESTXEN*) + else + set -- $(echo $DOMU_ROOTDEV) + fi + + for DISKIMAGE + do + # Silently ignore any directories (lost+found comes to mind): + [ -d $DISKIMAGE ] && continue + + # + # Mount the newly copied image file + # + echo -n "Trying to mount partition $PART of $DISKIMAGE ... " + lomount -diskimage "$DISKIMAGE" -partition $PART "$tmpdir" \ + || continue + echo "succeeded." + + pushd "$tmpdir" > /dev/null + + # + # Change the Network Configuration in the mounted image file + # + if [ -n "$MAC" ] + then + if [ -d etc/sysconfig/network/ ] then - rm -fv ifcfg-eth-id* + echo "Changing the Network configuration in the newly copied image." + pushd "etc/sysconfig/network/" > /dev/null + # Find the ifcfg-ethMACADDRESS file in the + # newly copied image + ETH0=`ls | grep ifcfg-eth | cut -f1` + if [ -z "$ETH0" ] + then + echo "Unable to find ethernet file in image file" 2>&1 + cd /tmp; umount "$tmpdir"; rmdir "$tmpdir" + exit 1 + fi + mv -f "$ETH0" ifcfg-eth-id-$MAC + popd > /dev/null + fi + + if [ -d etc/udev/rules.d/ ] + then + # The 30-net_persistent_names.rules file + # controls which interface to use. + # By removing the SUBSYSTEM== lines, we force + # the system to recreate it. + pushd "etc/udev/rules.d/" > /dev/null + sed -i -e "/SUBSYSTEM==/d" \ + 30-net_persistent_names.rules + popd > /dev/null fi fi - # Make sure that the ifcfg-eth0 file exists, since everything depends on it! - if [ ! -f "ifcfg-eth0" ]; then - echo -e "Unable to create /etc/sysconfig/network/ifcfg-eth0 file!" - exit 1 - fi - - # The 30-net_persistent_names.rules file controls which interface to use. - # Be removing the SUBSYSTEM line, we force the system to recreate it. - cd "$tmpdir/etc/udev/rules.d/" - cp -fv 30-net_persistent_names.rules 30-net_persistent_names.rules.old - grep -v SUBSYSTEM 30-net_persistent_names.rules > 30-net_persistent_names.rules.tmp - if ! mv -f 30-net_persistent_names.rules.tmp 30-net_persistent_names.rules + # + # Change the IP Address in the mounted image file + # + if [ -n "$IP" ] then - echo -e "Unable to modify the /etc/udev/rules.d/30-net_persistent_names.rules file." - exit 1 - fi - fi - ############################################################################ + if [ -d etc/sysconfig/network/ ] + then + echo "Modify the IP Address of the new domU." - - ############################################################################ - # Change the IP Address in the mounted image file # - # # - if [ "$IP" != "" ]; then - - echo -e "Modify the IP Address of the new domU." - cd "$tmpdir/etc/sysconfig/network/" - sleep 1 - - # Make sure that the ifcfg-eth0 file exists, since everything depends on it! - if [ ! -f "ifcfg-eth0" ]; then - echo -e "Unable to find /etc/sysconfig/network/ifcfg-eth0 file!" - exit 1 + pushd "etc/sysconfig/network/" > /dev/null + sed -i -e "s,^IPADDR=.*$,IPADDR=$IP," \ + ifcfg-eth-id-$MAC + popd > /dev/null + fi fi - # Make a copy every line of the ifcfg-eth0 file except the IPADDR line. - grep -v IPADDR ifcfg-eth0 > ifcfg-eth0.xentmp - sleep 1 - - # Then add a new IPADDR line with the new IP address - echo 'IPADDR="'$IP'"' >> ifcfg-eth0.xentmp - sleep 1 - - if ! mv ifcfg-eth0.xentmp ifcfg-eth0 + # + # Change the HOSTNAME and hosts files in the mounted image file + # + if [ -n "$HOSTNAME" ] then - echo -e "unable to modify the IP address in /etc/sysconfig/network/ifcfg-eth0" - exit 1 + if [ -d "etc/" ] + then + echo "Changing HOSTNAME file to $HOSTNAME." + + pushd "etc/" > /dev/null + # using the period as a delimiter, select the + # first entry for the hostname + oldHOSTNAME=`cut -f1 -d\. HOSTNAME` + if ! replace "$oldHOSTNAME" "$HOSTNAME" "HOSTNAME" + then + echo "Unable to change the HOSTNAME from $oldHOSTNAME to $HOSTNAME" >&2 + cd /tmp; umount "$tmpdir"; rmdir "$tmpdir" + exit 1 + fi + FQDN=`cat HOSTNAME` + + # Add entries for the new domU to /etc/hosts, + # if it doesn't already include them: + if ! egrep -q "[[:space:]]$FQDN[^[:alnum:]]" \ + hosts + then + echo "Changing hosts file." + echo -e "$IP\t$FQDN $HOSTNAME" >> hosts + fi + popd > /dev/null + fi fi - fi - ############################################################################ + popd > /dev/null + umount "$tmpdir" + done - - ############################################################################ - # Change the HOSTNAME and hosts files in the mounted image file # - # # - if [ "$HOSTNAME" != "" ]; then - echo -e "Changing HOSTNAME file to $HOSTNAME." - cd "$tmpdir/etc" - # using the period as a delimter, select the first column for the hostname - oldHOSTNAME=`cat "$tmpdir/etc/HOSTNAME" | cut -f1 -d\.` - sleep 1 - - if ! replace "$oldHOSTNAME" "$HOSTNAME" "HOSTNAME" - then - echo -e "Unable to change the HOSTNAME from $oldHOSTNAME to $HOSTNAME" - exit 1 - fi - FQDN=`cat HOSTNAME` - - echo -e "Changing hosts file." - - cp -fv hosts hosts.old - if grep -v $oldHOSTNAME hosts > hosts.xentmp - then - echo "$IP\t$FQDN\t$HOSTNAME" >> hosts.xentmp - fi - - if [ ! -f hosts.xentmp ]; then - echo -e "Unable to change the hosts file" - exit 1 - fi - if ! mv -f hosts.xentmp hosts - then - echo -e "Unable to change the hosts file" - exit 1 - fi - fi - ############################################################################ - - - ############################################################################ - # Umount image file and remove temporary directory # - # # - popd > /dev/null - sleep 1 - umount "$tmpdir" - sleep 1 - rm -r "$tmpdir" - ############################################################################ + rmdir "$tmpdir" fi -echo -e "Clone is complete. domU $DESTCONFIG is ready to start!" +echo "Clone is complete. domU $DESTCONFIG is ready to start!" exit 0