diff --git a/16740-suse-ifup.patch b/16740-suse-ifup.patch new file mode 100644 index 0000000..2c50418 --- /dev/null +++ b/16740-suse-ifup.patch @@ -0,0 +1,48 @@ +# HG changeset patch +# User Keir Fraser +# Date 1200582857 0 +# Node ID 68673ad57302abd57702652877457e84e2284416 +# Parent 33dcf04d77152fe7086ceb1e89218e1e703d862d +network scripts: SUSE has sensible use of ifup nowadays + +While wading through the patches made to Xen by OpenSUSE in their +[s]rpm, I found that they have removed various special casing for ifup +on ther distribution. + +Signed-off-by: Ian Jackson + +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 +@@ -16,11 +16,6 @@ + # + + +-# On SuSE it is necessary to run a command before transfering addresses and +-# routes from the physical interface to the virtual. This command creates a +-# variable $HWD_CONFIG_0 that specifies the appropriate configuration for +-# ifup. +- + # Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives. + + # Other platforms just use ifup / ifdown directly. +@@ -32,17 +27,7 @@ + # that the virtual device will take once the physical device has + # been renamed. + +-if [ -e /etc/SuSE-release ] +-then +- preiftransfer() +- { +- eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- $1` +- } +- ifup() +- { +- /sbin/ifup ${HWD_CONFIG_0} $1 +- } +-elif ! which ifup >/dev/null 2>/dev/null ++if ! which ifup >/dev/null 2>/dev/null + then + preiftransfer() + { diff --git a/16873-net-nat.patch b/16873-net-nat.patch index d54fd42..37dd361 100644 --- a/16873-net-nat.patch +++ b/16873-net-nat.patch @@ -6,10 +6,10 @@ network-nat: Fix NAT scripts. Signed-off-by: Dan Magenheimer -Index: xen-3.2-testing/tools/examples/network-nat +Index: xen-3.2.1-testing/tools/examples/network-nat =================================================================== ---- xen-3.2-testing.orig/tools/examples/network-nat -+++ xen-3.2-testing/tools/examples/network-nat +--- xen-3.2.1-testing.orig/tools/examples/network-nat ++++ xen-3.2.1-testing/tools/examples/network-nat @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x @@ -33,10 +33,10 @@ Index: xen-3.2-testing/tools/examples/network-nat if [ "$dhcp" != 'no' ] then -Index: xen-3.2-testing/tools/examples/vif-nat +Index: xen-3.2.1-testing/tools/examples/vif-nat =================================================================== ---- xen-3.2-testing.orig/tools/examples/vif-nat -+++ xen-3.2-testing/tools/examples/vif-nat +--- xen-3.2.1-testing.orig/tools/examples/vif-nat ++++ xen-3.2.1-testing/tools/examples/vif-nat @@ -28,15 +28,22 @@ dir=$(dirname "$0") . "$dir/vif-common.sh" @@ -111,11 +111,11 @@ Index: xen-3.2-testing/tools/examples/vif-nat release_lock "vif-nat-dhcp" "$dhcpd_init_file" restart || true } -Index: xen-3.2-testing/tools/examples/xen-network-common.sh +Index: xen-3.2.1-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() +--- xen-3.2.1-testing.orig/tools/examples/xen-network-common.sh ++++ xen-3.2.1-testing/tools/examples/xen-network-common.sh +@@ -74,6 +74,11 @@ find_dhcpd_init_file() first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd} } diff --git a/16883-xend-crashed-state.patch b/16883-xend-crashed-state.patch index 3f28e9b..ef63ef1 100644 --- a/16883-xend-crashed-state.patch +++ b/16883-xend-crashed-state.patch @@ -197,7 +197,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py return self.getDeviceController(deviceClass).sxprs() else: sxprs = [] -@@ -2258,6 +2258,9 @@ class XendDomainInfo: +@@ -2257,6 +2257,9 @@ class XendDomainInfo: return XEN_API_VM_POWER_STATE_SUSPENDED else: return XEN_API_VM_POWER_STATE_HALTED diff --git a/16989-xend-coredump.patch b/16989-xend-coredump.patch index 2b8b0c9..2e0ab60 100644 --- a/16989-xend-coredump.patch +++ b/16989-xend-coredump.patch @@ -205,7 +205,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py action_conf = { 'poweroff': 'actions_after_shutdown', -@@ -2559,9 +2567,10 @@ class XendDomainInfo: +@@ -2558,9 +2566,10 @@ class XendDomainInfo: def get_on_crash(self): after_crash = self.info.get('actions_after_crash') diff --git a/17006-make-aio-optional.patch b/17006-make-aio-optional.patch new file mode 100644 index 0000000..ca5472f --- /dev/null +++ b/17006-make-aio-optional.patch @@ -0,0 +1,64 @@ +# HG changeset patch +# User Keir Fraser +# Date 1202724185 0 +# Node ID dbb60ed6bc22ea17d34d18ae4a769b917acd5ef4 +# Parent 54bd38dab5ef5713623cd5b83721820a1fd61a06 +ioemu: make AIO optional (already done upstream) +Signed-off-by: Samuel Thibault + +Index: xen-3.2.1-testing/tools/ioemu/block-raw.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block-raw.c ++++ xen-3.2.1-testing/tools/ioemu/block-raw.c +@@ -25,7 +25,9 @@ + #include "block_int.h" + #include + #ifndef _WIN32 ++#ifndef NO_AIO + #include ++#endif + + #ifndef QEMU_TOOL + #include "exec-all.h" +@@ -268,6 +270,7 @@ label__raw_write__success: + /***********************************************************/ + /* Unix AIO using POSIX AIO */ + ++#ifndef NO_AIO + typedef struct RawAIOCB { + BlockDriverAIOCB common; + struct aiocb aiocb; +@@ -493,6 +496,7 @@ static void raw_aio_cancel(BlockDriverAI + pacb = &acb->next; + } + } ++#endif + + static void raw_close(BlockDriverState *bs) + { +@@ -613,10 +617,12 @@ BlockDriver bdrv_raw = { + raw_create, + raw_flush, + ++#ifndef NO_AIO + .bdrv_aio_read = raw_aio_read, + .bdrv_aio_write = raw_aio_write, + .bdrv_aio_cancel = raw_aio_cancel, + .aiocb_size = sizeof(RawAIOCB), ++#endif + .protocol_name = "file", + .bdrv_pread = raw_pread, + .bdrv_pwrite = raw_pwrite, +@@ -949,10 +955,12 @@ BlockDriver bdrv_host_device = { + NULL, + raw_flush, + ++#ifndef NO_AIO + .bdrv_aio_read = raw_aio_read, + .bdrv_aio_write = raw_aio_write, + .bdrv_aio_cancel = raw_aio_cancel, + .aiocb_size = sizeof(RawAIOCB), ++#endif + .bdrv_pread = raw_pread, + .bdrv_pwrite = raw_pwrite, + .bdrv_getlength = raw_getlength, diff --git a/17131-numa-set-vcpu-affinity.patch b/17131-numa-set-vcpu-affinity.patch index 41786f5..6bc2139 100644 --- a/17131-numa-set-vcpu-affinity.patch +++ b/17131-numa-set-vcpu-affinity.patch @@ -10,7 +10,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1754,6 +1754,39 @@ class XendDomainInfo: +@@ -1753,6 +1753,39 @@ class XendDomainInfo: if self.info['cpus'] is not None and len(self.info['cpus']) > 0: for v in range(0, self.info['VCPUs_max']): xc.vcpu_setaffinity(self.domid, v, self.info['cpus']) diff --git a/17209-xentop.patch b/17209-xentop.patch new file mode 100644 index 0000000..cc986ed --- /dev/null +++ b/17209-xentop.patch @@ -0,0 +1,21 @@ +# HG changeset patch +# User Keir Fraser +# Date 1205838260 0 +# Node ID 2ed94b9b10b3770d7bfd7346f532b70e70be35c1 +# Parent 3ab6635f783d61e1f73ccf26074f80d8e9259a6d +Add periodic fflush to xentop batch mode. +From: Yusuke KANEKI +Signed-off-by: Keir Fraser + +Index: xen-3.2-testing/tools/xenstat/xentop/xentop.c +=================================================================== +--- xen-3.2-testing.orig/tools/xenstat/xentop/xentop.c ++++ xen-3.2-testing/tools/xenstat/xentop/xentop.c +@@ -1121,6 +1121,7 @@ int main(int argc, char **argv) + do { + gettimeofday(&curtime, NULL); + top(); ++ fflush(stdout); + oldtime = curtime; + if ((!loop) && !(--iterations)) + break; diff --git a/17246-numa-node-selection-fix.patch b/17246-numa-node-selection-fix.patch new file mode 100644 index 0000000..f62fb5e --- /dev/null +++ b/17246-numa-node-selection-fix.patch @@ -0,0 +1,84 @@ +# HG changeset patch +# User Keir Fraser +# Date 1205922017 0 +# Node ID 258c528c874f820a75abe932004433cbde0d3b3b +# Parent c69524c462ff8a8f7f44957d9012e28159b14d55 +xend: Fix and improve default NUMA node selection. + +Add the missing condition check and use average value instead of the +sum value of Vcpus pinning cpus on certain node to choose relaxed node. + +Signed-off-by: Duan Ronghui + +Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +=================================================================== +--- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py ++++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py +@@ -1754,36 +1754,44 @@ class XendDomainInfo: + for v in range(0, self.info['VCPUs_max']): + xc.vcpu_setaffinity(self.domid, v, self.info['cpus']) + else: ++ def find_relaxed_node(node_list): ++ import sys ++ if node_list is None: ++ node_list = range(0, info['nr_nodes']) ++ nodeload = [0] ++ nodeload = nodeload * info['nr_nodes'] ++ from xen.xend import XendDomain ++ doms = XendDomain.instance().list('all') ++ for dom in doms: ++ cpuinfo = dom.getVCPUInfo() ++ for vcpu in sxp.children(cpuinfo, 'vcpu'): ++ def vinfo(n, t): ++ return t(sxp.child_value(vcpu, n)) ++ cpumap = vinfo('cpumap', list) ++ for i in node_list: ++ node_cpumask = info['node_to_cpu'][i] ++ for j in node_cpumask: ++ if j in cpumap: ++ nodeload[i] += 1 ++ break ++ for i in node_list: ++ if len(info['node_to_cpu'][i]) > 0: ++ nodeload[i] = int(nodeload[i] / len(info['node_to_cpu'][i])) ++ else: ++ nodeload[i] = sys.maxint ++ index = nodeload.index( min(nodeload) ) ++ return index ++ + info = xc.physinfo() + if info['nr_nodes'] > 1: + node_memory_list = info['node_to_memory'] + needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024 + candidate_node_list = [] + for i in range(0, info['nr_nodes']): +- if node_memory_list[i] >= needmem: ++ if node_memory_list[i] >= needmem and len(info['node_to_cpu'][i]) > 0: + candidate_node_list.append(i) +- if candidate_node_list is None or len(candidate_node_list) == 1: +- index = node_memory_list.index( max(node_memory_list) ) +- cpumask = info['node_to_cpu'][index] +- else: +- nodeload = [0] +- nodeload = nodeload * info['nr_nodes'] +- from xen.xend import XendDomain +- doms = XendDomain.instance().list('all') +- for dom in doms: +- cpuinfo = dom.getVCPUInfo() +- for vcpu in sxp.children(cpuinfo, 'vcpu'): +- def vinfo(n, t): +- return t(sxp.child_value(vcpu, n)) +- cpumap = vinfo('cpumap', list) +- for i in candidate_node_list: +- node_cpumask = info['node_to_cpu'][i] +- for j in node_cpumask: +- if j in cpumap: +- nodeload[i] += 1 +- break +- index = nodeload.index( min(nodeload) ) +- cpumask = info['node_to_cpu'][index] ++ index = find_relaxed_node(candidate_node_list) ++ cpumask = info['node_to_cpu'][index] + for v in range(0, self.info['VCPUs_max']): + xc.vcpu_setaffinity(self.domid, v, cpumask) + diff --git a/17248-hvm-ignore-USB-RMRR.patch b/17248-hvm-ignore-USB-RMRR.patch new file mode 100644 index 0000000..3c07560 --- /dev/null +++ b/17248-hvm-ignore-USB-RMRR.patch @@ -0,0 +1,69 @@ +# HG changeset patch +# User Keir Fraser +# Date 1205922169 0 +# Node ID 70f9a2110421cc6f4ce066eb80d4c639a28643bd +# Parent b8e3dbca1677e3fffeb8bf8baedc895c90d4e619 +Intel VTD: Ignore USB RMRR for HVM guest + +USB controller RMRR (0xed000 - 0xeffff) conflicts with HVM guest bios +region. Setting identity mapping for it will cover the guest bios +region in p2m table. This causes system crash. + +As VT-d spec says, USB controller RMRR is used in case of DMA +performed by a USB controller under BIOS SMM control for legacy +keyboard emulation. Whereas, current guest BIOS doesn't support +emulating stardand Keyboard/mouse, and it also doesn't support SMM +mode. Actually it is no chance to use USB controller RMRR now. + +This patch ignores the USB controller RMRR for HVM guest. + +Signed-off-by: Weidong Han + +Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/dmar.h +=================================================================== +--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/dmar.h ++++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/dmar.h +@@ -95,5 +95,6 @@ struct acpi_ioapic_unit { + + int vtd_hw_check(void); + void disable_pmr(struct iommu *iommu); ++int is_usb_device(struct pci_dev *pdev); + + #endif // _DMAR_H_ +Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c +=================================================================== +--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c ++++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c +@@ -1868,6 +1868,12 @@ int assign_device(struct domain *d, u8 b + for_each_rmrr_device( rmrr, pdev ) + if ( pdev->bus == bus && pdev->devfn == devfn ) + { ++ /* FIXME: Because USB RMRR conflicts with guest bios region, ++ * ignore USB RMRR temporarily. ++ */ ++ if ( is_usb_device(pdev) ) ++ return 0; ++ + ret = iommu_prepare_rmrr_dev(d, rmrr, pdev); + if ( ret ) + { +Index: xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/utils.c +=================================================================== +--- xen-3.2-testing.orig/xen/arch/x86/hvm/vmx/vtd/utils.c ++++ xen-3.2-testing/xen/arch/x86/hvm/vmx/vtd/utils.c +@@ -38,6 +38,15 @@ + #define SEABURG 0x4000 + #define C_STEP 2 + ++int is_usb_device(struct pci_dev *pdev) ++{ ++ u8 bus = pdev->bus; ++ u8 dev = PCI_SLOT(pdev->devfn); ++ u8 func = PCI_FUNC(pdev->devfn); ++ u16 class = read_pci_config_16(bus, dev, func, PCI_CLASS_DEVICE); ++ return (class == 0xc03); ++} ++ + int vtd_hw_check(void) + { + u16 vendor, device; diff --git a/17315-windows-bug-check-0x101-fix.patch b/17315-windows-bug-check-0x101-fix.patch new file mode 100644 index 0000000..accda75 --- /dev/null +++ b/17315-windows-bug-check-0x101-fix.patch @@ -0,0 +1,302 @@ +# HG changeset patch +# User Keir Fraser +# Date 1206697850 0 +# Node ID 50efc4b3ffdb7996ab58a4cb6d4d48fed197454f +# Parent 7a3702ff0e8c2c9783de6e24edd79203d5e4c070 +ioemu: Perform emulated IDE flushes asynchronously. + +Fixes 'Windows Bug Check 0x101 issue' in which a VCPU gets tied up for +so long doing a synchronous flush to disc that it misses critical +timer events. + +Signed-off-by: Ian Jackson +Modified-by: Ian Jackson +Signed-off-by: Kouya Shimura + +Index: xen-3.2.1-testing/tools/ioemu/block-qcow.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block-qcow.c ++++ xen-3.2.1-testing/tools/ioemu/block-qcow.c +@@ -725,6 +725,13 @@ static void qcow_aio_cancel(BlockDriverA + qemu_aio_release(acb); + } + ++static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque) ++{ ++ BDRVQcowState *s = bs->opaque; ++ return bdrv_aio_flush(s->hd, cb, opaque); ++} ++ + static void qcow_close(BlockDriverState *bs) + { + BDRVQcowState *s = bs->opaque; +@@ -899,6 +906,7 @@ BlockDriver bdrv_qcow = { + .bdrv_aio_read = qcow_aio_read, + .bdrv_aio_write = qcow_aio_write, + .bdrv_aio_cancel = qcow_aio_cancel, ++ .bdrv_aio_flush = qcow_aio_flush, + .aiocb_size = sizeof(QCowAIOCB), + .bdrv_write_compressed = qcow_write_compressed, + .bdrv_get_info = qcow_get_info, +Index: xen-3.2.1-testing/tools/ioemu/block-qcow2.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block-qcow2.c ++++ xen-3.2.1-testing/tools/ioemu/block-qcow2.c +@@ -1007,6 +1007,13 @@ static void qcow_aio_cancel(BlockDriverA + qemu_aio_release(acb); + } + ++static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque) ++{ ++ BDRVQcowState *s = bs->opaque; ++ return bdrv_aio_flush(s->hd, cb, opaque); ++} ++ + static void qcow_close(BlockDriverState *bs) + { + BDRVQcowState *s = bs->opaque; +@@ -2241,6 +2248,7 @@ BlockDriver bdrv_qcow2 = { + .bdrv_aio_read = qcow_aio_read, + .bdrv_aio_write = qcow_aio_write, + .bdrv_aio_cancel = qcow_aio_cancel, ++ .bdrv_aio_flush = qcow_aio_flush, + .aiocb_size = sizeof(QCowAIOCB), + .bdrv_write_compressed = qcow_write_compressed, + +Index: xen-3.2.1-testing/tools/ioemu/block-raw.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block-raw.c ++++ xen-3.2.1-testing/tools/ioemu/block-raw.c +@@ -496,6 +496,21 @@ static void raw_aio_cancel(BlockDriverAI + pacb = &acb->next; + } + } ++ ++static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque) ++{ ++ RawAIOCB *acb; ++ ++ acb = raw_aio_setup(bs, 0, NULL, 0, cb, opaque); ++ if (!acb) ++ return NULL; ++ if (aio_fsync(O_SYNC, &acb->aiocb) < 0) { ++ qemu_aio_release(acb); ++ return NULL; ++ } ++ return &acb->common; ++} + #endif + + static void raw_close(BlockDriverState *bs) +@@ -621,6 +636,7 @@ BlockDriver bdrv_raw = { + .bdrv_aio_read = raw_aio_read, + .bdrv_aio_write = raw_aio_write, + .bdrv_aio_cancel = raw_aio_cancel, ++ .bdrv_aio_flush = raw_aio_flush, + .aiocb_size = sizeof(RawAIOCB), + #endif + .protocol_name = "file", +@@ -959,6 +975,7 @@ BlockDriver bdrv_host_device = { + .bdrv_aio_read = raw_aio_read, + .bdrv_aio_write = raw_aio_write, + .bdrv_aio_cancel = raw_aio_cancel, ++ .bdrv_aio_flush = raw_aio_flush, + .aiocb_size = sizeof(RawAIOCB), + #endif + .bdrv_pread = raw_pread, +Index: xen-3.2.1-testing/tools/ioemu/block.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block.c ++++ xen-3.2.1-testing/tools/ioemu/block.c +@@ -48,6 +48,8 @@ static BlockDriverAIOCB *bdrv_aio_write_ + int64_t sector_num, const uint8_t *buf, int nb_sectors, + BlockDriverCompletionFunc *cb, void *opaque); + static void bdrv_aio_cancel_em(BlockDriverAIOCB *acb); ++static BlockDriverAIOCB *bdrv_aio_flush_em(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque); + static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, + uint8_t *buf, int nb_sectors); + static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num, +@@ -155,6 +157,8 @@ void bdrv_register(BlockDriver *bdrv) + bdrv->bdrv_read = bdrv_read_em; + bdrv->bdrv_write = bdrv_write_em; + } ++ if (!bdrv->bdrv_aio_flush) ++ bdrv->bdrv_aio_flush = bdrv_aio_flush_em; + bdrv->next = first_drv; + first_drv = bdrv; + } +@@ -1138,6 +1142,17 @@ void bdrv_aio_cancel(BlockDriverAIOCB *a + drv->bdrv_aio_cancel(acb); + } + ++BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque) ++{ ++ BlockDriver *drv = bs->drv; ++ ++ if (!drv) ++ return NULL; ++ ++ return drv->bdrv_aio_flush(bs, cb, opaque); ++} ++ + + /**************************************************************/ + /* async block device emulation */ +@@ -1214,6 +1229,14 @@ static void bdrv_aio_cancel_em(BlockDriv + } + #endif /* !QEMU_TOOL */ + ++static BlockDriverAIOCB *bdrv_aio_flush_em(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque) ++{ ++ bdrv_flush(bs); ++ cb(opaque, 0); ++ return NULL; ++} ++ + /**************************************************************/ + /* sync block device emulation */ + +Index: xen-3.2.1-testing/tools/ioemu/block_int.h +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/block_int.h ++++ xen-3.2.1-testing/tools/ioemu/block_int.h +@@ -49,6 +49,8 @@ struct BlockDriver { + int64_t sector_num, const uint8_t *buf, int nb_sectors, + BlockDriverCompletionFunc *cb, void *opaque); + void (*bdrv_aio_cancel)(BlockDriverAIOCB *acb); ++ BlockDriverAIOCB *(*bdrv_aio_flush)(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque); + int aiocb_size; + + const char *protocol_name; +Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/hw/ide.c ++++ xen-3.2.1-testing/tools/ioemu/hw/ide.c +@@ -742,6 +742,7 @@ static inline void ide_abort_command(IDE + static inline void ide_set_irq(IDEState *s) + { + BMDMAState *bm = s->bmdma; ++ if (!s->bs) return; /* yikes */ + if (!(s->cmd & IDE_CMD_DISABLE_IRQ)) { + if (bm) { + bm->status |= BM_STATUS_INT; +@@ -907,6 +908,8 @@ static void ide_read_dma_cb(void *opaque + int n; + int64_t sector_num; + ++ if (!s->bs) return; /* yikes */ ++ + n = s->io_buffer_size >> 9; + sector_num = ide_get_sector(s); + if (n > 0) { +@@ -1015,6 +1018,8 @@ static void ide_write_dma_cb(void *opaqu + int n; + int64_t sector_num; + ++ if (!s->bs) return; /* yikes */ ++ + n = s->io_buffer_size >> 9; + sector_num = ide_get_sector(s); + if (n > 0) { +@@ -1063,6 +1068,39 @@ static void ide_sector_write_dma(IDEStat + ide_dma_start(s, ide_write_dma_cb); + } + ++static void ide_device_utterly_broken(IDEState *s) { ++ s->status |= BUSY_STAT; ++ s->bs = NULL; ++ /* This prevents all future commands from working. All of the ++ * asynchronous callbacks (and ide_set_irq, as a safety measure) ++ * check to see whether this has happened and bail if so. ++ */ ++} ++ ++static void ide_flush_cb(void *opaque, int ret) ++{ ++ IDEState *s = opaque; ++ ++ if (!s->bs) return; /* yikes */ ++ ++ if (ret) { ++ /* We are completely doomed. The IDE spec does not permit us ++ * to return an error from a flush except via a protocol which ++ * requires us to say where the error is and which ++ * contemplates the guest repeating the flush attempt to ++ * attempt flush the remaining data. We can't support that ++ * because f(data)sync (which is what the block drivers use ++ * eventually) doesn't report the necessary information or ++ * give us the necessary control. So we make the disk vanish. ++ */ ++ ide_device_utterly_broken(s); ++ return; ++ } ++ else ++ s->status = READY_STAT; ++ ide_set_irq(s); ++} ++ + static void ide_atapi_cmd_ok(IDEState *s) + { + s->error = 0; +@@ -1289,6 +1327,8 @@ static void ide_atapi_cmd_read_dma_cb(vo + IDEState *s = bm->ide_if; + int data_offset, n; + ++ if (!s->bs) return; /* yikes */ ++ + if (ret < 0) { + ide_atapi_io_error(s, ret); + goto eot; +@@ -1694,6 +1734,8 @@ static void cdrom_change_cb(void *opaque + IDEState *s = opaque; + int64_t nb_sectors; + ++ if (!s->bs) return; /* yikes */ ++ + /* XXX: send interrupt too */ + bdrv_get_geometry(s->bs, &nb_sectors); + s->nb_sectors = nb_sectors; +@@ -1797,8 +1839,8 @@ static void ide_ioport_write(void *opaqu + printf("ide: CMD=%02x\n", val); + #endif + s = ide_if->cur_drive; +- /* ignore commands to non existant slave */ +- if (s != ide_if && !s->bs) ++ /* ignore commands to non existant device */ ++ if (!s->bs) + break; + + switch(val) { +@@ -1967,10 +2009,8 @@ static void ide_ioport_write(void *opaqu + break; + case WIN_FLUSH_CACHE: + case WIN_FLUSH_CACHE_EXT: +- if (s->bs) +- bdrv_flush(s->bs); +- s->status = READY_STAT; +- ide_set_irq(s); ++ s->status = BUSY_STAT; ++ bdrv_aio_flush(s->bs, ide_flush_cb, s); + break; + case WIN_IDLEIMMEDIATE: + case WIN_STANDBY: +Index: xen-3.2.1-testing/tools/ioemu/vl.h +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/vl.h ++++ xen-3.2.1-testing/tools/ioemu/vl.h +@@ -650,6 +650,8 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDr + const uint8_t *buf, int nb_sectors, + BlockDriverCompletionFunc *cb, void *opaque); + void bdrv_aio_cancel(BlockDriverAIOCB *acb); ++BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs, ++ BlockDriverCompletionFunc *cb, void *opaque); + + void qemu_aio_init(void); + void qemu_aio_poll(void); diff --git a/32on64-extra-mem.patch b/32on64-extra-mem.patch index bcca9ea..0e621a4 100644 --- a/32on64-extra-mem.patch +++ b/32on64-extra-mem.patch @@ -2,7 +2,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -1837,7 +1837,7 @@ class XendDomainInfo: +@@ -1844,7 +1844,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 84879c0..1fe7907 100644 --- a/blktap.patch +++ b/blktap.patch @@ -5,7 +5,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2143,7 +2143,7 @@ class XendDomainInfo: +@@ -2150,7 +2150,7 @@ class XendDomainInfo: (fn, BOOTLOADER_LOOPBACK_DEVICE)) vbd = { @@ -45,7 +45,7 @@ Index: xen-3.2.1-testing/tools/ioemu/xenstore.c /* read the name of the device */ if (pasprintf(&buf, "%s/dev", bpath) == -1) continue; -@@ -252,6 +260,7 @@ void xenstore_parse_domain_config(int do +@@ -262,6 +270,7 @@ void xenstore_parse_domain_config(int do free(type); free(params); free(dev); diff --git a/bridge-bonding.diff b/bridge-bonding.diff index ca7c59d..3c43679 100644 --- a/bridge-bonding.diff +++ b/bridge-bonding.diff @@ -1,64 +1,47 @@ -Index: xen-3.1-testing/tools/examples/network-bridge +Index: xen-3.2-testing/tools/examples/network-bridge =================================================================== ---- xen-3.1-testing.orig/tools/examples/network-bridge -+++ xen-3.1-testing/tools/examples/network-bridge -@@ -160,6 +160,21 @@ antispoofing () { - iptables -A FORWARD -m physdev --physdev-in ${vif0} -j ACCEPT - } - -+# Find the netdev that is associated with the bridge by matching MAC addresses. -+find_bridged_netdev () { -+ 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 -+} -+ - # Usage: show_status dev bridge - # Print ifconfig and routes. - show_status () { -@@ -201,9 +216,10 @@ using netloop.nloopbacks= on the doma - - create_bridge ${bridge} - -- if link_exists "$vdev"; then -+ preiftransfer ${netdev} -+ . /etc/sysconfig/network/ifcfg-${netdev} -+ if [ ! "$BONDING_MASTER" = yes ] && link_exists "$vdev"; then - mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` -- preiftransfer ${netdev} - transfer_addrs ${netdev} ${vdev} - if ! ifdown ${netdev}; then - # If ifdown fails, remember the IP details. -@@ -222,6 +238,13 @@ using netloop.nloopbacks= on the doma - add_to_bridge ${bridge} ${vif0} - add_to_bridge2 ${bridge} ${pdev} - do_ifup ${netdev} -+ elif [ "$BONDING_MASTER" = yes ]; then -+ ip link set ${bridge} arp on -+ add_to_bridge ${bridge} ${vif0} -+ ip link set ${vif0} up -+ add_to_bridge2 ${bridge} ${netdev} -+ transfer_addrs ${netdev} ${bridge} -+ transfer_routes ${netdev} ${bridge} - else - ip link set ${bridge} arp on - ip link set ${bridge} multicast on -@@ -266,6 +289,10 @@ op_stop () { - ip link set ${pdev} name ${netdev} - do_ifup ${netdev} - else -+ if [ ${netdev} = ${bridge} ]; then -+ find_bridged_netdev ${bridge} -+ fi -+ ip link set dev ${vif0} down - transfer_routes ${bridge} ${netdev} - ip link set ${bridge} down +--- xen-3.2-testing.orig/tools/examples/network-bridge ++++ xen-3.2-testing/tools/examples/network-bridge +@@ -230,6 +230,9 @@ op_start () { + return fi + ++ local bonded="" ++ [ -e /sys/class/net/${netdev}/bonding ] && bonded="yes" ++ + vlans=$(find_active_vlans "${netdev}") + for vlan in $vlans ; do ifdown $vlan ; done + +@@ -243,13 +246,27 @@ op_start () { + ip link set ${netdev} down + ip addr flush ${netdev} + fi +- ip link set ${netdev} name ${pdev} +- ip link set ${tdev} name ${bridge} + +- setup_bridge_port ${pdev} ++ if [ "x${bonded}" = "xyes" ] ++ then ++ ip link set ${tdev} name ${bridge} ++ ln -sf /etc/sysconfig/network/ifcfg-${netdev} /etc/sysconfig/network/ifcfg-${pdev} ++ ifup ${pdev} ++ local gw=`ip route show dev ${pdev} | fgrep default | sed 's/default via //'` ++ ip addr flush ${pdev} ++ rm -f /etc/sysconfig/network/ifcfg-${pdev} ++ brctl addif ${bridge} ${pdev} ++ ip link set ${bridge} up ++ [ -n "$gw" ] && ip route add default via ${gw} ++ else ++ ip link set ${netdev} name ${pdev} ++ ip link set ${tdev} name ${bridge} ++ ++ setup_bridge_port ${pdev} + +- add_to_bridge2 ${bridge} ${pdev} +- do_ifup ${bridge} ++ add_to_bridge2 ${bridge} ${pdev} ++ do_ifup ${bridge} ++ fi + + for vlan in $vlans ; do ifup $vlan ; done + diff --git a/bridge-hostonly.diff b/bridge-hostonly.diff index 353a364..70ec93c 100644 --- a/bridge-hostonly.diff +++ b/bridge-hostonly.diff @@ -22,12 +22,12 @@ Signed-off-by: Gerd Hoffmann tools/examples/network-bridge | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) -Index: xen-3.1-testing/tools/examples/network-bridge +Index: xen-3.2.1-testing/tools/examples/network-bridge =================================================================== ---- xen-3.1-testing.orig/tools/examples/network-bridge -+++ xen-3.1-testing/tools/examples/network-bridge -@@ -299,6 +299,31 @@ op_stop () { - brctl delbr ${bridge} +--- xen-3.2.1-testing.orig/tools/examples/network-bridge ++++ xen-3.2.1-testing/tools/examples/network-bridge +@@ -305,6 +305,31 @@ op_stop () { + for vlan in $vlans ; do ifup $vlan ; done } +op_start_hostonly () { @@ -58,7 +58,7 @@ Index: xen-3.1-testing/tools/examples/network-bridge # adds $dev to $bridge but waits for $dev to be in running state first add_to_bridge2() { local bridge=$1 -@@ -323,11 +348,19 @@ add_to_bridge2() { +@@ -330,11 +355,19 @@ add_to_bridge2() { case "$command" in start) diff --git a/bridge-opensuse-11_0-temp.patch b/bridge-opensuse-11_0-temp.patch new file mode 100644 index 0000000..dc29951 --- /dev/null +++ b/bridge-opensuse-11_0-temp.patch @@ -0,0 +1,39 @@ +diff -ru a/tools/examples/xen-network-common.sh b/tools/examples/xen-network-common.sh +--- a/tools/examples/xen-network-common.sh 2008-04-10 15:24:08.000000000 -0600 ++++ b/tools/examples/xen-network-common.sh 2008-04-10 15:37:33.000000000 -0600 +@@ -27,26 +27,18 @@ + # that the virtual device will take once the physical device has + # been renamed. + +-if ! which ifup >/dev/null 2>/dev/null +-then +- preiftransfer() +- { ++preiftransfer() ++{ + true +- } +- ifup() +- { ++} ++ifup() ++{ + false +- } +- ifdown() +- { ++} ++ifdown() ++{ + false +- } +-else +- preiftransfer() +- { +- true +- } +-fi ++} + + + first_file() diff --git a/bridge-record-creation.patch b/bridge-record-creation.patch new file mode 100644 index 0000000..ab802f1 --- /dev/null +++ b/bridge-record-creation.patch @@ -0,0 +1,29 @@ +diff -ru a/tools/examples/network-bridge b/tools/examples/network-bridge +--- a/tools/examples/network-bridge 2008-04-02 12:33:07.000000000 -0600 ++++ b/tools/examples/network-bridge 2008-04-02 15:04:59.000000000 -0600 +@@ -238,6 +238,11 @@ + + create_bridge ${tdev} + ++ # Record creation of bridge in /dev/shm/sysconfig/xenbridges so other ++ # tools, e.g. yast2 lan, know that Xen bridging is active. ++ [ -d /dev/shm/sysconfig/xenbridges ] || mkdir /dev/shm/sysconfig/xenbridges ++ touch /dev/shm/sysconfig/xenbridges/${bridge} ++ + preiftransfer ${netdev} + transfer_addrs ${netdev} ${tdev} + if ! ifdown ${netdev}; then +@@ -302,6 +307,13 @@ + + brctl delbr ${tdev} + ++ # Remove record of bridge from /dev/shm/sysconfig/xenbridges ... ++ rm -f /dev/shm/sysconfig/xenbridges/${bridge} ++ # ... and directory itself if empty ++ if [ -z "$(ls -A /dev/shm/sysconfig/xenbridges 2>/dev/null)" ]; then ++ rmdir /dev/shm/sysconfig/xenbridges ++ fi ++ + for vlan in $vlans ; do ifup $vlan ; done + } + diff --git a/bridge-suse.diff b/bridge-suse.diff deleted file mode 100644 index 6a47408..0000000 --- a/bridge-suse.diff +++ /dev/null @@ -1,71 +0,0 @@ -Index: xen-3.1-testing/tools/examples/xen-network-common.sh -=================================================================== ---- xen-3.1-testing.orig/tools/examples/xen-network-common.sh -+++ xen-3.1-testing/tools/examples/xen-network-common.sh -@@ -16,53 +16,21 @@ - # - - --# On SuSE it is necessary to run a command before transfering addresses and --# routes from the physical interface to the virtual. This command creates a --# variable $HWD_CONFIG_0 that specifies the appropriate configuration for --# ifup. -- --# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives. -- --# Other platforms just use ifup / ifdown directly. -+preiftransfer() -+{ -+ # Ensure the interface has an IP to transfer -+ /sbin/ifrenew $1 -o rc || true -+} - --## --# preiftransfer --# --# @param $1 The current name for the physical device, which is also the name --# that the virtual device will take once the physical device has --# been renamed. -- --if [ -e /etc/SuSE-release ] --then -- preiftransfer() -- { -- eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- $1` -- } -- ifup() -- { -- /sbin/ifup ${HWD_CONFIG_0} $1 -- } --elif ! which ifup >/dev/null 2>/dev/null --then -- preiftransfer() -- { -- true -- } -- ifup() -- { -- false -- } -- ifdown() -- { -- false -- } --else -- preiftransfer() -- { -- true -- } --fi -+ifup() -+{ -+ /sbin/ifup $1 -o rc || true -+} - -+ifdown() -+{ -+ /sbin/ifdown $1 -o rc -+} - - first_file() - { diff --git a/bridge-vlan.diff b/bridge-vlan.diff index 3fbfd21..8654585 100644 --- a/bridge-vlan.diff +++ b/bridge-vlan.diff @@ -1,9 +1,9 @@ -Index: xen-3.1-testing/tools/examples/network-bridge +Index: xen-3.2-testing/tools/examples/network-bridge =================================================================== ---- xen-3.1-testing.orig/tools/examples/network-bridge -+++ xen-3.1-testing/tools/examples/network-bridge -@@ -160,6 +160,24 @@ antispoofing () { - iptables -A FORWARD -m physdev --physdev-in ${vif0} -j ACCEPT +--- xen-3.2-testing.orig/tools/examples/network-bridge ++++ xen-3.2-testing/tools/examples/network-bridge +@@ -180,6 +180,28 @@ antispoofing () { + iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT } +find_active_vlans() { @@ -17,47 +17,55 @@ Index: xen-3.1-testing/tools/examples/network-bridge + continue + fi + . $vifcfg -+ if [ "$ETHERDEVICE" = "$netdev" ] && link_exists "$vlan" ; then -+ vlans="$vlans $vlan" ++ 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" +} + - # Find the netdev that is associated with the bridge by matching MAC addresses. - find_bridged_netdev () { - local bridge=$1 -@@ -221,6 +239,8 @@ using netloop.nloopbacks= on the doma - if [ ! "$BONDING_MASTER" = yes ] && link_exists "$vdev"; then - mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - transfer_addrs ${netdev} ${vdev} -+ vlans=$(find_active_vlans "${netdev}") -+ for vlan in $vlans ; do ifdown $vlan ; done - if ! ifdown ${netdev}; then - # If ifdown fails, remember the IP details. - get_ip_info ${netdev} -@@ -238,6 +258,7 @@ using netloop.nloopbacks= on the doma - add_to_bridge ${bridge} ${vif0} - add_to_bridge2 ${bridge} ${pdev} - do_ifup ${netdev} -+ for vlan in $vlans ; do ifup $vlan ; done - elif [ "$BONDING_MASTER" = yes ]; then - ip link set ${bridge} arp on - add_to_bridge ${bridge} ${vif0} -@@ -272,6 +293,8 @@ op_stop () { - ip link set dev ${vif0} down - mac=`ip link show ${netdev} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - transfer_addrs ${netdev} ${pdev} -+ vlans=$(find_active_vlans "${netdev}") -+ for vlan in $vlans ; do ifdown $vlan ; done - if ! ifdown ${netdev}; then - get_ip_info ${netdev} - fi -@@ -288,6 +311,7 @@ op_stop () { - ip link set ${netdev} name ${vdev} - ip link set ${pdev} name ${netdev} - do_ifup ${netdev} -+ for vlan in $vlans ; do ifup $vlan ; done - else - if [ ${netdev} = ${bridge} ]; then - find_bridged_netdev ${bridge} + # Usage: show_status dev bridge + # Print ifconfig and routes. + show_status () { +@@ -208,6 +230,9 @@ op_start () { + return + fi + ++ vlans=$(find_active_vlans "${netdev}") ++ for vlan in $vlans ; do ifdown $vlan ; done ++ + create_bridge ${tdev} + + preiftransfer ${netdev} +@@ -226,6 +251,8 @@ op_start () { + add_to_bridge2 ${bridge} ${pdev} + do_ifup ${bridge} + ++ for vlan in $vlans ; do ifup $vlan ; done ++ + if [ ${antispoof} = 'yes' ] ; then + antispoofing + fi +@@ -239,6 +266,9 @@ op_stop () { + return + fi + ++ vlans=$(find_active_vlans "${netdev}") ++ for vlan in $vlans ; do ifdown $vlan ; done ++ + transfer_addrs ${bridge} ${pdev} + if ! ifdown ${bridge}; then + get_ip_info ${bridge} +@@ -254,6 +284,8 @@ op_stop () { + do_ifup ${netdev} + + brctl delbr ${tdev} ++ ++ for vlan in $vlans ; do ifup $vlan ; done + } + + # adds $dev to $bridge but waits for $dev to be in running state first diff --git a/cdrom-removable.patch b/cdrom-removable.patch index 0d93f4d..036bef6 100644 --- a/cdrom-removable.patch +++ b/cdrom-removable.patch @@ -396,21 +396,24 @@ Index: xen-3.2.1-testing/tools/ioemu/xenstore.c =================================================================== --- xen-3.2.1-testing.orig/tools/ioemu/xenstore.c +++ xen-3.2.1-testing/tools/ioemu/xenstore.c -@@ -217,6 +217,13 @@ void xenstore_parse_domain_config(int do - bdrv_set_type_hint(bs, BDRV_TYPE_CDROM); - if (pasprintf(&buf, "%s/params", bpath) != -1) - xs_watch(xsh, buf, dev); -+ /* if pyhsical put a watch on media-present after creating it */ -+ if (drv && !strcmp(drv, "phy")) { -+ if (pasprintf(&buf, "%s/media-present", bpath) != -1) { -+ xs_write(xsh, XBT_NULL, buf, "1", strlen("1")); -+ xs_watch(xsh, buf, "media-present"); -+ } -+ } +@@ -232,6 +232,16 @@ void xenstore_parse_domain_config(int do + fprintf(stderr, "qemu: could not open hard disk image '%s'\n", + params); } ++ /* if pyhsical CDROM put a watch on media-present after creating it */ ++ if (type && !strcmp(type, "cdrom") && drv && !strcmp(drv, "phy")) { ++ if (pasprintf(&buf, "%s/media-present", bpath) != -1) { ++ if (bdrv_is_inserted(bs_table[hd_index + (is_scsi ? MAX_DISKS : 0)])) ++ xs_write(xsh, XBT_NULL, buf, "1", strlen("1")); ++ else ++ xs_write(xsh, XBT_NULL, buf, "0", strlen("0")); ++ xs_watch(xsh, buf, "media-present"); ++ } ++ } + } - /* open device now if media present */ -@@ -418,6 +425,50 @@ void xenstore_record_dm_state(char *stat + /* Set a watch for log-dirty requests from the migration tools */ +@@ -425,6 +435,50 @@ void xenstore_record_dm_state(char *stat free(path); } @@ -461,7 +464,7 @@ Index: xen-3.2.1-testing/tools/ioemu/xenstore.c void xenstore_process_event(void *opaque) { char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL; -@@ -437,6 +488,11 @@ void xenstore_process_event(void *opaque +@@ -444,6 +498,11 @@ void xenstore_process_event(void *opaque goto out; } @@ -485,7 +488,7 @@ Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c } IDEState; #define BM_STATUS_DMAING 0x01 -@@ -1405,8 +1406,15 @@ static void ide_atapi_cmd(IDEState *s) +@@ -1446,8 +1447,15 @@ static void ide_atapi_cmd(IDEState *s) switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs)) { diff --git a/const-callback-arg.patch b/const-callback-arg.patch index 24a3a07..1ffbac9 100644 --- a/const-callback-arg.patch +++ b/const-callback-arg.patch @@ -1,7 +1,7 @@ -Index: 2008-01-07/xen/arch/ia64/xen/hypercall.c +Index: xen-3.2.1-testing/xen/arch/ia64/xen/hypercall.c =================================================================== ---- 2008-01-07.orig/xen/arch/ia64/xen/hypercall.c 2007-12-05 17:13:57.000000000 +0100 -+++ 2008-01-07/xen/arch/ia64/xen/hypercall.c 2008-01-07 12:11:43.000000000 +0100 +--- xen-3.2.1-testing.orig/xen/arch/ia64/xen/hypercall.c ++++ xen-3.2.1-testing/xen/arch/ia64/xen/hypercall.c @@ -34,9 +34,6 @@ #include #include @@ -21,10 +21,10 @@ Index: 2008-01-07/xen/arch/ia64/xen/hypercall.c { long ret; -Index: 2008-01-07/xen/arch/x86/x86_32/traps.c +Index: xen-3.2.1-testing/xen/arch/x86/x86_32/traps.c =================================================================== ---- 2008-01-07.orig/xen/arch/x86/x86_32/traps.c 2007-11-26 16:57:03.000000000 +0100 -+++ 2008-01-07/xen/arch/x86/x86_32/traps.c 2008-01-07 12:11:43.000000000 +0100 +--- xen-3.2.1-testing.orig/xen/arch/x86/x86_32/traps.c ++++ xen-3.2.1-testing/xen/arch/x86/x86_32/traps.c @@ -419,7 +419,7 @@ static long unregister_guest_callback(st } @@ -34,10 +34,10 @@ Index: 2008-01-07/xen/arch/x86/x86_32/traps.c { long ret; -Index: 2008-01-07/xen/arch/x86/x86_64/traps.c +Index: xen-3.2.1-testing/xen/arch/x86/x86_64/traps.c =================================================================== ---- 2008-01-07.orig/xen/arch/x86/x86_64/traps.c 2007-11-02 17:25:58.000000000 +0100 -+++ 2008-01-07/xen/arch/x86/x86_64/traps.c 2008-01-07 12:11:43.000000000 +0100 +--- xen-3.2.1-testing.orig/xen/arch/x86/x86_64/traps.c ++++ xen-3.2.1-testing/xen/arch/x86/x86_64/traps.c @@ -470,7 +470,7 @@ static long unregister_guest_callback(st } @@ -47,10 +47,10 @@ Index: 2008-01-07/xen/arch/x86/x86_64/traps.c { long ret; -Index: 2008-01-07/xen/include/asm-x86/guest_access.h +Index: xen-3.2.1-testing/xen/include/asm-x86/guest_access.h =================================================================== ---- 2008-01-07.orig/xen/include/asm-x86/guest_access.h 2007-12-07 11:51:50.000000000 +0100 -+++ 2008-01-07/xen/include/asm-x86/guest_access.h 2008-01-07 12:11:43.000000000 +0100 +--- xen-3.2.1-testing.orig/xen/include/asm-x86/guest_access.h ++++ xen-3.2.1-testing/xen/include/asm-x86/guest_access.h @@ -34,7 +34,8 @@ */ #define copy_to_guest_offset(hnd, off, ptr, nr) ({ \ @@ -71,11 +71,11 @@ Index: 2008-01-07/xen/include/asm-x86/guest_access.h ((void)((hnd).p == (ptr))); \ is_hvm_vcpu(current) ? \ copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) : \ -Index: 2008-01-07/xen/include/public/arch-ia64.h +Index: xen-3.2.1-testing/xen/include/public/arch-ia64.h =================================================================== ---- 2008-01-07.orig/xen/include/public/arch-ia64.h 2008-01-07 12:02:52.000000000 +0100 -+++ 2008-01-07/xen/include/public/arch-ia64.h 2008-01-07 12:11:43.000000000 +0100 -@@ -47,18 +47,7 @@ +--- xen-3.2.1-testing.orig/xen/include/public/arch-ia64.h ++++ xen-3.2.1-testing/xen/include/public/arch-ia64.h +@@ -53,18 +53,7 @@ #endif #ifndef __ASSEMBLY__ @@ -94,11 +94,11 @@ Index: 2008-01-07/xen/include/public/arch-ia64.h #define PRI_xen_pfn "lx" #endif -Index: 2008-01-07/xen/include/public/arch-powerpc.h +Index: xen-3.2.1-testing/xen/include/public/arch-powerpc.h =================================================================== ---- 2008-01-07.orig/xen/include/public/arch-powerpc.h 2008-01-07 12:02:52.000000000 +0100 -+++ 2008-01-07/xen/include/public/arch-powerpc.h 2008-01-07 12:11:43.000000000 +0100 -@@ -47,17 +47,7 @@ +--- xen-3.2.1-testing.orig/xen/include/public/arch-powerpc.h ++++ xen-3.2.1-testing/xen/include/public/arch-powerpc.h +@@ -49,17 +49,7 @@ #endif #ifndef __ASSEMBLY__ @@ -116,11 +116,11 @@ Index: 2008-01-07/xen/include/public/arch-powerpc.h #define PRI_xen_pfn "llx" #endif -Index: 2008-01-07/xen/include/public/arch-x86/xen.h +Index: xen-3.2.1-testing/xen/include/public/arch-x86/xen.h =================================================================== ---- 2008-01-07.orig/xen/include/public/arch-x86/xen.h 2008-01-07 12:02:52.000000000 +0100 -+++ 2008-01-07/xen/include/public/arch-x86/xen.h 2008-01-07 12:11:43.000000000 +0100 -@@ -53,17 +53,7 @@ +--- xen-3.2.1-testing.orig/xen/include/public/arch-x86/xen.h ++++ xen-3.2.1-testing/xen/include/public/arch-x86/xen.h +@@ -55,17 +55,7 @@ #endif #ifndef __ASSEMBLY__ @@ -138,10 +138,10 @@ Index: 2008-01-07/xen/include/public/arch-x86/xen.h #define PRI_xen_pfn "lx" #endif -Index: 2008-01-07/xen/include/public/xen.h +Index: xen-3.2.1-testing/xen/include/public/xen.h =================================================================== ---- 2008-01-07.orig/xen/include/public/xen.h 2008-01-07 12:02:52.000000000 +0100 -+++ 2008-01-07/xen/include/public/xen.h 2008-01-07 12:11:43.000000000 +0100 +--- xen-3.2.1-testing.orig/xen/include/public/xen.h ++++ xen-3.2.1-testing/xen/include/public/xen.h @@ -39,6 +39,20 @@ #error "Unsupported architecture" #endif diff --git a/const-set-trap-table-arg.patch b/const-set-trap-table-arg.patch index 6f17799..c8de6de 100644 --- a/const-set-trap-table-arg.patch +++ b/const-set-trap-table-arg.patch @@ -10,7 +10,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/traps.c #include #include #include -@@ -2880,7 +2881,7 @@ long unregister_guest_nmi_callback(void) +@@ -2884,7 +2885,7 @@ long unregister_guest_nmi_callback(void) return 0; } @@ -39,7 +39,7 @@ Index: xen-3.2.1-testing/xen/include/public/arch-x86/xen.h =================================================================== --- xen-3.2.1-testing.orig/xen/include/public/arch-x86/xen.h +++ xen-3.2.1-testing/xen/include/public/arch-x86/xen.h -@@ -98,7 +98,6 @@ struct trap_info { +@@ -100,7 +100,6 @@ struct trap_info { unsigned long address; /* code offset */ }; typedef struct trap_info trap_info_t; diff --git a/ept-2m-x64.patch b/ept-2m-x64.patch index a0ad197..3798512 100644 --- a/ept-2m-x64.patch +++ b/ept-2m-x64.patch @@ -2,22 +2,29 @@ Index: xen-3.2.1-testing/tools/libxc/xc_hvm_build.c =================================================================== --- xen-3.2.1-testing.orig/tools/libxc/xc_hvm_build.c +++ xen-3.2.1-testing/tools/libxc/xc_hvm_build.c -@@ -208,15 +208,39 @@ static int setup_guest(int xc_handle, +@@ -208,10 +208,10 @@ static int setup_guest(int xc_handle, for ( i = HVM_BELOW_4G_RAM_END >> PAGE_SHIFT; i < nr_pages; i++ ) page_array[i] += HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; -- /* Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. */ +- /* +- * Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. +- * We allocate pages in batches of no more than 2048 to ensure that +- * we can be preempted and hence dom0 remains responsive. + /* Allocate memory for HVM guest: + * 1) skip VGA hole 0xA0000-0xC0000; + * 2) Allocate 4K pages for the first 2M guest memory; + * 3) try to allocate 2M pages for the left guest memory, or use 4k pages; -+ */ + */ rc = xc_domain_memory_populate_physmap( xc_handle, dom, 0xa0, 0, 0, &page_array[0x00]); - if ( rc == 0 ) +@@ -222,12 +222,32 @@ static int setup_guest(int xc_handle, + if ( count > 2048 ) + count = 2048; rc = xc_domain_memory_populate_physmap( -- xc_handle, dom, nr_pages - 0xc0, 0, 0, &page_array[0xc0]); -+ xc_handle, dom, 0x200 - 0xc0, 0, 0, &page_array[0xc0]); +- xc_handle, dom, count, 0, 0, &page_array[cur_pages]); ++ xc_handle, dom, 0x200 - cur_pages, 0, 0, &page_array[cur_pages]); + cur_pages += count; + } if ( rc != 0 ) { - PERROR("Could not allocate memory for HVM guest.\n"); diff --git a/ept-novell-i386.patch b/ept-novell-i386.patch index bd87753..0b0d99e 100644 --- a/ept-novell-i386.patch +++ b/ept-novell-i386.patch @@ -18,7 +18,7 @@ Index: xen-3.2.1-testing/tools/libxc/xc_hvm_build.c struct elf_binary elf; uint64_t v_start, v_end; int rc; -@@ -269,6 +271,18 @@ static int setup_guest(int xc_handle, +@@ -280,6 +282,18 @@ static int setup_guest(int xc_handle, xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2); xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr); @@ -56,7 +56,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c =================================================================== --- xen-3.2.1-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c +++ xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c -@@ -105,11 +105,23 @@ static void vmx_init_vmcs_config(void) +@@ -107,11 +107,23 @@ static void vmx_init_vmcs_config(void) if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ) { @@ -84,7 +84,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c } #if defined(__i386__) -@@ -301,6 +313,8 @@ int vmx_cpu_up(void) +@@ -303,6 +315,8 @@ int vmx_cpu_up(void) return 0; } @@ -93,7 +93,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c return 1; } -@@ -439,6 +453,7 @@ void vmx_disable_intercept_for_msr(struc +@@ -441,6 +455,7 @@ void vmx_disable_intercept_for_msr(struc static int construct_vmcs(struct vcpu *v) { @@ -101,7 +101,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c uint16_t sysenter_cs; unsigned long sysenter_eip; -@@ -448,10 +463,23 @@ static int construct_vmcs(struct vcpu *v +@@ -450,10 +465,23 @@ static int construct_vmcs(struct vcpu *v __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_control); __vmwrite(VM_EXIT_CONTROLS, vmx_vmexit_control); __vmwrite(VM_ENTRY_CONTROLS, vmx_vmentry_control); @@ -128,7 +128,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c /* MSR access bitmap. */ if ( cpu_has_vmx_msr_bitmap ) -@@ -569,7 +597,10 @@ static int construct_vmcs(struct vcpu *v +@@ -571,7 +599,10 @@ static int construct_vmcs(struct vcpu *v __vmwrite(VMCS_LINK_POINTER_HIGH, ~0UL); #endif @@ -140,7 +140,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET; hvm_update_guest_cr(v, 0); -@@ -584,6 +615,19 @@ static int construct_vmcs(struct vcpu *v +@@ -586,6 +617,19 @@ static int construct_vmcs(struct vcpu *v __vmwrite(TPR_THRESHOLD, 0); } @@ -160,7 +160,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c vmx_vmcs_exit(v); paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */ -@@ -929,6 +973,8 @@ void vmcs_dump_vcpu(struct vcpu *v) +@@ -931,6 +975,8 @@ void vmcs_dump_vcpu(struct vcpu *v) (uint32_t)vmr(IDT_VECTORING_ERROR_CODE)); printk("TPR Threshold = 0x%02x\n", (uint32_t)vmr(TPR_THRESHOLD)); @@ -757,16 +757,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h #ifdef __x86_64__ struct vmx_msr_state msr_state; -@@ -120,6 +134,8 @@ void vmx_vmcs_exit(struct vcpu *v); - #define CPU_BASED_MWAIT_EXITING 0x00000400 - #define CPU_BASED_RDPMC_EXITING 0x00000800 - #define CPU_BASED_RDTSC_EXITING 0x00001000 -+#define CPU_BASED_CR3_LOAD_EXITING 0x00008000 -+#define CPU_BASED_CR3_STORE_EXITING 0x00010000 - #define CPU_BASED_CR8_LOAD_EXITING 0x00080000 - #define CPU_BASED_CR8_STORE_EXITING 0x00100000 - #define CPU_BASED_TPR_SHADOW 0x00200000 -@@ -148,6 +164,7 @@ extern u32 vmx_vmexit_control; +@@ -150,6 +164,7 @@ extern u32 vmx_vmexit_control; extern u32 vmx_vmentry_control; #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 @@ -774,7 +765,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 extern u32 vmx_secondary_exec_control; -@@ -163,6 +180,10 @@ extern bool_t cpu_has_vmx_ins_outs_instr +@@ -165,6 +180,10 @@ extern bool_t cpu_has_vmx_ins_outs_instr (vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS) #define cpu_has_vmx_msr_bitmap \ (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP) @@ -785,7 +776,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h /* GUEST_INTERRUPTIBILITY_INFO flags. */ #define VMX_INTR_SHADOW_STI 0x00000001 -@@ -204,11 +225,23 @@ enum vmcs_field { +@@ -206,11 +225,23 @@ enum vmcs_field { VIRTUAL_APIC_PAGE_ADDR = 0x00002012, VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, APIC_ACCESS_ADDR = 0x00002014, diff --git a/ept-novell-x64.patch b/ept-novell-x64.patch index 87dbd23..bc78903 100644 --- a/ept-novell-x64.patch +++ b/ept-novell-x64.patch @@ -18,7 +18,7 @@ Index: xen-3.2.1-testing/tools/libxc/xc_hvm_build.c struct elf_binary elf; uint64_t v_start, v_end; int rc; -@@ -269,6 +271,18 @@ static int setup_guest(int xc_handle, +@@ -280,6 +282,18 @@ static int setup_guest(int xc_handle, xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2); xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr); @@ -56,7 +56,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c =================================================================== --- xen-3.2.1-testing.orig/xen/arch/x86/hvm/vmx/vmcs.c +++ xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c -@@ -105,11 +105,23 @@ static void vmx_init_vmcs_config(void) +@@ -107,11 +107,23 @@ static void vmx_init_vmcs_config(void) if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ) { @@ -84,7 +84,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c } #if defined(__i386__) -@@ -301,6 +313,8 @@ int vmx_cpu_up(void) +@@ -303,6 +315,8 @@ int vmx_cpu_up(void) return 0; } @@ -93,7 +93,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c return 1; } -@@ -439,6 +453,7 @@ void vmx_disable_intercept_for_msr(struc +@@ -441,6 +455,7 @@ void vmx_disable_intercept_for_msr(struc static int construct_vmcs(struct vcpu *v) { @@ -101,7 +101,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c uint16_t sysenter_cs; unsigned long sysenter_eip; -@@ -448,10 +463,23 @@ static int construct_vmcs(struct vcpu *v +@@ -450,10 +465,23 @@ static int construct_vmcs(struct vcpu *v __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_control); __vmwrite(VM_EXIT_CONTROLS, vmx_vmexit_control); __vmwrite(VM_ENTRY_CONTROLS, vmx_vmentry_control); @@ -128,7 +128,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c /* MSR access bitmap. */ if ( cpu_has_vmx_msr_bitmap ) -@@ -569,7 +597,10 @@ static int construct_vmcs(struct vcpu *v +@@ -571,7 +599,10 @@ static int construct_vmcs(struct vcpu *v __vmwrite(VMCS_LINK_POINTER_HIGH, ~0UL); #endif @@ -140,7 +140,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET; hvm_update_guest_cr(v, 0); -@@ -584,6 +615,19 @@ static int construct_vmcs(struct vcpu *v +@@ -586,6 +617,19 @@ static int construct_vmcs(struct vcpu *v __vmwrite(TPR_THRESHOLD, 0); } @@ -160,7 +160,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c vmx_vmcs_exit(v); paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */ -@@ -929,6 +973,8 @@ void vmcs_dump_vcpu(struct vcpu *v) +@@ -931,6 +975,8 @@ void vmcs_dump_vcpu(struct vcpu *v) (uint32_t)vmr(IDT_VECTORING_ERROR_CODE)); printk("TPR Threshold = 0x%02x\n", (uint32_t)vmr(TPR_THRESHOLD)); @@ -757,16 +757,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h #ifdef __x86_64__ struct vmx_msr_state msr_state; -@@ -120,6 +134,8 @@ void vmx_vmcs_exit(struct vcpu *v); - #define CPU_BASED_MWAIT_EXITING 0x00000400 - #define CPU_BASED_RDPMC_EXITING 0x00000800 - #define CPU_BASED_RDTSC_EXITING 0x00001000 -+#define CPU_BASED_CR3_LOAD_EXITING 0x00008000 -+#define CPU_BASED_CR3_STORE_EXITING 0x00010000 - #define CPU_BASED_CR8_LOAD_EXITING 0x00080000 - #define CPU_BASED_CR8_STORE_EXITING 0x00100000 - #define CPU_BASED_TPR_SHADOW 0x00200000 -@@ -148,6 +164,7 @@ extern u32 vmx_vmexit_control; +@@ -150,6 +164,7 @@ extern u32 vmx_vmexit_control; extern u32 vmx_vmentry_control; #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 @@ -774,7 +765,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 extern u32 vmx_secondary_exec_control; -@@ -163,6 +180,10 @@ extern bool_t cpu_has_vmx_ins_outs_instr +@@ -165,6 +180,10 @@ extern bool_t cpu_has_vmx_ins_outs_instr (vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS) #define cpu_has_vmx_msr_bitmap \ (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP) @@ -785,7 +776,7 @@ Index: xen-3.2.1-testing/xen/include/asm-x86/hvm/vmx/vmcs.h /* GUEST_INTERRUPTIBILITY_INFO flags. */ #define VMX_INTR_SHADOW_STI 0x00000001 -@@ -204,11 +225,23 @@ enum vmcs_field { +@@ -206,11 +225,23 @@ enum vmcs_field { VIRTUAL_APIC_PAGE_ADDR = 0x00002012, VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, APIC_ACCESS_ADDR = 0x00002014, diff --git a/ept-supported-fix.patch b/ept-supported-fix.patch new file mode 100644 index 0000000..cfa57e5 --- /dev/null +++ b/ept-supported-fix.patch @@ -0,0 +1,14 @@ +Index: xen-3.2-testing/xen/arch/x86/mm/p2m.c +=================================================================== +--- xen-3.2-testing.orig/xen/arch/x86/mm/p2m.c ++++ xen-3.2-testing/xen/arch/x86/mm/p2m.c +@@ -281,7 +281,8 @@ void p2m_init(struct domain *d) + d->arch.p2m.get_entry_fast = p2m_gfn_to_mfn_fast; + d->arch.p2m.change_entry_type_global = p2m_change_type_global; + +- if ( is_hvm_domain(d) ) ++ if ( is_hvm_domain(d) && hvm_funcs.hap_supported && ++ (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) ) + hvm_p2m_init(d); + } + diff --git a/hypercall-check.patch b/hypercall-check.patch deleted file mode 100644 index fd6fe15..0000000 --- a/hypercall-check.patch +++ /dev/null @@ -1,47 +0,0 @@ -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.xen_loop b/init.xen_loop new file mode 100644 index 0000000..a2fca04 --- /dev/null +++ b/init.xen_loop @@ -0,0 +1,2 @@ +# Increase the number of loopback devices available for vm creation +options loop max_loop=64 diff --git a/key-shift-escape.patch b/key-shift-escape.patch new file mode 100644 index 0000000..b224f62 --- /dev/null +++ b/key-shift-escape.patch @@ -0,0 +1,22 @@ +Index: xen-3.2-testing/tools/ioemu/vnc.c +=================================================================== +--- xen-3.2-testing.orig/tools/ioemu/vnc.c 2008-01-16 13:19:03.000000000 -0700 ++++ xen-3.2-testing/tools/ioemu/vnc.c 2008-04-04 13:12:52.000000000 -0600 +@@ -1181,13 +1181,14 @@ + + if (is_graphic_console()) { + /* If the shift state needs to change then simulate an additional +- keypress before sending this one. ++ keypress before sending this one. Ignore for escape key, need to ++ enhance for other non shiftable keys. + */ +- if (shift && !shift_keys) { ++ if (shift && !shift_keys && keycode != 1) { + press_key_shift_down(vs, down, keycode); + return; + } +- else if (!shift && shift_keys) { ++ else if (!shift && shift_keys && keycode != 1) { + press_key_shift_up(vs, down, keycode); + return; + } diff --git a/keymap-vm.patch b/keymap-vm.patch new file mode 100644 index 0000000..4db9713 --- /dev/null +++ b/keymap-vm.patch @@ -0,0 +1,29 @@ +Index: xen-3.2.1-testing/tools/python/xen/xend/image.py +=================================================================== +--- xen-3.2.1-testing.orig/tools/python/xen/xend/image.py ++++ xen-3.2.1-testing/tools/python/xen/xend/image.py +@@ -194,12 +194,16 @@ class ImageHandler: + ret.append('-nographic') + return ret + ++ keymap = vmConfig['platform'].get("keymap") ++ + vnc_config = {} + has_vnc = int(vmConfig['platform'].get('vnc', 0)) != 0 + has_sdl = int(vmConfig['platform'].get('sdl', 0)) != 0 + for dev_uuid in vmConfig['console_refs']: + dev_type, dev_info = vmConfig['devices'][dev_uuid] + if dev_type == 'vfb': ++ if 'keymap' in dev_info: ++ keymap = dev_info.get('keymap',{}) + vfb_type = dev_info.get('type', {}) + if vfb_type == 'sdl': + self.display = dev_info.get('display', {}) +@@ -210,7 +214,6 @@ class ImageHandler: + has_vnc = True + break + +- keymap = vmConfig['platform'].get("keymap") + if keymap: + ret.append("-k") + ret.append(keymap) diff --git a/migration-cpl-init.patch b/migration-cpl-init.patch deleted file mode 100644 index a00cfe6..0000000 --- a/migration-cpl-init.patch +++ /dev/null @@ -1,16 +0,0 @@ -Signed-off-by: Robert Plillips -Signed-off-by: Ben Guthro - -Index: xen-3.2-testing/xen/arch/x86/hvm/svm/svm.c -=================================================================== ---- xen-3.2-testing.orig/xen/arch/x86/hvm/svm/svm.c -+++ xen-3.2-testing/xen/arch/x86/hvm/svm/svm.c -@@ -642,7 +642,7 @@ static void svm_set_segment_register(str - break; - case x86_seg_ss: - memcpy(&vmcb->ss, reg, sizeof(*reg)); -- vmcb->cpl = vmcb->ss.attr.fields.dpl; -+ vmcb->cpl = vmcb->cs.attr.fields.dpl; - break; - case x86_seg_tr: - memcpy(&vmcb->tr, reg, sizeof(*reg)); diff --git a/multinet-common.sh b/multinet-common.sh deleted file mode 100644 index 53ca633..0000000 --- a/multinet-common.sh +++ /dev/null @@ -1,1637 +0,0 @@ -#!/bin/sh -#============================================================================ -# multinet-common.sh -# -# Version = 3.0.1 -# Date = 2008-02-07 -# -# 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: -# -# Function library for network-multinet and all other multinet related -# network scripts -# -# Vars (should not need to be changed): -# -# 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) -# -#============================================================================ - -BRIDGE_NAME="xenbr" -HOSTONLY_NAME="xenhost" -NAT_NAME="xennat" -ROUTE_NAME="xenroute" -NOHOST_NAME="xennohost" -EMPTY_NAME="xenempty" - -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 ************************************************** - -evalVariables() { - for arg in "$@" - do - if expr 'index' "$arg" '=' '>' '1' >/dev/null - then - eval "$arg" - fi - done -} - -findCommand() { - for arg in "$@" - do - if ! expr 'index' "$arg" '=' >/dev/null - then - command="$arg" - return - fi - done -} - -#***** Firewall/Routing Functions ***************************************** - -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 -# -# The values start|stop are passed into this function and it behaves respectivly - - case $1 in - start) - #------------------------------------------------------------------ - # Determine the initial state of the ip_forward parameter - #------------------------------------------------------------------ - case `cat /proc/sys/net/ipv4/ip_forward` in - 0) - INIT_IP_FWD="off" - echo "0" > $NETWORK_SAVE_PATH/init_ip_fwd_state - ;; - 1) - INIT_IP_FWD="on" - echo "1" > $NETWORK_SAVE_PATH/init_ip_fwd_state - ;; - esac - - #------------------------------------------------------------------ - # Determine if we need to enable ip_forward - #------------------------------------------------------------------ - if echo $NETWORK_LIST | grep -qE "(nat|NAT|route|ROUTE)" - then - IP_FWD="on" - echo "" - echo "============================================================" - echo "Enabling IP Forwarding" - echo "============================================================" - echo 1 > /proc/sys/net/ipv4/ip_forward - else - IP_FWD="off" - echo "" - echo "============================================================" - echo "Disabling IP Forwarding" - echo "============================================================" - echo 0 > /proc/sys/net/ipv4/ip_forward - fi - ;; - stop) - #------------------------------------------------------------------ - # Set the ip_forward value back to its original state - #------------------------------------------------------------------ - echo "" - echo "============================================================" - echo "Restoring IP Forwarding to its original state" - echo "============================================================" - case `cat $NETWORK_SAVE_PATH/init_ip_fwd_state` in - 0) - #echo "ip_forward = 0" - echo "0" > /proc/sys/net/ipv4/ip_forward - ;; - 1) - #echo "ip_forward = 0" - echo "1" > /proc/sys/net/ipv4/ip_forward - ;; - *) - #echo "Original state unknown. Using default value." - #echo "ip_forward = 0" - echo "0" > /proc/sys/net/ipv4/ip_forward - ;; - esac - - #------------------------------------------------------------------ - # Clean up init_ip_fwd_state file - #------------------------------------------------------------------ - rm -f $NETWORK_SAVE_PATH/init_ip_fwd_state - ;; - esac -} - -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" - then - echo "" - echo "============================================================" - echo "Stopping SuSEfirewall2" - echo "============================================================" - /etc/init.d/SuSEfirewall2_setup stop > /dev/null 2>&1 - return 0 - else - return 1 - fi - ;; - start) - 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 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 - fi - ;; - esac -} - -manage_iptables() { -# This function saves and restores the iptables rules that exist -# before the Xen network script runs -# -# The following values can be passed into this fuction: -# start|stop - - case $1 in - stop) - echo "" - 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" - iptables-save -t $TABLE > $IPTABLES_SAVE_FILE@$TABLE - echo " Flushing table: $TABLE" - iptables -F -t $TABLE - echo " -----------------------" - done - - #---------------------------------------------------------------- - # Deleting any custom chain - #---------------------------------------------------------------- - for CHAIN in `iptables-save |grep ^:|cut -d ":" -f 2|cut -d " " -f 1` - do - case $CHAIN in - INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING) - #do nothing - ;; - *) - echo "Deteting chain: $CHAIN" - iptables -X $CHAIN - ;; - esac - done - ;; - start) - echo "" - 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" - iptables-restore < $IPTABLES_SAVE_FILE@$TABLE - rm $IPTABLES_SAVE_FILE@$TABLE - 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 ******************************** - -create_bridge() { -# This function creates a bridge. -# -# Usage: create_bridge $BRIDGE -# -# Vars: $BRIDGE -Name of the bridge - - 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 - fi -} - -delete_bridge() { -# This function deletes a bridge. -# -# Usage: delete_bridge $BRIDGE -# -# Vars: $BRIDGE -Name of the bridge - - 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} - 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 - return - fi - brctl addif ${BRIDGE} ${DEV} - ip link set ${DEV} up -} - -add_to_bridge2() { -# 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 - - local BRIDGE=$1 - local DEV=$2 - local MAXTRIES=10 - - 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 - - if [ ${i} -eq ${MAXTRIES} ] - then - echo '(link isnt in running state)' - fi - - add_to_bridge ${BRIDGE} ${DEV} -} - -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 there is an address to transfer - # echo "Ensure there is an address to transfer";echo "ifup ${SRC}";echo "ip link set ${DST} up";read - if ! ip addr show $SRC| grep -qw "UP" - then - ip link set $SRC up - #ifup $SRC > /dev/null 2>&1 - fi - - # Don't bother if $DST already has IP addresses. - if ip addr show dev ${DST} | egrep -q '^ *inet ' ; then - return - fi - - # Record default route on ${SRC} - DEFAULT_GW=`ip route show dev ${SRC} | fgrep default | sed 's/default via //'` - - # 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} label ${DST}/ -s/secondary// -" | sh -e - # Remove automatic routes on destination device - ip route list | sed -ne " -/dev ${DST}\( \|$\)/ { - s/^/ip route del / - p -}" | sh -e - -} - -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). -# -# 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/^/ip route add / - P - d -}" | sh -e -} - -link_exists() { -# 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 - else - return 1 - fi -} - -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 -} - -find_active_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" -} - -create_normal_bridge() { -# This fuction creates a bridge on a normal network interface -# -# Usage: create_normal_bridge start|stop $DEV $BRIDGE -# -# Vars: $DEV -Network interface name -# $BRIDGE -Name of the bridge - - local DEV="$2" - local BRIDGE="$3" - - local BONDED="no" - if [ -e /sys/class/net/$DEV/bonding ] - then - BONDED="yes" - fi - - # 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) - # Create ${BRIDGE} - #echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read - create_bridge ${BRIDGE} - - # Transfer IP address from ${DEV} to the ${BRIDGE} - #echo "Transfer the IP address from ${DEV} to ${BRIDGE}";read - transfer_addrs ${DEV} ${BRIDGE} - - # Flush addresses from ${DEV} - #echo "Flush addresses from ${DEV}";read - ip addr flush ${DEV} > /dev/null 2>&1 - - # Add ${DEV} to ${BRIDGE} - #echo "Add ${DEV} to ${BRIDGE}";read - brctl addif ${BRIDGE} ${DEV} - - # Bring up ${BRIDGE} - #echo "Bring up ${BRIDGE}";read - ip link set dev ${BRIDGE} up - - # If default route was on ${DEV}, then transfer it to ${BRIDGE} - #echo "Add gw ${DEFAULT_GW}";read - [ -n "${DEFAULT_GW}" ] && ip route add default dev ${BRIDGE} via ${DEFAULT_GW} - - ;; - stop) - # Remove interface from bridge - brctl delif ${BRIDGE} ${DEV} - - # If interface is a bond, use ifdown and don't transfer addresses. - # Addresses will be reassigned when ifup'ing the bond. - #echo "Remove interface ${DEV} from ${BRIDGE}";read - if [ "x${BONDED}" = "xyes" ] - then - ifdown ${DEV} - else - ip link set ${DEV} down - # Transfer IP address back to original interface - #echo "Transfer IP address from ${BRIDGE} to ${DEV}";read - transfer_addrs ${BRIDGE} ${DEV} - fi - - # Remove bridge ${BRIDGE} - #echo "Remove the bridge";read - delete_bridge ${BRIDGE} - - # If bonded, just ifup the bond. Otherwise use ip to bring up the interface - # and if default route was on ${BRIDGE} transfer it back to ${DEV} - if [ "x${BONDED}" = "xyes" ] - then - ifup ${DEV} - else - ip link set ${DEV} up - [ -n "${DEFAULT_GW}" ] && ip route add default dev ${DEV} via ${DEFAULT_GW} - fi - ;; - 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 ************************************** - -configure_bridge_as_dom0_interface() { -# This function configures the IP address of a bridge to be a -# network interface in Dom0. -# -# Usage: configure_dom0_bridge_interface $BRIDGE $IPADDR -# -# Vars: $BRIDGE -bridge name -# $IPADDR -IP address to assign to the bridge - - local BRIDGE="$1" - local IPADDR="$2" - - case $CMD_OPT in - start) - # Take the bridge down - #echo "Taking the $BRIDGE down";read - ip link set $BRIDGE down - - # 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 the bridge 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 bridge down - #echo "Taking $BRIDGE down";read - ip link set $BRIDGE down - - # Remove IP address from the bridge - #echo "Remove the IP address from $BRIDGE";read - ip addr flush $BRIDGE > /dev/null 2>&1 - ;; - status) - ip addr show $BRIDGE - ;; - esac -} - -#***** Network Type Configuration Functions ******************************* - -configure_bridged_networks() { -# This function creates traditional bridges on physical interfaces (eth) in Dom0. -# -# 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 - - # Set local function variables - local DEV=$2 - local NUMBER=$3 - local BRIDGE=$BRIDGE_NAME$NUMBER - - # Test if $BRIDGE is set - if [ "$BRIDGE" = "null" ] - then - return - fi - - case $1 in - start) - # Test if $BRIDGE already exists - if [ -e "/sys/class/net/$BRIDGE/bridge" ] - then - # Skip this bridge - #------------------------------------------------------------------ - echo " $BRIDGE exists and is already configured." - echo " Skipping $BRIDGE" - return - fi - - if /sbin/ip link show $DEV | grep -qw UP - then - echo "" - echo "============================================================" - echo "Configuring Virtual Network: $BRIDGE" - echo " of type: bridge" - echo " on- Physical Interface: $DEV" - echo "============================================================" - echo "" - - # Create bridge - create_normal_bridge start $DEV $BRIDGE - - if [ "${antispoof}" = "yes" ] - then - antispoofing - fi - - # Write entry into networktab - #--------------------------------------------------------------------- - echo "$BRIDGE,bridge,$NUMBER,$DEV,dhcp-off" >> $NETWORKTAB - echo "" - else - 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: $BRIDGE" - echo " of type: bridge" - echo "from- Physical Interface: $DEV" - echo "============================================================" - echo "" - - # Remove bridge with normal network interface (i.e. ethX) - create_normal_bridge stop $DEV $BRIDGE - - # Remove entry from networktab file - #--------------------------------------------------------------------- - sed -i "/$BRIDGE/d" $NETWORKTAB - - ;; - status) - - ;; - *) - echo "The function create_bridged_networks requires the CMD_OPT variable" - echo "to be set to one of the following: start|stop|status" - exit 1 - ;; - esac -} - -configure_local_networks() { -# This function creates bridges as network interfaces in Dom0 and -# enables nat or routing on the bridges if specified. -# -# 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=$2 - local TYPE=$3 - local NUMBER=$4 - case $TYPE in - hostonly) - local BRIDGE=$HOSTONLY_NAME$NUMBER - ;; - nat) - local BRIDGE=$NAT_NAME$NUMBER - ;; - route) - local BRIDGE=$ROUTE_NAME$NUMBER - ;; - esac - local IPADDR=$5 - local DHCP_SRV=$6 - - 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 - - # 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 ! [ -e "/sys/class/net/$BRIDGE/bridge" ] - then - # Create the network - #------------------------------------------------------------------ - echo "" - echo "============================================================" - echo "Configuring Virtual Network: $BRIDGE" - echo " of type: $TYPE" - - # 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 > /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_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_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 - # 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 - - # 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,$IPADDR,$DHCP_SRV" >> $NETWORKTAB - - echo "============================================================" - else - # Skip this bridge - #------------------------------------------------------------------ - echo " $BRIDGE exists and is already configured." - echo " Skipping $BRIDGE" - fi - ;; - stop) - # Remove the network - #------------------------------------------------------------------ - echo "" - echo "============================================================" - echo "Removing Virtual Network: $BRIDGE" - echo " of type: $TYPE" - - # 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) - # 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) - # 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 "============================================================" - - # unconfigure the veth - configure_bridge_as_dom0_interface $DEV $IPADDR > /dev/null 2>&1 - - # Remove the bridge - #echo "Removing $BRIDGE";read - delete_bridge $BRIDGE - - # Remove entry from networktab file - #--------------------------------------------------------------------- - sed -i "/$BRIDGE/d" $NETWORKTAB - - ;; - status) - #------------------------------------------------------------------ - # Show the status of the bridge - #------------------------------------------------------------------ - echo "" - echo "============================================================" - echo "Status of Virtual Network: $BRIDGE" - echo " of type: $TYPE" - echo "============================================================" - brctl show | grep -w "^$BRIDGE" - echo "" - ip addr show $BRIDGE - echo "============================================================" - ;; - *) - echo "The function requires one of the following options:" - echo "start|stop|status" - exit 1 - ;; - esac -} - -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. -# -# Usage: create_nohost_networks start|stop|status $NET_DEV $NET_NUMBER - - echo "" - echo "============================================================" - local DEV=$2 - local MAC=`ip link show ${DEV} | grep 'link\/ether' | sed -e 's/.*ether \(..:..:..:..:..:..\).*/\1/'` - local NUMBER=$3 - local BRIDGE=${NOHOST_NAME}${NUMBER} - - case $1 in - start) - if ! [ -e "/sys/class/net/${BRIDGE}/bridge" ] - then - echo "" - echo "============================================================" - echo "Configuring Virtual Network: ${BRIDGE}" - echo " of type: nohost" - echo " on- Physical Interface: ${DEV}" - - # Create the network - #--------------------------------------------------------------------- - - # Ensure there is a bridge to transfer to - #echo "Create the bridge. \(create_bridge ${BRIDGE}\)";read - create_bridge ${BRIDGE} - - # Configure $DEV as a bridge port - #echo "Configure ${DEV} as a bridge port";read - setup_bridge_port ${DEV} - - # Bring bridge up and add interfaces to it - #echo "Bring ${BRIDGE} up and add ${DEV} to it";read - ip link set ${BRIDGE} up - #add_to_bridge2 ${BRIDGE} ${DEV} - add_to_bridge ${BRIDGE} ${DEV} - - # Write entry into networktab file - #--------------------------------------------------------------------- - echo "${BRIDGE},nohost,${NUMBER},${DEV},,," >> ${NETWORKTAB} - else - # Skip this bridge - #------------------------------------------------------------------ - echo " $BRIDGE exists and is already configured." - echo " Skipping $BRIDGE" - fi - ;; - stop) - if brctl show | grep -qw "^${BRIDGE}" - then - echo "============================================================" - echo "Removing Virtual Network: ${BRIDGE}" - echo " of type: nohost" - echo "" - - # Remove the network - #--------------------------------------------------------------------- - - # Remove interface from bridge - #echo "Remove interface ${DEV} from ${BRIDGE}";read - brctl delif ${BRIDGE} ${DEV} - - # Remove bridge ${BRIDGE} - #echo "Remove the bridge";read - delete_bridge ${BRIDGE} - - # Bring renamed physical interface up - #echo "Bring up ${DEV}";read - ifup ${DEV} > /dev/null 2>&1 - - # Remove entry from networktab file - #--------------------------------------------------------------------- - sed -i "/${BRIDGE}/d" $NETWORKTAB - - fi - ;; - status) - brctl show $BRIDGE | grep -w "^$BRIDGE" - ;; - *) - echo "The function requires one of the following options:" - echo "start|stop|status" - exit 1 - ;; - esac - echo "============================================================" -} - -configure_empty_networks() { -# This function creates bridges attached to no devices in Dom0. -# -# Usage: create_empty_networks start|stop|status $NET_NUMBER - - echo "" - echo "============================================================" - local NUMBER=$2 - local BRIDGE=$EMPTY_NAME$NUMBER - - case $1 in - start) - if ! [ -e "/sys/class/net/${BRIDGE}/bridge" ] - then - echo "Configuring Virtual Network: $BRIDGE" - echo " of type: empty" - - # Create the network - #--------------------------------------------------------------------- - - # create the bridge - create_bridge $BRIDGE - - # Write entry into networktab file - #--------------------------------------------------------------------- - echo "$BRIDGE,empty,$NUMBER,,,," >> $NETWORKTAB - else - # Skip this bridge - #------------------------------------------------------------------ - echo " $BRIDGE exists and is already configured." - echo " Skipping $BRIDGE" - fi - ;; - stop) - if brctl show | grep -qw "^$BRIDGE" - then - 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 $BRIDGE | grep -w "^$BRIDGE" - ;; - *) - 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_IP $NET_DHCP_SRV - ;; - nohost) - configure_nohost_networks stop $NET_DEV $NET_NUMBER - ;; - empty) - configure_empty_networks stop $NET_NUMBER - ;; - esac - 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 deleted file mode 100644 index 16119a0..0000000 --- a/multinet-include.template +++ /dev/null @@ -1,50 +0,0 @@ -#!/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/network-multinet b/network-multinet deleted file mode 100644 index e801233..0000000 --- a/network-multinet +++ /dev/null @@ -1,389 +0,0 @@ -#!/bin/sh -#============================================================================ -# network-multinet -# -# 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: -# -# 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 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 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 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 are connected to Dom0 and are privet 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 are not directly connected to the physical network -# but whi'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 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. -# -# 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. -# -# To enable this script edit the network-script field in the -# /etc/xen/xend-config.sxp file. -# -# Example: (network-script network-multinet) -# -# Depends on: $SCRIPT_PATH/multinet-common.sh -# -# Config file: /etc/sysconfig/xend -# -# Usage: network-multinet (start|stop|restart|status) -# -# Vars: -# -# --------------------------- In this script ---------------------------- -# -# 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 -# on using the following format: -# -# ,,,,, -# -# Example with 3 virtual devices: -# -# "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 -# -#============================================================================ - -#### Read config files and set variables ################################## - - -# Source the configuration File - -. /etc/sysconfig/xend - -SCRIPT_PATH="/etc/xen/scripts" - -#### Script Functions ##################################################### - -usage() { -# Gives help about usage parameters - echo "Usage: $0 {start|stop|restart|status}" - exit 1 -} - -get_option() { -# Determine which option was passed from the command line. - case "$1" in - start|stop|restart|status) - CMD_OPT="$1" - ;; - *) - usage - ;; - esac -} - -. $SCRIPT_PATH/multinet-common.sh - -make_config_dirs() { -# Create temporary storage directory if needed. - if ! [ -d "$NETWORK_SAVE_PATH" ] - then - mkdir $NETWORK_SAVE_PATH - fi -} - - -#***** Network Creation Main Function ************************************* - -create_networks() { - - 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_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 }'` - ;; - esac - - case $NET_TYPE in - bridge) - # Create the network - #--------------------------------------------------------------------- - configure_bridged_networks $CMD_OPT $NET_DEV $NET_NUMBER - ;; - nat|route|hostonly) - # Create the network - #--------------------------------------------------------------------- - configure_local_networks $CMD_OPT $NET_DEV $NET_TYPE $NET_NUMBER $NET_DEV_IP $NET_DHCP_SRV - ;; - nohost) - # Create the network - #--------------------------------------------------------------------- - configure_nohost_networks $CMD_OPT $NET_DEV $NET_NUMBER - ;; - empty) - # 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() { - echo "" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - echo " Starting the xend network environment" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - # 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() { - echo "" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - echo " Stopping the xend network environment" - echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" - # 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() { - create_networks -} - -#### Main Code Body ####################################################### - -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 - #do_dhcpd start - ;; - stop) - # Stop the DHCP server if it exists - #do_dhcpd stop - - # Stop the Xen network - stop_xend_network - ;; - restart) - # Stop the DHCP server if it exists - #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 - #do_dhcpd start - ;; - status) - show_xend_network_status - - #do_dhcpd status - ;; -esac - -exit 0 diff --git a/ns_tools.patch b/ns_tools.patch index cb84ee6..e6ab108 100644 --- a/ns_tools.patch +++ b/ns_tools.patch @@ -45,7 +45,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/image.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/image.py +++ xen-3.2.1-testing/tools/python/xen/xend/image.py -@@ -438,6 +438,7 @@ class HVMImageHandler(ImageHandler): +@@ -441,6 +441,7 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) @@ -53,7 +53,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/image.py self.guest_os_type = vmConfig['platform'].get('guest_os_type') # Return a list of cmd line args to the device models based on the -@@ -528,6 +529,7 @@ class HVMImageHandler(ImageHandler): +@@ -531,6 +532,7 @@ class HVMImageHandler(ImageHandler): log.debug("store_evtchn = %d", store_evtchn) log.debug("memsize = %d", mem_mb) log.debug("vcpus = %d", self.vm.getVCpuCount()) @@ -61,7 +61,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/image.py log.debug("acpi = %d", self.acpi) log.debug("apic = %d", self.apic) -@@ -535,6 +537,7 @@ class HVMImageHandler(ImageHandler): +@@ -538,6 +540,7 @@ class HVMImageHandler(ImageHandler): image = self.kernel, memsize = mem_mb, vcpus = self.vm.getVCpuCount(), diff --git a/ns_xen_base.patch b/ns_xen_base.patch index 12bfd73..21497b7 100644 --- a/ns_xen_base.patch +++ b/ns_xen_base.patch @@ -332,7 +332,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/x86_64/exits.S =================================================================== --- xen-3.2.1-testing.orig/xen/arch/x86/hvm/vmx/x86_64/exits.S +++ xen-3.2.1-testing/xen/arch/x86/hvm/vmx/x86_64/exits.S -@@ -112,6 +112,14 @@ vmx_process_softirqs: +@@ -116,6 +116,14 @@ vmx_process_softirqs: ALIGN ENTRY(vmx_asm_do_vmentry) GET_CURRENT(%rbx) diff --git a/qemu-security-etch1.diff b/qemu-security-etch1.diff index e2f1eea..0e1c73c 100644 --- a/qemu-security-etch1.diff +++ b/qemu-security-etch1.diff @@ -2,7 +2,7 @@ Index: xen-3.2.1-testing/tools/ioemu/block.c =================================================================== --- xen-3.2.1-testing.orig/tools/ioemu/block.c +++ xen-3.2.1-testing/tools/ioemu/block.c -@@ -583,6 +583,9 @@ int bdrv_write(BlockDriverState *bs, int +@@ -587,6 +587,9 @@ int bdrv_write(BlockDriverState *bs, int else return 0; } else { diff --git a/sysconfig.xend b/sysconfig.xend deleted file mode 100644 index 34135df..0000000 --- a/sysconfig.xend +++ /dev/null @@ -1,142 +0,0 @@ -#============================================================================ -# /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() -## Default: "" -## Config: -# -# Space delimited list of network types, physical/virtual network -# 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, 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,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,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 v3.x only -# -NETWORK_LIST="bridge,0,default,default,dhcp-off hostonly,0,none,172.23.0.1/16,dhcp-off" - -## Type: string(eth0,eth1,eth2,eth3) -## Default: "eth0" -## Config: -# -# Network interface to use as the external interface for NATed -# and Routed networks. -# -# If set to 'default" it will use the same interface used for the -# default route -# -NAT_EXTERNAL_INTERFACE="default" - -## Type: string(128-249) -## Default: "128-249" -## Config: -# -# IP address range for the dhcp server. These should be the -# beginning and ending addresses from the last octet of the -# IP address -# -XEN_DHCP_RANGE="128-249" - -## Type: string(10.0.0.1,10.0.0.2) -## Default: "gateway" -## Config: -# -# IP address(es) of DNS servers for the dhcp server to give out. -# If set to "gateway" then the IP address of the gateway will be -# set as the DNS server. -# -# Examples: "10.0.0.1,10.0.0.2" -# "gateway" -# -XEN_DHCP_DNS_SERVERS="gateway" - -## Type: boolean -## Default: "false" -## Config: -# -# If set to true the xend-relocation script will enable/disable -# the vm migration feature of xend.. -# -ENABLE_RELOCATION="false" - -## Type: list() -## Default: "any" -## Config: -# -# Space delimited list of IP addresses/host names of machines -# that xen will accept vm migrations from. If set to 'any' -# xen will accept vm migrations from any host -# -# Example: "10.0.0.1 10.0.0.2" would allow relocation to/from thos IPs -# Example: "any" would allow reloaction to/from any host -# -RELOCATION_NODELIST="any" - -## Type: boolean -## Default: "false" -## Config: -# -# If set to true the xend-relocation script will attempt to -# enable/disable vm migration on all relocation nodes listed -# in the RELOCATION_NODELIST variable. -# -# Note: Communication with the nodes is done via ssh so -# pre-distributed ssh keys is recommended. -# -MANAGE_ALL_RELOCATION_NODES="false" - -## Type: integer -## Default: "8002" -## Config: -# -# The TCP port used by Xen for VM relocation -# -XEN_RELOCATION_PORT="8002" diff --git a/vpid-novell-i386.patch b/vpid-novell-i386.patch index 969823c..9391bb3 100644 --- a/vpid-novell-i386.patch +++ b/vpid-novell-i386.patch @@ -12,7 +12,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c /* Dynamic (run-time adjusted) execution control flags. */ u32 vmx_pin_based_exec_control __read_mostly; u32 vmx_cpu_based_exec_control __read_mostly; -@@ -110,6 +113,8 @@ static void vmx_init_vmcs_config(void) +@@ -112,6 +115,8 @@ static void vmx_init_vmcs_config(void) opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | SECONDARY_EXEC_WBINVD_EXITING | SECONDARY_EXEC_ENABLE_EPT; @@ -21,7 +21,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c _vmx_secondary_exec_control = adjust_vmx_controls( min2, opt2, MSR_IA32_VMX_PROCBASED_CTLS2); -@@ -315,6 +320,8 @@ int vmx_cpu_up(void) +@@ -317,6 +322,8 @@ int vmx_cpu_up(void) ept_sync_all(); @@ -30,7 +30,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c return 1; } -@@ -628,6 +635,13 @@ static int construct_vmcs(struct vcpu *v +@@ -630,6 +637,13 @@ static int construct_vmcs(struct vcpu *v #endif } @@ -44,7 +44,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c vmx_vmcs_exit(v); paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */ -@@ -821,6 +835,7 @@ void vmx_do_resume(struct vcpu *v) +@@ -823,6 +837,7 @@ void vmx_do_resume(struct vcpu *v) vmx_load_vmcs(v); hvm_migrate_timers(v); vmx_set_host_env(v); @@ -52,7 +52,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c } debug_state = v->domain->debugger_attached; -@@ -975,6 +990,8 @@ void vmcs_dump_vcpu(struct vcpu *v) +@@ -977,6 +992,8 @@ void vmcs_dump_vcpu(struct vcpu *v) (uint32_t)vmr(TPR_THRESHOLD)); printk("EPT pointer = 0x%08x%08x\n", (uint32_t)vmr(EPT_POINTER_HIGH), (uint32_t)vmr(EPT_POINTER)); diff --git a/vpid-novell-x64.patch b/vpid-novell-x64.patch index f7b7e77..ff4b97b 100644 --- a/vpid-novell-x64.patch +++ b/vpid-novell-x64.patch @@ -12,7 +12,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c /* Dynamic (run-time adjusted) execution control flags. */ u32 vmx_pin_based_exec_control __read_mostly; u32 vmx_cpu_based_exec_control __read_mostly; -@@ -110,6 +113,8 @@ static void vmx_init_vmcs_config(void) +@@ -112,6 +115,8 @@ static void vmx_init_vmcs_config(void) opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | SECONDARY_EXEC_WBINVD_EXITING | SECONDARY_EXEC_ENABLE_EPT; @@ -21,7 +21,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c _vmx_secondary_exec_control = adjust_vmx_controls( min2, opt2, MSR_IA32_VMX_PROCBASED_CTLS2); -@@ -315,6 +320,8 @@ int vmx_cpu_up(void) +@@ -317,6 +322,8 @@ int vmx_cpu_up(void) ept_sync_all(); @@ -30,7 +30,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c return 1; } -@@ -628,6 +635,13 @@ static int construct_vmcs(struct vcpu *v +@@ -630,6 +637,13 @@ static int construct_vmcs(struct vcpu *v #endif } @@ -44,7 +44,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c vmx_vmcs_exit(v); paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */ -@@ -821,6 +835,7 @@ void vmx_do_resume(struct vcpu *v) +@@ -823,6 +837,7 @@ void vmx_do_resume(struct vcpu *v) vmx_load_vmcs(v); hvm_migrate_timers(v); vmx_set_host_env(v); @@ -52,7 +52,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vmcs.c } debug_state = v->domain->debugger_attached; -@@ -975,6 +990,8 @@ void vmcs_dump_vcpu(struct vcpu *v) +@@ -977,6 +992,8 @@ void vmcs_dump_vcpu(struct vcpu *v) (uint32_t)vmr(TPR_THRESHOLD)); printk("EPT pointer = 0x%08x%08x\n", (uint32_t)vmr(EPT_POINTER_HIGH), (uint32_t)vmr(EPT_POINTER)); diff --git a/vtd-fix.patch b/vtd-fix.patch new file mode 100644 index 0000000..b083299 --- /dev/null +++ b/vtd-fix.patch @@ -0,0 +1,80 @@ +Index: xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c +=================================================================== +--- xen-3.2.1-testing.orig/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c ++++ xen-3.2.1-testing/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include "dmar.h" +@@ -1900,6 +1901,45 @@ void iommu_set_pgd(struct domain *d) + } + p2m_table = mfn_x(pagetable_get_mfn(d->arch.phys_table)); + ++ if ( paging_mode_hap(d) ) ++ { ++ if ( !hd->pgd ) ++ { ++ int level = agaw_to_level(hd->agaw); ++ struct dma_pte *dpte = NULL; ++ mfn_t pgd_mfn; ++ ++ switch ( level ) ++ { ++ case VTD_PAGE_TABLE_LEVEL_3: ++ dpte = map_domain_page(p2m_table); ++ if ( !dma_pte_present(*dpte) ) ++ { ++ gdprintk(XENLOG_ERR VTDPREFIX, ++ "iommu_set_pgd: second level wasn't there\n"); ++ unmap_domain_page(dpte); ++ return; ++ } ++ pgd_mfn = _mfn(dma_pte_addr(*dpte) >> PAGE_SHIFT_4K); ++ unmap_domain_page(dpte); ++ hd->pgd = maddr_to_virt(pagetable_get_paddr( ++ pagetable_from_mfn(pgd_mfn))); ++ break; ++ ++ case VTD_PAGE_TABLE_LEVEL_4: ++ pgd_mfn = _mfn(p2m_table); ++ hd->pgd = maddr_to_virt(pagetable_get_paddr( ++ pagetable_from_mfn(pgd_mfn))); ++ break; ++ default: ++ gdprintk(XENLOG_ERR VTDPREFIX, ++ "iommu_set_pgd:Unsupported p2m table sharing level!\n"); ++ break; ++ } ++ } ++ } ++ else ++ { + #if CONFIG_PAGING_LEVELS == 3 + if ( !hd->pgd ) + { +@@ -2005,6 +2045,7 @@ void iommu_set_pgd(struct domain *d) + } + } + #endif ++ } + gdprintk(XENLOG_INFO VTDPREFIX, + "iommu_set_pgd: hd->pgd = %p\n", hd->pgd); + } +Index: xen-3.2.1-testing/xen/arch/x86/mm/p2m-ept.c +=================================================================== +--- xen-3.2.1-testing.orig/xen/arch/x86/mm/p2m-ept.c ++++ xen-3.2.1-testing/xen/arch/x86/mm/p2m-ept.c +@@ -157,6 +157,9 @@ ept_set_entry(struct domain *d, unsigned + else + ept_entry->epte = 0; + ++ if ( vtd_enabled && (p2mt == p2m_mmio_direct) && is_hvm_domain(d) ) ++ iommu_flush(d, gfn, (u64 *)ept_entry); ++ + /* Success */ + rv = 1; + diff --git a/x86_emulate.patch b/x86_emulate.patch index 3ff7467..a844329 100644 --- a/x86_emulate.patch +++ b/x86_emulate.patch @@ -133,7 +133,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/x86_emulate.c =================================================================== --- xen-3.2.1-testing.orig/xen/arch/x86/x86_emulate.c +++ xen-3.2.1-testing/xen/arch/x86/x86_emulate.c -@@ -30,7 +30,10 @@ +@@ -31,7 +31,10 @@ #include #include #include @@ -144,7 +144,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/x86_emulate.c #endif #include -@@ -3320,60 +3323,64 @@ x86_emulate( +@@ -3321,60 +3324,64 @@ x86_emulate( src.val = x86_seg_gs; goto pop_seg; @@ -253,7 +253,7 @@ Index: xen-3.2.1-testing/xen/arch/x86/x86_emulate.c case 0xc8 ... 0xcf: /* bswap */ dst.type = OP_REG; -@@ -3383,7 +3390,7 @@ x86_emulate( +@@ -3384,7 +3391,7 @@ x86_emulate( { default: /* case 2: */ /* Undefined behaviour. Writes zero on all tested CPUs. */ diff --git a/xen-3.2.1-testing-src.tar.bz2 b/xen-3.2.1-testing-src.tar.bz2 index 9aa82d9..57131d0 100644 --- a/xen-3.2.1-testing-src.tar.bz2 +++ b/xen-3.2.1-testing-src.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b76bdbe8d7703cef1c7498bbdfc73f8b178ebafb737ddbdf352a76144c8d6e2b -size 5468802 +oid sha256:b2ad468418ca46e89646e16047e70312c7d7082997919435ee04afba26970f39 +size 5470154 diff --git a/xen-domUloader.diff b/xen-domUloader.diff index b499168..671b426 100644 --- a/xen-domUloader.diff +++ b/xen-domUloader.diff @@ -158,7 +158,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py def _waitForDevice_destroy(self, deviceClass, devid, backpath): return self.getDeviceController(deviceClass).waitForDevice_destroy( devid, backpath) -@@ -2091,8 +2095,11 @@ class XendDomainInfo: +@@ -2098,8 +2102,11 @@ class XendDomainInfo: blexec = osdep.pygrub_path blcfg = None @@ -172,7 +172,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py if not disks: msg = "Had a bootloader specified, but no disks are bootable" -@@ -2103,13 +2110,10 @@ class XendDomainInfo: +@@ -2110,13 +2117,10 @@ class XendDomainInfo: devtype = devinfo[0] disk = devinfo[1]['uname'] @@ -189,7 +189,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py log.info("Mounting %s on %s." % (fn, BOOTLOADER_LOOPBACK_DEVICE)) -@@ -2121,7 +2125,9 @@ class XendDomainInfo: +@@ -2128,7 +2132,9 @@ class XendDomainInfo: from xen.xend import XendDomain dom0 = XendDomain.instance().privilegedDomain() @@ -200,7 +200,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py fn = BOOTLOADER_LOOPBACK_DEVICE try: -@@ -2132,7 +2138,7 @@ class XendDomainInfo: +@@ -2139,7 +2145,7 @@ class XendDomainInfo: log.info("Unmounting %s from %s." % (fn, BOOTLOADER_LOOPBACK_DEVICE)) diff --git a/xen-ioemu-hvm-pv-support.diff b/xen-ioemu-hvm-pv-support.diff index 108d28d..cad84bc 100644 --- a/xen-ioemu-hvm-pv-support.diff +++ b/xen-ioemu-hvm-pv-support.diff @@ -12,7 +12,7 @@ Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c #if defined(__ia64__) #include -@@ -2248,6 +2251,27 @@ static void ide_reset(IDEState *s) +@@ -2288,6 +2291,27 @@ static void ide_reset(IDEState *s) ide_dummy_transfer_stop(s); } @@ -40,7 +40,7 @@ Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c struct partition { uint8_t boot_ind; /* 0x80 - active */ uint8_t head; /* starting head */ -@@ -2649,6 +2673,9 @@ void pci_cmd646_ide_init(PCIBus *bus, Bl +@@ -2689,6 +2713,9 @@ void pci_cmd646_ide_init(PCIBus *bus, Bl sizeof(PCIIDEState), -1, NULL, NULL); @@ -50,7 +50,7 @@ Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c d->type = IDE_TYPE_CMD646; pci_conf = d->dev.config; pci_conf[0x00] = 0x95; // CMD646 -@@ -2823,6 +2850,9 @@ void pci_piix_ide_init(PCIBus *bus, Bloc +@@ -2863,6 +2890,9 @@ void pci_piix_ide_init(PCIBus *bus, Bloc NULL, NULL); d->type = IDE_TYPE_PIIX3; @@ -60,7 +60,7 @@ Index: xen-3.2.1-testing/tools/ioemu/hw/ide.c pci_conf = d->dev.config; pci_conf[0x00] = 0x86; // Intel pci_conf[0x01] = 0x80; -@@ -2869,6 +2899,9 @@ void pci_piix3_ide_init(PCIBus *bus, Blo +@@ -2909,6 +2939,9 @@ void pci_piix3_ide_init(PCIBus *bus, Blo NULL, NULL); d->type = IDE_TYPE_PIIX3; @@ -266,7 +266,7 @@ Index: xen-3.2.1-testing/tools/ioemu/vl.h =================================================================== --- xen-3.2.1-testing.orig/tools/ioemu/vl.h +++ xen-3.2.1-testing/tools/ioemu/vl.h -@@ -1499,6 +1499,8 @@ void kqemu_record_dump(void); +@@ -1501,6 +1501,8 @@ void kqemu_record_dump(void); extern char domain_name[]; void destroy_hvm_domain(void); diff --git a/xen-qcow-realpath-buffer-overflow.patch b/xen-qcow-realpath-buffer-overflow.patch deleted file mode 100644 index fd1e978..0000000 --- a/xen-qcow-realpath-buffer-overflow.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: xen-3.2-testing/tools/blktap/drivers/block-qcow.c -=================================================================== ---- xen-3.2-testing.orig/tools/blktap/drivers/block-qcow.c -+++ xen-3.2-testing/tools/blktap/drivers/block-qcow.c -@@ -1223,7 +1223,7 @@ int qcow_create(const char *filename, ui - int shift, length, adjust, flags = 0, ret = 0; - QCowHeader header; - QCowHeader_ext exthdr; -- char backing_filename[1024], *ptr; -+ char backing_filename[PATH_MAX], *ptr; - uint64_t tmp, size, total_length; - struct stat st; - diff --git a/xen-qemu-iscsi-fix.patch b/xen-qemu-iscsi-fix.patch new file mode 100644 index 0000000..1eea374 --- /dev/null +++ b/xen-qemu-iscsi-fix.patch @@ -0,0 +1,62 @@ +Index: xen-3.2.1-testing/tools/ioemu/xenstore.c +=================================================================== +--- xen-3.2.1-testing.orig/tools/ioemu/xenstore.c ++++ xen-3.2.1-testing/tools/ioemu/xenstore.c +@@ -91,6 +91,7 @@ void xenstore_parse_domain_config(int do + char *fpath = NULL, *bpath = NULL, *btype = NULL, + *dev = NULL, *params = NULL, *type = NULL, *drv = NULL; + int i, is_scsi, is_tap, is_hdN = 0; ++ int j; + unsigned int len, num, hd_index; + BlockDriverState *bs; + +@@ -173,12 +174,7 @@ void xenstore_parse_domain_config(int do + continue; + free(type); + type = xs_read(xsh, XBT_NULL, buf, &len); +- if (pasprintf(&buf, "%s/params", bpath) == -1) +- continue; +- free(params); +- params = xs_read(xsh, XBT_NULL, buf, &len); +- if (params == NULL) +- continue; ++ + /* read the name of the device */ + if (pasprintf(&buf, "%s/type", bpath) == -1) + continue; +@@ -186,6 +182,35 @@ void xenstore_parse_domain_config(int do + drv = xs_read(xsh, XBT_NULL, buf, &len); + if (drv == NULL) + continue; ++ ++ free(params); ++ if (!strcmp(drv,"iscsi")) ++ { ++ if (pasprintf(&buf, "%s/node", bpath) == -1) ++ continue; ++ ++ /* wait for block-iscsi script to complete and populate the ++ * node entry. try 30 times (30 secs) */ ++ for (j = 0; j < 30; j++) { ++ params = xs_read(xsh, XBT_NULL, buf, &len); ++ if (params != NULL) ++ break; ++ sleep(1); ++ } ++ if (params == NULL) { ++ fprintf(stderr, "qemu: iscsi device not found -- timed out \n"); ++ continue; ++ } ++ } ++ else ++ { ++ if (pasprintf(&buf, "%s/params", bpath) == -1) ++ continue; ++ params = xs_read(xsh, XBT_NULL, buf, &len); ++ if (params == NULL) ++ continue; ++ } ++ + /* Strip off blktap sub-type prefix aio: - QEMU can autodetect this */ + if (!strcmp(drv, "tap") && params[0]) { + char *offset = strchr(params, ':'); diff --git a/xen.changes b/xen.changes index 6e2c86f..16bcdea 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Apr 11 08:38:21 MDT 2008 - carnold@novell.com + +- Update to Xen 3.2.1 RC5 changeset 16864. + +------------------------------------------------------------------- +Thu Apr 10 17:32:15 MDT 2008 - jfehlig@novell.com + +- bnc#378595 - Do not use ifup/ifdown in network-bridge for now. + ------------------------------------------------------------------- Mon Mar 24 16:47:56 MDT 2008 - carnold@novell.com diff --git a/xen.spec b/xen.spec index 690cd6b..9ec0069 100644 --- a/xen.spec +++ b/xen.spec @@ -1,5 +1,5 @@ # -# spec file for package xen (Version 3.2.1_16820_01) +# spec file for package xen (Version 3.2.1_16864_01) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -14,7 +14,7 @@ Name: xen %define xvers 3.2 %define xvermaj 3 -%define changeset 16820 +%define changeset 16864 %define xen_build_dir xen-3.2.1-testing %if %sles_version %define with_kmp 1 @@ -33,7 +33,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.1_16820_01 +Version: 3.2.1_16864_01 Release: 1 License: GPL v2 only Group: System/Kernel @@ -55,40 +55,41 @@ Source12: block-iscsi Source13: block-npiv Source16: xmclone.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 +Source18: init.xen_loop # Xen API remote authentication sources Source23: etc_pam.d_xen-api Source24: xenapiusers # Upstream patches Patch0: 16716-xend-version.patch Patch1: 16718-batched-mmu-updates.patch -Patch2: 16769-pci-high-memory-resource.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 -Patch10: 16931-hvm-hap-param.patch -Patch11: 16933-hvm-hap-fix.patch -Patch12: 16939-hvm-hap-fix.patch -Patch13: 16947-fvmachine-xenstore.patch -Patch14: 16977-xend-restart-count.patch -Patch15: 16989-xend-coredump.patch -Patch16: 17017-hpet-configuration.patch -Patch17: 17124-numa-free-memory-size.patch -Patch18: 17131-numa-set-vcpu-affinity.patch -Patch19: 17190-remove-hap-boot-param.patch -Patch20: 17191-remove-hap-boot-param-doc.patch -Patch21: 17210-xenapi-defaults.patch -Patch22: 17211-xenapi-defaults.patch -Patch23: 17212-xenapi-defaults.patch +Patch2: 16740-suse-ifup.patch +Patch3: 16769-pci-high-memory-resource.patch +Patch4: 16873-net-nat.patch +Patch5: 16877-blktap.patch +Patch6: 16883-xend-crashed-state.patch +Patch7: 16884-xend-rename-restart.patch +Patch8: 16885-xend-config-comments.patch +Patch9: 16886-xenstore-leak.patch +Patch10: 16890-xenapi-version.patch +Patch11: 16931-hvm-hap-param.patch +Patch12: 16933-hvm-hap-fix.patch +Patch13: 16939-hvm-hap-fix.patch +Patch14: 16947-fvmachine-xenstore.patch +Patch15: 16977-xend-restart-count.patch +Patch16: 16989-xend-coredump.patch +Patch17: 17006-make-aio-optional.patch +Patch18: 17017-hpet-configuration.patch +Patch19: 17124-numa-free-memory-size.patch +Patch20: 17131-numa-set-vcpu-affinity.patch +Patch21: 17190-remove-hap-boot-param.patch +Patch22: 17191-remove-hap-boot-param-doc.patch +Patch23: 17209-xentop.patch +Patch24: 17210-xenapi-defaults.patch +Patch25: 17211-xenapi-defaults.patch +Patch26: 17212-xenapi-defaults.patch +Patch27: 17246-numa-node-selection-fix.patch +Patch28: 17248-hvm-ignore-USB-RMRR.patch +Patch29: 17315-windows-bug-check-0x101-fix.patch # Our patches Patch100: xen-config.diff Patch101: xend-config.diff @@ -124,28 +125,29 @@ Patch137: qemu-security-etch1.diff Patch138: vnc-i18n-keys.diff Patch139: rpmlint.diff Patch140: cdrom-removable.patch -Patch150: bridge-suse.diff -Patch151: bridge-bonding.diff -Patch152: bridge-hostonly.diff -Patch153: bridge-vlan.diff -Patch154: keymap_nl-be.patch -Patch155: xen-fbback-resize.patch -Patch156: xend-core-dump-loc.diff -Patch157: blktap.patch -Patch158: xen-qcow-realpath-buffer-overflow.patch +Patch150: bridge-opensuse-11_0-temp.patch +Patch151: bridge-vlan.diff +Patch152: bridge-bonding.diff +Patch153: bridge-hostonly.diff +Patch154: bridge-record-creation.patch +Patch155: keymap_nl-be.patch +Patch156: xen-fbback-resize.patch +Patch157: xend-core-dump-loc.diff +Patch158: blktap.patch Patch159: xen-api-auth.patch Patch160: pv_32_16_color_trans.patch Patch161: hvm-ide-flush-o_direct.patch -Patch162: migration-cpl-init.patch +Patch162: keymap-vm.patch +Patch163: xen-qemu-iscsi-fix.patch +Patch164: key-shift-escape.patch # Patches from Jan Patch240: xenctx.patch Patch241: const-callback-arg.patch Patch242: const-set-trap-table-arg.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 +Patch243: pv-drv-mkbuildtree.patch +Patch244: x86_emulate.patch +Patch245: x86-extra-trap-info.patch +Patch246: 32on64-extra-mem.patch # PV Driver Patches Patch350: pv-driver-build.patch Patch351: xen-ioemu-hvm-pv-support.diff @@ -163,6 +165,8 @@ Patch504: ept-novell-i386.patch Patch505: vpid-novell-i386.patch Patch506: livemig-ept-novell-i386.patch Patch507: ept-livemgr-x86-miss.patch +Patch508: vtd-fix.patch +Patch509: ept-supported-fix.patch Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ BuildRoot: %{_tmppath}/%{name}-%{version}-build %define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()") @@ -225,6 +229,7 @@ Authors: ... %package libs +License: GPL v2 or later Summary: Xen Virtualization: Libraries Group: System/Kernel Requires: xen = %{version} @@ -274,6 +279,7 @@ Authors: Ian Pratt %package tools +License: GPL v2 or later Summary: Xen Virtualization: Control tools for domain 0 Group: System/Kernel Requires: xen-libs = %{version} @@ -331,6 +337,7 @@ Authors: Ian Pratt %package tools-domU +License: GPL v2 or later Summary: Xen Virtualization: Control tools for domain U Group: System/Kernel Conflicts: xen-tools @@ -351,6 +358,7 @@ Authors: Ian Pratt %package devel +License: GPL v2 or later Summary: Xen Virtualization: Headers and libraries for development Group: System/Kernel Requires: xen-libs = %{version} @@ -401,6 +409,7 @@ Authors: %if %{?with_kmp}0 %package KMP +License: GPL v2 or later Group: System/Kernel Summary: Xen para-virtual device drivers for fully virtualized guests @@ -448,6 +457,7 @@ Xen, but is not available for release due to license restrictions. %endif %package doc-html +License: GPL v2 or later Summary: Xen Virtualization: HTML documentation Group: Documentation/HTML @@ -466,6 +476,7 @@ Authors: Ian Pratt %package doc-pdf +License: GPL v2 or later Summary: Xen Virtualization: PDF documentation Group: Documentation/Other @@ -510,6 +521,12 @@ Authors: %patch21 -p1 %patch22 -p1 %patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 %patch100 -p1 %patch101 -p1 %patch102 -p1 @@ -545,9 +562,9 @@ Authors: %patch139 -p1 %patch140 -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 -#%patch153 -p1 # dump if all goes well with defaulting to network-multinet +%patch151 -p1 +%patch152 -p1 +#%patch153 -p1 %patch154 -p1 %patch155 -p1 %patch156 -p1 @@ -556,7 +573,9 @@ Authors: %patch159 -p1 %patch160 -p1 #%patch161 -p1 -#%patch162 -p1 +%patch162 -p1 +%patch163 -p1 +%patch164 -p1 %patch240 -p1 %patch241 -p1 %patch242 -p1 @@ -564,7 +583,6 @@ Authors: %patch244 -p1 %patch245 -p1 %patch246 -p1 -%patch247 -p1 %patch350 -p1 %patch351 -p1 %patch352 -p1 @@ -582,6 +600,8 @@ Authors: %patch506 -p1 %patch507 -p1 %endif +%patch508 -p1 +%patch509 -p1 %build XEN_EXTRAVERSION=%version-%release @@ -682,21 +702,16 @@ install %SOURCE5 $RPM_BUILD_ROOT/etc/init.d/xend ln -s /etc/init.d/xend $RPM_BUILD_ROOT/usr/sbin/rcxend install %SOURCE6 $RPM_BUILD_ROOT/etc/init.d/xendomains ln -s /etc/init.d/xendomains $RPM_BUILD_ROOT/usr/sbin/rcxendomains +mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d +install -m644 %SOURCE18 $RPM_BUILD_ROOT/etc/modprobe.d/xen_loop # example config 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 %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 %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/ # Xen API remote authentication files install -d $RPM_BUILD_ROOT/etc/pam.d install -m644 %SOURCE23 $RPM_BUILD_ROOT/etc/pam.d/xen-api @@ -809,6 +824,8 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info %config /etc/xen/*.xml %config(noreplace) /etc/xen/xenapiusers %config /etc/pam.d/xen-api +%config /etc/modprobe.d/xen_loop +%dir /etc/modprobe.d %dir /etc/udev %dir /etc/udev/rules.d /etc/udev/rules.d/40-xen.rules @@ -888,6 +905,10 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info /sbin/ldconfig %changelog +* Fri Apr 11 2008 carnold@novell.com +- Update to Xen 3.2.1 RC5 changeset 16864. +* Thu Apr 10 2008 jfehlig@novell.com +- bnc#378595 - Do not use ifup/ifdown in network-bridge for now. * Mon Mar 24 2008 carnold@novell.com - bnc#373194 - The xen module and the kernel for Dom0 don't match. - Add ncurses-devel build dependency diff --git a/xenapi-console-protocol.patch b/xenapi-console-protocol.patch index 2528dfe..fa3e79e 100644 --- a/xenapi-console-protocol.patch +++ b/xenapi-console-protocol.patch @@ -2,7 +2,7 @@ Index: xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py =================================================================== --- xen-3.2.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py +++ xen-3.2.1-testing/tools/python/xen/xend/XendDomainInfo.py -@@ -2773,6 +2773,14 @@ class XendDomainInfo: +@@ -2780,6 +2780,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 b60112c..e1e9c1e 100644 --- a/xend-config.diff +++ b/xend-config.diff @@ -1,7 +1,7 @@ -Index: xen-3.2-testing/tools/examples/init.d/sysconfig.xendomains +Index: xen-3.2.1-testing/tools/examples/init.d/sysconfig.xendomains =================================================================== ---- xen-3.2-testing.orig/tools/examples/init.d/sysconfig.xendomains -+++ xen-3.2-testing/tools/examples/init.d/sysconfig.xendomains +--- xen-3.2.1-testing.orig/tools/examples/init.d/sysconfig.xendomains ++++ xen-3.2.1-testing/tools/examples/init.d/sysconfig.xendomains @@ -1,4 +1,4 @@ -## Path: System/xen +## Path: System/Virtualization @@ -27,10 +27,10 @@ Index: xen-3.2-testing/tools/examples/init.d/sysconfig.xendomains ## Type: integer ## Default: 300 -Index: xen-3.2-testing/tools/examples/xend-config.sxp +Index: xen-3.2.1-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 +--- xen-3.2.1-testing.orig/tools/examples/xend-config.sxp ++++ xen-3.2.1-testing/tools/examples/xend-config.sxp @@ -49,16 +49,19 @@ # # (9367 pam '' /etc/xen/xen-api.key /etc/xen/xen-api.crt) @@ -55,63 +55,7 @@ Index: xen-3.2-testing/tools/examples/xend-config.sxp #(xend-unix-path /var/lib/xend/xend-socket) -@@ -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. - # --(network-script network-bridge) -+#(network-script network-bridge) -+ -+# network-multinet is a replacement for the Xen network-bridge, network-nat -+# and network-route scripts. network-multinet allows for the creation of -+# multiple networks, supporting the following types: -+# -+# -+# 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 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 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 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 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 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. -+# -+(network-script network-multinet) - - # The script used to control virtual interfaces. This can be overridden on a - # per-vif basis when creating a domain or a configuring a new vif. The -@@ -169,7 +219,7 @@ +@@ -169,7 +172,7 @@ # Dom0 will balloon out when needed to free memory for domU. # dom0-min-mem is the lowest memory level (in MB) dom0 will get down to. # If dom0-min-mem=0, dom0 will never balloon out. diff --git a/xend-network b/xend-network deleted file mode 100644 index 881cba7..0000000 --- a/xend-network +++ /dev/null @@ -1,514 +0,0 @@ -#!/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