OBS User unknown 2009-06-12 18:43:24 +00:00 committed by Git OBS Bridge
parent 0bb51565d6
commit 5be0f1bcb4
25 changed files with 466 additions and 131 deletions

View File

@ -2,7 +2,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2559,7 +2559,7 @@ class XendDomainInfo:
@@ -2560,7 +2560,7 @@ class XendDomainInfo:
vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
# Make sure there's enough RAM available for the domain

126
bdrv_open2_fix_flags.patch Normal file
View File

@ -0,0 +1,126 @@
diff -uNrp xen-3.4.0-testing.orig/tools/ioemu-remote/block.c xen-3.4.0-testing/tools/ioemu-remote/block.c
--- xen-3.4.0-testing.orig/tools/ioemu-remote/block.c 2009-06-09 14:02:11.000000000 +0800
+++ xen-3.4.0-testing/tools/ioemu-remote/block.c 2009-06-09 14:07:40.000000000 +0800
@@ -347,7 +347,7 @@ int bdrv_file_open(BlockDriverState **pb
int bdrv_open(BlockDriverState *bs, const char *filename, int flags)
{
- return bdrv_open2(bs, filename, flags, NULL);
+ return bdrv_open2(bs, filename, flags|BDRV_O_RDWR, NULL);
}
int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
@@ -416,12 +416,13 @@ int bdrv_open2(BlockDriverState *bs, con
}
bs->drv = drv;
bs->opaque = qemu_mallocz(drv->instance_size);
- /* Note: for compatibility, we open disk image files as RDWR, and
- RDONLY as fallback */
if (!(flags & BDRV_O_FILE))
- open_flags = BDRV_O_RDWR | (flags & BDRV_O_CACHE_MASK);
+ open_flags = flags & BDRV_O_CACHE_MASK;
else
open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
+ if (!(open_flags & BDRV_O_RDWR))
+ bs->read_only = 1;
+
ret = drv->bdrv_open(bs, filename, open_flags);
if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR);
diff -uNrp xen-3.4.0-testing.orig/tools/ioemu-remote/hw/usb-msd.c xen-3.4.0-testing/tools/ioemu-remote/hw/usb-msd.c
--- xen-3.4.0-testing.orig/tools/ioemu-remote/hw/usb-msd.c 2009-06-09 14:02:11.000000000 +0800
+++ xen-3.4.0-testing/tools/ioemu-remote/hw/usb-msd.c 2009-06-09 14:06:50.000000000 +0800
@@ -551,7 +551,7 @@ USBDevice *usb_msd_init(const char *file
s = qemu_mallocz(sizeof(MSDState));
bdrv = bdrv_new("usb");
- if (bdrv_open2(bdrv, filename, 0, drv) < 0)
+ if (bdrv_open2(bdrv, filename, BDRV_O_RDWR, drv) < 0)
goto fail;
s->bs = bdrv;
*pbs = bdrv;
diff -uNrp xen-3.4.0-testing.orig/tools/ioemu-remote/qemu-img.c xen-3.4.0-testing/tools/ioemu-remote/qemu-img.c
--- xen-3.4.0-testing.orig/tools/ioemu-remote/qemu-img.c 2009-06-09 14:02:11.000000000 +0800
+++ xen-3.4.0-testing/tools/ioemu-remote/qemu-img.c 2009-06-09 14:06:32.000000000 +0800
@@ -32,7 +32,7 @@
#endif
/* Default to cache=writeback as data integrity is not important for qemu-tcg. */
-#define BRDV_O_FLAGS BDRV_O_CACHE_WB
+#define BDRV_O_FLAGS BDRV_O_CACHE_WB
static void QEMU_NORETURN error(const char *fmt, ...)
{
@@ -185,7 +185,7 @@ static int read_password(char *buf, int
#endif
static BlockDriverState *bdrv_new_open(const char *filename,
- const char *fmt)
+ const char *fmt, int flags)
{
BlockDriverState *bs;
BlockDriver *drv;
@@ -201,7 +201,7 @@ static BlockDriverState *bdrv_new_open(c
} else {
drv = &bdrv_raw;
}
- if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
+ if (bdrv_open2(bs, filename, flags, drv) < 0) {
error("Could not open '%s'", filename);
}
if (bdrv_is_encrypted(bs)) {
@@ -253,7 +253,7 @@ static int img_create(int argc, char **a
size = 0;
if (base_filename) {
BlockDriverState *bs;
- bs = bdrv_new_open(base_filename, NULL);
+ bs = bdrv_new_open(base_filename, NULL, BDRV_O_RDWR);
bdrv_get_geometry(bs, &size);
size *= 512;
bdrv_delete(bs);
@@ -332,7 +332,7 @@ static int img_commit(int argc, char **a
} else {
drv = NULL;
}
- if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
+ if (bdrv_open2(bs, filename, BDRV_O_RDWR, drv) < 0) {
error("Could not open '%s'", filename);
}
ret = bdrv_commit(bs);
@@ -455,7 +455,8 @@ static int img_convert(int argc, char **
total_sectors = 0;
for (bs_i = 0; bs_i < bs_n; bs_i++) {
- bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt);
+ bs[bs_i] = bdrv_new_open(argv[optind + bs_i], fmt,
+ BDRV_O_CACHE_WB|BDRV_O_RDONLY);
if (!bs[bs_i])
error("Could not open '%s'", argv[optind + bs_i]);
bdrv_get_geometry(bs[bs_i], &bs_sectors);
@@ -483,7 +484,7 @@ static int img_convert(int argc, char **
}
}
- out_bs = bdrv_new_open(out_filename, out_fmt);
+ out_bs = bdrv_new_open(out_filename, out_fmt, BDRV_O_CACHE_WB|BDRV_O_RDWR);
bs_i = 0;
bs_offset = 0;
@@ -706,7 +707,7 @@ static int img_info(int argc, char **arg
} else {
drv = NULL;
}
- if (bdrv_open2(bs, filename, BRDV_O_FLAGS, drv) < 0) {
+ if (bdrv_open2(bs, filename, BDRV_O_FLAGS|BDRV_O_RDWR, drv) < 0) {
error("Could not open '%s'", filename);
}
bdrv_get_format(bs, fmt_name, sizeof(fmt_name));
@@ -810,7 +811,7 @@ static void img_snapshot(int argc, char
if (!bs)
error("Not enough memory");
- if (bdrv_open2(bs, filename, 0, NULL) < 0) {
+ if (bdrv_open2(bs, filename, BDRV_O_RDWR, NULL) < 0) {
error("Could not open '%s'", filename);
}

91
bdrv_open2_flags_2.patch Normal file
View File

@ -0,0 +1,91 @@
diff -uNrp xen-3.4.0-testing.orig.2/tools/ioemu-remote/hw/xen_blktap.c xen-3.4.0-testing/tools/ioemu-remote/hw/xen_blktap.c
--- xen-3.4.0-testing.orig.2/tools/ioemu-remote/hw/xen_blktap.c 2009-06-09 14:08:58.000000000 +0800
+++ xen-3.4.0-testing/tools/ioemu-remote/hw/xen_blktap.c 2009-06-09 14:09:08.000000000 +0800
@@ -227,6 +227,7 @@ static int open_disk(struct td_state *s,
BlockDriver* drv;
char* devname;
static int devnumber = 0;
+ int flags = readonly ? BDRV_O_RDONLY : BDRV_O_RDWR;
int i;
DPRINTF("Opening %s as blktap%d\n", path, devnumber);
@@ -249,7 +250,7 @@ static int open_disk(struct td_state *s,
DPRINTF("%s driver specified\n", drv ? drv->format_name : "No");
/* Open the image */
- if (bdrv_open2(bs, path, 0, drv) != 0) {
+ if (bdrv_open2(bs, path, flags, drv) != 0) {
fprintf(stderr, "Could not open image file %s\n", path);
return -ENOMEM;
}
diff -uNrp xen-3.4.0-testing.orig.2/tools/ioemu-remote/xenstore.c xen-3.4.0-testing/tools/ioemu-remote/xenstore.c
--- xen-3.4.0-testing.orig.2/tools/ioemu-remote/xenstore.c 2009-06-09 14:08:58.000000000 +0800
+++ xen-3.4.0-testing/tools/ioemu-remote/xenstore.c 2009-06-09 14:09:08.000000000 +0800
@@ -64,7 +64,8 @@ static void insert_media(void *opaque)
for (i = 0; i < MAX_DRIVES + 1; i++) {
bs = drives_table[i].bdrv;
if (media_filename[i] && bs && bs->filename[0] == '\0') {
- bdrv_open2(bs, media_filename[i], 0, &bdrv_raw);
+ /* Temporary BDRV_O_RDWR */
+ bdrv_open2(bs, media_filename[i], BDRV_O_RDWR, &bdrv_raw);
pstrcpy(bs->filename, sizeof(bs->filename), media_filename[i]);
free(media_filename[i]);
media_filename[i] = NULL;
@@ -314,9 +315,9 @@ void xenstore_parse_domain_config(int hv
{
char **e_danger = NULL;
char *buf = NULL;
- char *fpath = NULL, *bpath = NULL, *btype = NULL,
+ char *fpath = NULL, *bpath = NULL, *btype = NULL, *mode = NULL,
*dev = NULL, *params = NULL, *drv = NULL;
- int i, j, any_hdN = 0, ret, is_tap;
+ int i, j, any_hdN = 0, ret, is_tap, flags;
unsigned int len, num, hd_index, pci_devid = 0;
BlockDriverState *bs;
BlockDriver *format;
@@ -378,7 +379,8 @@ void xenstore_parse_domain_config(int hv
}
for (i = 0; i < num; i++) {
- format = NULL; /* don't know what the format is yet */
+ flags = 0;
+ format = NULL; /* don't know what the format is yet */
/* read the backend path */
xenstore_get_backend_path(&bpath, "vbd", danger_path, hvm_domid, e_danger[i]);
if (bpath == NULL)
@@ -464,6 +466,17 @@ void xenstore_parse_domain_config(int hv
format = &bdrv_raw;
}
+ /* read the mode of the device */
+ if (pasprintf(&buf, "%s/mode", bpath) == -1)
+ continue;
+ free(mode);
+ mode = xs_read(xsh, XBT_NULL, buf, &len);
+
+ if (!strcmp(mode, "r") || !strcmp(mode, "ro"))
+ flags |= BDRV_O_RDONLY;
+ if (!strcmp(mode, "w") || !strcmp(mode, "rw"))
+ flags |= BDRV_O_RDWR;
+
#if 0
/* Phantom VBDs are disabled because the use of paths
* from guest-controlled areas in xenstore is unsafe.
@@ -509,7 +522,7 @@ void xenstore_parse_domain_config(int hv
#ifdef CONFIG_STUBDOM
if (pasprintf(&danger_buf, "%s/device/vbd/%s", danger_path, e_danger[i]) == -1)
continue;
- if (bdrv_open2(bs, danger_buf, BDRV_O_CACHE_WB /* snapshot and write-back */, &bdrv_raw) == 0) {
+ if (bdrv_open2(bs, danger_buf, flags|BDRV_O_CACHE_WB /* snapshot and write-back */, &bdrv_raw) == 0) {
pstrcpy(bs->filename, sizeof(bs->filename), params);
} else
#endif
@@ -535,7 +548,7 @@ void xenstore_parse_domain_config(int hv
}
}
pstrcpy(bs->filename, sizeof(bs->filename), params);
- if (bdrv_open2(bs, params, BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) {
+ if (bdrv_open2(bs, params, flags|BDRV_O_CACHE_WB /* snapshot and write-back */, format) < 0) {
fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0");
} else {
char* snapshot = get_snapshot_name(atoi(e_danger[i]));

View File

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

View File

@ -26,7 +26,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.4.0-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
@@ -45,6 +45,7 @@
@@ -46,6 +46,7 @@
#include <asm/mc146818rtc.h>
#include <asm/spinlock.h>
#include <asm/hvm/hvm.h>
@ -34,7 +34,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
#include <asm/hvm/vpt.h>
#include <asm/hvm/support.h>
#include <asm/hvm/cacheattr.h>
@@ -373,6 +374,7 @@ void hvm_domain_relinquish_resources(str
@@ -374,6 +375,7 @@ void hvm_domain_relinquish_resources(str
void hvm_domain_destroy(struct domain *d)
{
@ -42,7 +42,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
hvm_funcs.domain_destroy(d);
rtc_deinit(d);
stdvga_deinit(d);
@@ -673,8 +675,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
@@ -674,8 +676,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
{
int rc;
@ -57,7 +57,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 )
goto fail2;
@@ -721,12 +729,14 @@ int hvm_vcpu_initialise(struct vcpu *v)
@@ -726,6 +734,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
hvm_funcs.vcpu_destroy(v);
fail2:
vlapic_destroy(v);
@ -65,14 +65,15 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
fail1:
return rc;
}
@@ -733,6 +742,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
void hvm_vcpu_destroy(struct vcpu *v)
{
tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
+ hyperx_intercept_vcpu_destroy(v);
hvm_vcpu_cacheattr_destroy(v);
vlapic_destroy(v);
hvm_funcs.vcpu_destroy(v);
@@ -1678,7 +1688,7 @@ void hvm_cpuid(unsigned int input, unsig
@@ -1684,7 +1694,7 @@ void hvm_cpuid(unsigned int input, unsig
return;
if ( cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) )
@ -81,7 +82,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
domain_cpuid(v->domain, input, *ecx, eax, ebx, ecx, edx);
@@ -1690,6 +1700,8 @@ void hvm_cpuid(unsigned int input, unsig
@@ -1696,6 +1706,8 @@ void hvm_cpuid(unsigned int input, unsig
if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
__clear_bit(X86_FEATURE_APIC & 31, edx);
}
@ -90,7 +91,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
}
void hvm_rdtsc_intercept(struct cpu_user_regs *regs)
@@ -1789,6 +1801,8 @@ int hvm_msr_read_intercept(struct cpu_us
@@ -1795,6 +1807,8 @@ int hvm_msr_read_intercept(struct cpu_us
break;
default:
@ -99,7 +100,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_read_intercept(regs);
}
@@ -1877,6 +1891,8 @@ int hvm_msr_write_intercept(struct cpu_u
@@ -1883,6 +1897,8 @@ int hvm_msr_write_intercept(struct cpu_u
break;
default:
@ -108,7 +109,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
return hvm_funcs.msr_write_intercept(regs);
}
@@ -2044,6 +2060,10 @@ int hvm_do_hypercall(struct cpu_user_reg
@@ -2050,6 +2066,10 @@ int hvm_do_hypercall(struct cpu_user_reg
case 0:
break;
}
@ -119,7 +120,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
if ( (eax & 0x80000000) && is_viridian_domain(curr->domain) )
return viridian_hypercall(regs);
@@ -2560,6 +2580,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
@@ -2566,6 +2586,15 @@ long do_hvm_op(unsigned long op, XEN_GUE
rc = -EINVAL;
break;

View File

@ -21,7 +21,7 @@
. /etc/rc.status
rc_reset
XEND=`pidofproc /usr/sbin/xend`
XEND=`pidof -x /usr/sbin/xend`
await_daemons_up()
{

View File

@ -55,8 +55,7 @@ xendomains_abort()
check()
{
XEND=`ps ax | grep -w xend | grep -w python | awk '{ print $1 }'`
XEND=`echo $XEND`
XEND=`pidof -x /usr/sbin/xend`
if [ "$1" = status ]; then
if [ ! -e /proc/xen/capabilities ] || [ ! -r "$XENDOM_CONFIG" ] || [ -z "$XEND" ]; then

View File

@ -1,45 +0,0 @@
Index: xen-3.4.0-testing/tools/python/xen/util/acmpolicy.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/util/acmpolicy.py
+++ xen-3.4.0-testing/tools/python/xen/util/acmpolicy.py
@@ -17,7 +17,10 @@
#============================================================================
import os
-import sha
+try:
+ import hashlib # python v2.6 or newer
+except ImportError:
+ import sha # python v2.5 or older
import stat
import array
import struct
Index: xen-3.4.0-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendAPI.py
@@ -18,7 +18,6 @@
import inspect
import os
import Queue
-import sets
import string
import sys
import traceback
@@ -119,7 +118,7 @@ event_registrations = {}
def event_register(session, reg_classes):
if session not in event_registrations:
event_registrations[session] = {
- 'classes' : sets.Set(),
+ 'classes' : set(),
'queue' : Queue.Queue(EVENT_QUEUE_LENGTH),
'next-id' : 1
}
@@ -131,7 +130,6 @@ def event_register(session, reg_classes)
event_registrations[session]['classes'].update(reg_classes)
-
def event_unregister(session, unreg_classes):
if session not in event_registrations:
return

View File

@ -115,7 +115,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendCheckpoint.py
try:
if not os.path.isdir("/var/lib/xen"):
os.makedirs("/var/lib/xen")
@@ -98,52 +98,59 @@ def save(fd, dominfo, network, live, dst
@@ -98,52 +98,61 @@ def save(fd, dominfo, network, live, dst
image_cfg = dominfo.info.get('image', {})
hvm = dominfo.info.is_hvm()
@ -191,6 +191,8 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendCheckpoint.py
+ domain_name)
+ if hvm:
+ dominfo.image.saveDeviceModel()
+ if name:
+ dominfo.image.resumeDeviceModel()
+
+ if line == "suspend":
+ tochild.write("done\n")
@ -221,7 +223,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendCheckpoint.py
if checkpoint:
dominfo.resumeDomain()
@@ -207,6 +214,71 @@ def restore(xd, fd, dominfo = None, paus
@@ -207,6 +216,71 @@ def restore(xd, fd, dominfo = None, paus
if othervm is not None and othervm.domid is not None:
raise VmError("Domain '%s' already exists with ID '%d'" % (domconfig["name_label"], othervm.domid))
@ -293,7 +295,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendCheckpoint.py
if dominfo:
dominfo.resume()
else:
@@ -322,26 +394,7 @@ def restore(xd, fd, dominfo = None, paus
@@ -322,26 +396,7 @@ def restore(xd, fd, dominfo = None, paus
dominfo.completeRestore(handler.store_mfn, handler.console_mfn)
@ -345,7 +347,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomain.py
xc = xen.lowlevel.xc.xc()
xoptions = XendOptions.instance()
@@ -1418,6 +1419,181 @@ class XendDomain:
@@ -1421,6 +1422,187 @@ class XendDomain:
raise XendError("can't write guest state file %s: %s" %
(dst, ex[1]))
@ -367,6 +369,12 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomain.py
+ if not dominfo:
+ raise XendInvalidDomain(str(domid))
+
+ snap_file = os.path.join(xoptions.get_xend_domains_path(),
+ dominfo.get_uuid(), "snapshots", name)
+
+ if os.access(snap_file, os.F_OK):
+ raise XendError("Snapshot:%s exist for domain %s\n" % (name, str(domid)))
+
+ if dominfo.getDomid() == DOM0_ID:
+ raise XendError("Cannot snapshot privileged domain %s" % str(domid))
+ if dominfo._stateGet() != DOM_STATE_RUNNING:
@ -533,7 +541,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
+++ xen-3.4.0-testing/tools/python/xen/xm/main.py
@@ -120,6 +120,14 @@ SUBCOMMAND_HELP = {
'Restore a domain from a saved state.'),
'save' : ('[-c] <Domain> <CheckpointFile>',
'save' : ('[-c|-f] <Domain> <CheckpointFile>',
'Save a domain state to restore later.'),
+ 'snapshot-create' : ('[-d] <Domain> <SnapshotName>',
+ 'Snapshot a running domain.'),
@ -546,9 +554,9 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
'shutdown' : ('<Domain> [-waRH]', 'Shutdown a domain.'),
'top' : ('', 'Monitor a host and the domains in real time.'),
'unpause' : ('<Domain>', 'Unpause a paused domain.'),
@@ -276,6 +284,9 @@ SUBCOMMAND_OPTIONS = {
'save': (
@@ -277,6 +285,9 @@ SUBCOMMAND_OPTIONS = {
('-c', '--checkpoint', 'Leave domain running after creating snapshot'),
('-f', '--force', 'Force to overwrite exist file'),
),
+ 'snapshot-create': (
+ ('-d', '--diskonly', 'Perform disk only snapshot of domain'),
@ -556,7 +564,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
'restore': (
('-p', '--paused', 'Do not unpause domain after restoring it'),
),
@@ -302,6 +313,10 @@ common_commands = [
@@ -303,6 +314,10 @@ common_commands = [
"restore",
"resume",
"save",
@ -567,7 +575,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
"shell",
"shutdown",
"start",
@@ -333,6 +348,10 @@ domain_commands = [
@@ -334,6 +349,10 @@ domain_commands = [
"restore",
"resume",
"save",
@ -578,7 +586,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
"shutdown",
"start",
"suspend",
@@ -724,6 +743,62 @@ def xm_event_monitor(args):
@@ -725,6 +744,62 @@ def xm_event_monitor(args):
#
#########################################################################
@ -640,8 +648,8 @@ Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
+
def xm_save(args):
arg_check(args, "save", 2, 3)
@@ -2853,6 +2928,10 @@ commands = {
arg_check(args, "save", 2, 4)
@@ -2857,6 +2932,10 @@ commands = {
"restore": xm_restore,
"resume": xm_resume,
"save": xm_save,

View File

@ -2,7 +2,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.4.0-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
@@ -537,11 +537,12 @@ static int hvm_load_cpu_ctxt(struct doma
@@ -538,11 +538,12 @@ static int hvm_load_cpu_ctxt(struct doma
return -EINVAL;
}
@ -16,7 +16,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/hvm/hvm.c
(!cpu_has_ffxsr && (ctxt.msr_efer & EFER_FFXSE)) ||
((ctxt.msr_efer & (EFER_LME|EFER_LMA)) == EFER_LMA) )
{
@@ -818,10 +819,11 @@ int hvm_set_efer(uint64_t value)
@@ -824,10 +825,11 @@ int hvm_set_efer(uint64_t value)
value &= ~EFER_LMA;

View File

@ -19,15 +19,7 @@ Index: xen-3.4.0-testing/xen/arch/x86/platform_hypercall.c
struct xen_platform_op curop, *op = &curop;
if ( !IS_PRIV(current->domain) )
@@ -313,7 +314,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
{
uint32_t cpu;
uint64_t idletime, now = NOW();
- struct vcpu *v;
struct xenctl_cpumap ctlmap;
cpumask_t cpumap;
XEN_GUEST_HANDLE(uint8) cpumap_bitmap;
@@ -386,6 +386,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
@@ -385,6 +386,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
break;
}
break;

View File

@ -134,7 +134,7 @@ Index: xen-3.4.0-testing/xen/include/asm-x86/mm.h
===================================================================
--- xen-3.4.0-testing.orig/xen/include/asm-x86/mm.h
+++ xen-3.4.0-testing/xen/include/asm-x86/mm.h
@@ -411,6 +411,7 @@ TYPE_SAFE(unsigned long,mfn);
@@ -412,6 +412,7 @@ TYPE_SAFE(unsigned long,mfn);
#define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
#define INVALID_M2P_ENTRY (~0UL)
#define VALID_M2P(_e) (!((_e) & (1UL<<(BITS_PER_LONG-1))))

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9922e7477ca5425e756c86bb120a998c1f5528e3537295e2fc953b31191df5e0
size 22574212
oid sha256:f813543c4c975b9d0d95ecf2c4f8f08a8780673a45a1fd301ac2c225210da52c
size 22573690

View File

@ -2,7 +2,7 @@ Index: xen-3.4.0-testing/Config.mk
===================================================================
--- xen-3.4.0-testing.orig/Config.mk
+++ xen-3.4.0-testing/Config.mk
@@ -117,14 +117,14 @@ QEMU_REMOTE=http://xenbits.xensource.com
@@ -124,14 +124,14 @@ QEMU_REMOTE=http://xenbits.xensource.com
# Specify which qemu-dm to use. This may be `ioemu' to use the old
# Mercurial in-tree version, or a local directory, or a git URL.
# CONFIG_QEMU ?= ../qemu-xen.git

View File

@ -26,11 +26,13 @@ Index: xen-3.4.0-testing/tools/security/Makefile
===================================================================
--- xen-3.4.0-testing.orig/tools/security/Makefile
+++ xen-3.4.0-testing/tools/security/Makefile
@@ -61,7 +61,7 @@ install: all $(ACM_CONFIG_FILE)
@@ -60,8 +60,8 @@ install: all $(ACM_CONFIG_FILE)
$(INSTALL_DATA) $(ACM_INST_HTML) $(DESTDIR)$(ACM_SECGEN_HTMLDIR)
$(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
$(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR)
python python/setup.py install \
- --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
- $(PYTHON) python/setup.py install $(PYTHON_PREFIX_ARG) \
- --root="$(DESTDIR)" --force
+ $(PYTHON) python/setup.py install \
+ --prefix="/usr" --root="$(DESTDIR)" --force
else
.PHONY: all
@ -42,8 +44,8 @@ Index: xen-3.4.0-testing/tools/pygrub/Makefile
@@ -11,7 +11,7 @@ build:
.PHONY: install
install: all
CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
- --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
- $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+ --prefix="/usr" --root="$(DESTDIR)" --force
$(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
@ -55,8 +57,8 @@ Index: xen-3.4.0-testing/tools/python/Makefile
@@ -56,7 +56,7 @@ refresh-po: $(POTFILE)
.PHONY: install
install: install-messages install-dtd
CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install \
- --prefix="$(PREFIX)" --root="$(DESTDIR)" --force
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
- $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+ --prefix="/usr" --root="$(DESTDIR)" --force
install-dtd: all

View File

@ -122,7 +122,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
import xen.util.xsm.xsm as security
from xen.util import xsconstants
@@ -2134,6 +2134,10 @@ class XendDomainInfo:
@@ -2135,6 +2135,10 @@ class XendDomainInfo:
deviceClass, config = self.info['devices'].get(dev_uuid)
self._waitForDevice(deviceClass, config['devid'])
@ -133,7 +133,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
def _waitForDevice_destroy(self, deviceClass, devid, backpath):
return self.getDeviceController(deviceClass).waitForDevice_destroy(
devid, backpath)
@@ -2892,9 +2896,19 @@ class XendDomainInfo:
@@ -2893,9 +2897,19 @@ class XendDomainInfo:
devtype = devinfo[0]
disk = devinfo[1]['uname']
@ -156,7 +156,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
if mounted:
# This is a file, not a device. pygrub can cope with a
# file if it's raw, but if it's QCOW or other such formats
@@ -2910,7 +2924,9 @@ class XendDomainInfo:
@@ -2911,7 +2925,9 @@ class XendDomainInfo:
from xen.xend import XendDomain
dom0 = XendDomain.instance().privilegedDomain()
@ -167,7 +167,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
fn = BOOTLOADER_LOOPBACK_DEVICE
try:
@@ -2920,8 +2936,10 @@ class XendDomainInfo:
@@ -2921,8 +2937,10 @@ class XendDomainInfo:
if mounted:
log.info("Unmounting %s from %s." %
(fn, BOOTLOADER_LOOPBACK_DEVICE))

View File

@ -94,7 +94,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1294,6 +1294,27 @@ class XendDomainInfo:
@@ -1295,6 +1295,27 @@ class XendDomainInfo:
dev_str_list = dev_str_list + [dev_str]
return dev_str_list

View File

@ -2,8 +2,8 @@ Index: xen-3.4.0-testing/tools/examples/Makefile
===================================================================
--- xen-3.4.0-testing.orig/tools/examples/Makefile
+++ xen-3.4.0-testing/tools/examples/Makefile
@@ -20,7 +20,6 @@ XEN_CONFIGS += xmexample.hvm-stubdom
XEN_CONFIGS += xmexample.hvm-dm
@@ -19,7 +19,6 @@ XEN_CONFIGS += xmexample.hvm
XEN_CONFIGS += xmexample.hvm-stubdom
XEN_CONFIGS += xmexample.pv-grub
XEN_CONFIGS += xmexample.nbd
-XEN_CONFIGS += xmexample.vti

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Thu Jun 11 14:17:22 MDT 2009 - carnold@novell.com
- Update to Xen 3.4.1 RC2 c/s 19648.
-------------------------------------------------------------------
Tue Jun 9 13:52:07 CST 2009 - wkong@novell.com
- bnc#504491 - drop write data when set read only disk in xen config
bdrv_open2_fix_flags.patch
bdrv_open2_flags_2.patch
-------------------------------------------------------------------
Mon May 18 15:03:29 MDT 2009 - carnold@novell.com
- Update to Xen 3.4.0 FCS c/s 19607
-------------------------------------------------------------------
Mon May 17 17:15:57 CST 2009 - wkong@novell.com
-bnc#485770 - check exsit file for save and snapshot-create
xm-save-check-file.patch
snapshot-xend.patch
-------------------------------------------------------------------
Thu May 14 12:00:09 MDT 2009 - jfehlig@novell.com
- bnc#503332 - Remove useless qcow tools
/usr/sbin/{qcow-create,img2qcow,qcow2raw} from xen-tools package.
-------------------------------------------------------------------
Mon May 11 18:49:50 CST 2009 - wkong@novell.com
- bnc#477892 - snapshot windows can't accomplish.
snapshot-xend.patch
-------------------------------------------------------------------
Fri Apr 22 17:30:02 CST 2009 - wkong@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package xen (Version 3.4.0_19590_01)
# spec file for package xen (Version 3.4.0_19648_01)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -22,7 +22,7 @@ Name: xen
ExclusiveArch: %ix86 x86_64
%define xvers 3.4
%define xvermaj 3
%define changeset 19590
%define changeset 19648
%define xen_build_dir xen-3.4.0-testing
%define with_kmp 0
BuildRequires: LibVNCServer-devel SDL-devel automake bin86 curl-devel dev86 graphviz latex2html libjpeg-devel libxml2-devel ncurses-devel openssl openssl-devel pciutils-devel python-devel texinfo transfig
@ -37,7 +37,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
%endif
Version: 3.4.0_19590_01
Version: 3.4.0_19648_01
Release: 1
License: GPL v2 only
Group: System/Kernel
@ -113,13 +113,13 @@ Patch158: xen-api-auth.patch
Patch159: tools-gdbserver-build.diff
Patch160: network-route.patch
# Needs to go upstream sometime, when python 2.6 is widespread
Patch161: python2.6-fixes.patch
Patch162: udev-rules.patch
Patch163: ioemu-vnc-resize.patch
Patch161: udev-rules.patch
Patch162: ioemu-vnc-resize.patch
# Needs to go upstream
Patch164: checkpoint-rename.patch
Patch165: network-nat.patch
Patch166: ioemu-debuginfo.patch
Patch163: checkpoint-rename.patch
Patch164: network-nat.patch
Patch165: ioemu-debuginfo.patch
Patch166: xm-save-check-file.patch
# Patches for snapshot support
Patch200: snapshot-ioemu-save.patch
Patch201: snapshot-ioemu-restore.patch
@ -136,6 +136,8 @@ Patch215: tapdisk-ioemu-shutdown-fix.patch
Patch220: qemu-dm-segfault.patch
Patch221: blktapctrl-default-to-ioemu.patch
Patch222: ioemu-blktap-barriers.patch
Patch223: bdrv_open2_fix_flags.patch
Patch224: bdrv_open2_flags_2.patch
# Jim's domain lock patch
Patch300: xend-domain-lock.patch
# Patches from Jan
@ -556,6 +558,8 @@ Authors:
%patch220 -p1
%patch221 -p1
%patch222 -p1
%patch223 -p1
%patch224 -p1
%patch300 -p1
#%patch340 -p1 - Port Later if needed
%patch341 -p1
@ -660,6 +664,7 @@ export XEN_PYTHON_NATIVE_INSTALL=1
make -C tools install \
DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir}
cp tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/gdb/gdbserver/gdbserver-xen $RPM_BUILD_ROOT/usr/bin/gdbserver-xen
rm -f $RPM_BUILD_ROOT/usr/sbin/{qcow-create,img2qcow,qcow2raw}
make -C tools/misc/serial-split install \
DESTDIR=$RPM_BUILD_ROOT MANDIR=%{_mandir}
%ifarch x86_64
@ -704,7 +709,7 @@ install -m644 %SOURCE9 %SOURCE10 $RPM_BUILD_ROOT/etc/xen/examples/
# scripts
rm -f $RPM_BUILD_ROOT/etc/xen/scripts/block-*nbd
install -m755 %SOURCE11 %SOURCE12 %SOURCE13 %SOURCE16 %SOURCE17 $RPM_BUILD_ROOT/etc/xen/scripts/
ln -s /etc/xen/scripts/xen-monitor $RPM_BUILD_ROOT/etc/xen/scripts/set-lock
ln -s /etc/xen/scripts/vm-monitor $RPM_BUILD_ROOT/etc/xen/scripts/set-lock
# Xen API remote authentication files
install -d $RPM_BUILD_ROOT/etc/pam.d
install -m644 %SOURCE23 $RPM_BUILD_ROOT/etc/pam.d/xen-api
@ -788,9 +793,6 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
/usr/bin/gdbserver-xen
/usr/sbin/blktapctrl
/usr/sbin/flask-loadpolicy
/usr/sbin/img2qcow
/usr/sbin/qcow-create
/usr/sbin/qcow2raw
/usr/sbin/rcxend
/usr/sbin/rcxendomains
/usr/sbin/tapdisk
@ -936,6 +938,24 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug
/sbin/ldconfig
%changelog
* Thu Jun 11 2009 carnold@novell.com
- Update to Xen 3.4.1 RC2 c/s 19648.
* Tue Jun 09 2009 wkong@novell.com
- bnc#504491 - drop write data when set read only disk in xen config
bdrv_open2_fix_flags.patch
bdrv_open2_flags_2.patch
* Mon May 18 2009 carnold@novell.com
- Update to Xen 3.4.0 FCS c/s 19607
* Sun May 17 2009 wkong@novell.com
-bnc#485770 - check exsit file for save and snapshot-create
xm-save-check-file.patch
snapshot-xend.patch
* Thu May 14 2009 jfehlig@novell.com
- bnc#503332 - Remove useless qcow tools
/usr/sbin/{qcow-create,img2qcow,qcow2raw} from xen-tools package.
* Mon May 11 2009 wkong@novell.com
- bnc#477892 - snapshot windows can't accomplish.
snapshot-xend.patch
* Wed Apr 22 2009 wkong@novell.com
- Backport two qcow2 patches from qemu org
ioemu-6816-qcow2-revert-6404-6405-6407.patch

View File

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

View File

@ -2,7 +2,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2117,7 +2117,7 @@ class XendDomainInfo:
@@ -2118,7 +2118,7 @@ class XendDomainInfo:
if not corefile:
this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())

View File

@ -94,7 +94,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
XendTask.log_progress(0, 30, self._constructDomain)
XendTask.log_progress(31, 60, self._initDomain)
@@ -2626,6 +2629,11 @@ class XendDomainInfo:
@@ -2627,6 +2630,11 @@ class XendDomainInfo:
self._stateSet(DOM_STATE_HALTED)
self.domid = None # Do not push into _stateSet()!
@ -106,7 +106,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomainInfo.py
finally:
self.refresh_shutdown_lock.release()
@@ -3992,6 +4000,74 @@ class XendDomainInfo:
@@ -3993,6 +4001,74 @@ class XendDomainInfo:
def has_device(self, dev_class, dev_uuid):
return (dev_uuid in self.info['%s_refs' % dev_class.lower()])
@ -203,7 +203,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendOptions.py
def __init__(self):
self.configure()
@@ -368,6 +379,19 @@ class XendOptions:
@@ -368,6 +379,24 @@ class XendOptions:
return self.get_config_int("qemu-dm-logrotate-count",
self.qemu_dm_logrotate_count)
@ -218,7 +218,12 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendOptions.py
+ return self.get_config_string("xend-domain-lock-path", self.xend_domain_lock_path_default)
+
+ def get_xend_domain_lock_utility(self):
+ return self.get_config_string('xend-domain-lock-utility', self.xend_domain_lock_utility)
+ s = self.get_config_string('xend-domain-lock-utility')
+
+ if s:
+ return os.path.join(osdep.scripts_dir, s)
+ else:
+ return self.xend_domain_lock_utility
+
class XendOptionsFile(XendOptions):
@ -235,7 +240,7 @@ Index: xen-3.4.0-testing/tools/python/xen/xend/XendCheckpoint.py
dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2,
domain_name)
log.info("Domain %d suspended.", dominfo.getDomid())
@@ -399,6 +400,7 @@ def restore(xd, fd, dominfo = None, paus
@@ -401,6 +402,7 @@ def restore(xd, fd, dominfo = None, paus
if not paused:
dominfo.unpause()
@ -251,7 +256,7 @@ Index: xen-3.4.0-testing/tools/hotplug/Linux/Makefile
XEN_SCRIPTS += xen-hotplug-cleanup
XEN_SCRIPTS += external-device-migrate
XEN_SCRIPTS += vscsi
+XEN_SCRIPTS += domain-lock xen-monitor
+XEN_SCRIPTS += domain-lock vm-monitor
XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh
@ -282,7 +287,7 @@ Index: xen-3.4.0-testing/tools/hotplug/Linux/domain-lock
+ local path=$1/lock
+ local name=$2
+
+ pid=`ps -efwww | grep xen-monitor | grep $name | awk '{print $2}'`
+ pid=`ps -efwww | grep vm-monitor | grep $name | awk '{print $2}'`
+ if [ -n "$pid" ]; then
+ kill $pid
+ rm -f $path
@ -343,10 +348,10 @@ Index: xen-3.4.0-testing/tools/hotplug/Linux/domain-lock
+ get_status $vm_path
+ ;;
+esac
Index: xen-3.4.0-testing/tools/hotplug/Linux/xen-monitor
Index: xen-3.4.0-testing/tools/hotplug/Linux/vm-monitor
===================================================================
--- /dev/null
+++ xen-3.4.0-testing/tools/hotplug/Linux/xen-monitor
+++ xen-3.4.0-testing/tools/hotplug/Linux/vm-monitor
@@ -0,0 +1,41 @@
+#!/bin/bash
+
@ -374,7 +379,7 @@ Index: xen-3.4.0-testing/tools/hotplug/Linux/xen-monitor
+ local rc=0
+
+ [ -f $path ] || touch $path
+ flock -x -w $HA_TICK $path $basedir/xen-monitor $*
+ flock -x -w $HA_TICK $path $basedir/vm-monitor $*
+ rc=$?
+ if [ $rc -eq 1 ]; then
+ echo `cat $path`
@ -386,6 +391,6 @@ Index: xen-3.4.0-testing/tools/hotplug/Linux/xen-monitor
+
+if [ $0 = "$basedir/set-lock" ]; then
+ create_lock $*
+elif [ $0 = "$basedir/xen-monitor" ]; then
+elif [ $0 = "$basedir/vm-monitor" ]; then
+ monitor $*
+fi

97
xm-save-check-file.patch Normal file
View File

@ -0,0 +1,97 @@
Index: xen-3.4.0-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendAPI.py
@@ -1817,10 +1817,10 @@ class XendAPI(object):
bool(live), port, node, ssl)
return xen_api_success_void()
- def VM_save(self, _, vm_ref, dest, checkpoint):
+ def VM_save(self, _, vm_ref, dest, checkpoint, force):
xendom = XendDomain.instance()
xeninfo = xendom.get_vm_by_uuid(vm_ref)
- xendom.domain_save(xeninfo.getDomid(), dest, checkpoint)
+ xendom.domain_save(xeninfo.getDomid(), dest, checkpoint, force)
return xen_api_success_void()
def VM_restore(self, _, src, paused):
Index: xen-3.4.0-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.4.0-testing/tools/python/xen/xend/XendDomain.py
@@ -1380,7 +1380,7 @@ class XendDomain:
finally:
sock.close()
- def domain_save(self, domid, dst, checkpoint=False):
+ def domain_save(self, domid, dst, checkpoint=False, force=False):
"""Start saving a domain to file.
@param domid: Domain ID or Name
@@ -1396,6 +1396,9 @@ class XendDomain:
if not dominfo:
raise XendInvalidDomain(str(domid))
+ if os.access(dst, os.F_OK) and not force:
+ raise XendError("Save file:%s exist!\n" % dst)
+
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot save privileged domain %s" % str(domid))
if dominfo._stateGet() != DOM_STATE_RUNNING:
Index: xen-3.4.0-testing/tools/python/xen/xm/main.py
===================================================================
--- xen-3.4.0-testing.orig/tools/python/xen/xm/main.py
+++ xen-3.4.0-testing/tools/python/xen/xm/main.py
@@ -118,7 +118,7 @@ SUBCOMMAND_HELP = {
'reset' : ('<Domain>', 'Reset a domain.'),
'restore' : ('<CheckpointFile> [-p]',
'Restore a domain from a saved state.'),
- 'save' : ('[-c] <Domain> <CheckpointFile>',
+ 'save' : ('[-c|-f] <Domain> <CheckpointFile>',
'Save a domain state to restore later.'),
'shutdown' : ('<Domain> [-waRH]', 'Shutdown a domain.'),
'top' : ('', 'Monitor a host and the domains in real time.'),
@@ -275,6 +275,7 @@ SUBCOMMAND_OPTIONS = {
),
'save': (
('-c', '--checkpoint', 'Leave domain running after creating snapshot'),
+ ('-f', '--force', 'Force to overwrite exist file'),
),
'restore': (
('-p', '--paused', 'Do not unpause domain after restoring it'),
@@ -726,18 +727,21 @@ def xm_event_monitor(args):
def xm_save(args):
- arg_check(args, "save", 2, 3)
+ arg_check(args, "save", 2, 4)
try:
- (options, params) = getopt.gnu_getopt(args, 'c', ['checkpoint'])
+ (options, params) = getopt.gnu_getopt(args, 'cf', ['checkpoint', 'force'])
except getopt.GetoptError, opterr:
err(opterr)
usage('save')
checkpoint = False
+ force = False
for (k, v) in options:
if k in ['-c', '--checkpoint']:
checkpoint = True
+ if k in ['-f', '--force']:
+ force = True
if len(params) != 2:
err("Wrong number of parameters")
@@ -751,9 +755,9 @@ def xm_save(args):
sys.exit(1)
if serverType == SERVER_XEN_API:
- server.xenapi.VM.save(get_single_vm(dom), savefile, checkpoint)
+ server.xenapi.VM.save(get_single_vm(dom), savefile, checkpoint, force)
else:
- server.xend.domain.save(dom, savefile, checkpoint)
+ server.xend.domain.save(dom, savefile, checkpoint, force)
def xm_restore(args):
arg_check(args, "restore", 1, 2)

View File

@ -679,7 +679,7 @@ then
#
if [ -n "$MAC" ]
then
if [ "$SLE10" -a -d etc/sysconfig/network/ ]
if [ -d etc/sysconfig/network/ ]
then
echo "Changing the Network configuration in the newly copied image."
pushd "etc/sysconfig/network/" > /dev/null
@ -694,7 +694,13 @@ then
losetup -d $loopdev
exit 1
fi
mv -f "$ETH0" ifcfg-eth-id-$MAC
if [ "$SLE10" ]
then
mv -f "$ETH0" ifcfg-eth-id-$MAC
else
sed -i -e "s,^LLADDR=.*$,LLADDR=\'$MAC\'," \
ifcfg-eth0
fi
popd > /dev/null
fi
@ -732,7 +738,7 @@ then
sed -i -e "s,^IPADDR=.*$,IPADDR=$IP," \
ifcfg-eth-id-$MAC
else
sed -i -e "s,^IPADDR=.*$,IPADDR=$IP/$MASK," \
sed -i -e "s,^IPADDR=.*$,IPADDR=$IP/$MASK," \
ifcfg-eth0
fi
popd > /dev/null