[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] virsh create and virsh dumpxml certain code location



benian wrote:
> Hi all,
> My libivrt is libvirt-0.8.3
> I would like to add "tap2" recognition when using virsh create and
> dumpxml,

Ah yes, I have a patch laying laying around that needs to go upstream. 
No better time to do that than now ..

Regards,
Jim

>From 0725b037ca494d671a41b23a72d8ac3bd9c3c58d Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig novell com>
Date: Mon, 23 Aug 2010 16:07:08 -0600
Subject: [PATCH] Add blktap2 support to xend driver

Xen4.0 includes a new blktap2 implementation, which is specified with
'tap2' prefix.  AFAICT it's configuration syntax is identical to blktap,
with exception of 'tap2' vs 'tap' prefix.  This patch takes the simple
approach of accepting sexp containing 'tap2' prefix.
---
 src/xen/xend_internal.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index d47c625..94e5d33 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1386,7 +1386,8 @@ xenDaemonParseSxprDisks(virDomainDefPtr def,
            but blktap disks ended up in a differently named
            (device (tap ....)) block.... */
         if (sexpr_lookup(node, "device/vbd") ||
-            sexpr_lookup(node, "device/tap")) {
+            sexpr_lookup(node, "device/tap") ||
+            sexpr_lookup(node, "device/tap2")) {
             char *offset;
             const char *src = NULL;
             const char *dst = NULL;
@@ -1397,10 +1398,14 @@ xenDaemonParseSxprDisks(virDomainDefPtr def,
                 src = sexpr_node(node, "device/vbd/uname");
                 dst = sexpr_node(node, "device/vbd/dev");
                 mode = sexpr_node(node, "device/vbd/mode");
-            } else {
+            } else if (sexpr_lookup(node, "device/tap")) {
                 src = sexpr_node(node, "device/tap/uname");
                 dst = sexpr_node(node, "device/tap/dev");
                 mode = sexpr_node(node, "device/tap/mode");
+            } else {
+                src = sexpr_node(node, "device/tap2/uname");
+                dst = sexpr_node(node, "device/tap2/dev");
+                mode = sexpr_node(node, "device/tap2/mode");
             }
 
             if (VIR_ALLOC(disk) < 0)
-- 
1.6.0.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]