[libvirt] [PATCH 4/4] xen: Return tap2 for tap2 disks

2011-10-12 Thread Philipp Hahn
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 defines as device/tap2.

Signed-off-by: Philipp Hahn h...@univention.de
---
https://forge.univention.org/bugzilla/show_bug.cgi?id=22017

 src/xenxs/xen_sxpr.c |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 038c6bb..4cfa9e8 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -391,14 +391,19 @@ 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 error;
+} 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;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 4/4] xen: Return tap2 for tap2 disks

2011-10-12 Thread Eric Blake

On 10/12/2011 02:55 AM, Philipp Hahn wrote:

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 defines as device/tap2.


s/defines/defined/



Signed-off-by: Philipp Hahnh...@univention.de
---
https://forge.univention.org/bugzilla/show_bug.cgi?id=22017

  src/xenxs/xen_sxpr.c |   21 +
  1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 038c6bb..4cfa9e8 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -391,14 +391,19 @@ 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 error;


s/error/no_memory/


+} else {
+if (VIR_ALLOC_N(disk-driverName, (offset-src)+1)  0)


Indentation is off.

ACK with that fixed, so I pushed.

--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list