diff options
author | Philipp Hahn <hahn@univention.de> | 2011-10-12 10:55:37 +0200 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-10-12 14:37:48 -0600 |
commit | c490b469ceaca8fae7be92b5dac300f92406d2f1 (patch) | |
tree | 166743d2c89177008554f9fec01c1956383567e9 /src/xenxs | |
parent | xen: fix PyGrub boot device order (diff) | |
download | libvirt-c490b469ceaca8fae7be92b5dac300f92406d2f1.tar.gz libvirt-c490b469ceaca8fae7be92b5dac300f92406d2f1.tar.bz2 libvirt-c490b469ceaca8fae7be92b5dac300f92406d2f1.zip |
xen: Return tap2 for tap2 disks
For some versions of Xen the difference between "tap" and "tap2" is
important. When converting back from xen-sxpr to libvirt-xml, that
information is lost, which breaks re-defining the domain using that
data.
Explicitly return "tap2" for disks defined as "device/tap2".
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'src/xenxs')
-rw-r--r-- | src/xenxs/xen_sxpr.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index c172e61fa..f2447f785 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -397,14 +397,20 @@ xenParseSxprDisks(virDomainDefPtr def, goto error; } - if (VIR_ALLOC_N(disk->driverName, (offset-src)+1) < 0) - goto no_memory; - if (virStrncpy(disk->driverName, src, offset-src, - (offset-src)+1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver name %s too big for destination"), - src); - goto error; + if (sexpr_lookup(node, "device/tap2") && + STRPREFIX(src, "tap:")) { + if (!(disk->driverName = strdup("tap2"))) + goto no_memory; + } else { + if (VIR_ALLOC_N(disk->driverName, (offset-src)+1) < 0) + goto no_memory; + if (virStrncpy(disk->driverName, src, offset-src, + (offset-src)+1) == NULL) { + XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, + _("Driver name %s too big for destination"), + src); + goto error; + } } src = offset + 1; |