benian wrote: > Hi Jim, > Thanks for your reply! > > I use xm create to create a tap2 disk and it works well > > disk = [ 'tap2:vhd:/root/tapdisk/vhd-f12,hda,w'] > > > but virsh dumpxml can't get anything about the disk > > > After i apply the patch, i can catch <disk> information by virsh dumpxml > but it seems that it only recognize "tap" only but not tap2 > > <disk type='file' device='disk'> > <driver name='tap' type='vhd'/> > <source file='/root/tapdisk/vhd-f12'/> > <target dev='hda' bus='ide'/> > </disk> > > Afterwards i try to use this xml file to virsh create VM and no > active disk is found. Opps, I forgot to account for tap2 in functions that generate sexpr. V2 attached. Regards, Jim
>From 6320c63d7c5077cf27050a567ca9d7ab7c17b189 Mon Sep 17 00:00:00 2001 From: Jim Fehlig <jfehlig@xxxxxxxxxx> Date: Tue, 24 Aug 2010 11:26:15 -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 and generating sexp containing 'tap2' prefix. V2: Also generate sexp containing tap2 device type --- src/xen/xend_internal.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index d47c625..1870d5b 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,6 +1398,10 @@ 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 if (sexpr_lookup(node, "device/tap2")) { + src = sexpr_node(node, "device/tap2/uname"); + dst = sexpr_node(node, "device/tap2/dev"); + mode = sexpr_node(node, "device/tap2/mode"); } else { src = sexpr_node(node, "device/tap/uname"); dst = sexpr_node(node, "device/tap/dev"); @@ -1444,7 +1449,8 @@ xenDaemonParseSxprDisks(virDomainDefPtr def, src = offset + 1; - if (STREQ (disk->driverName, "tap")) { + if (STREQ (disk->driverName, "tap") || + STREQ (disk->driverName, "tap2")) { offset = strchr(src, ':'); if (!offset) { virXendError(VIR_ERR_INTERNAL_ERROR, @@ -5306,9 +5312,10 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, /* Normally disks are in a (device (vbd ...)) block * but blktap disks ended up in a differently named * (device (tap ....)) block.... */ - if (def->driverName && - STREQ(def->driverName, "tap")) { + if (def->driverName && STREQ(def->driverName, "tap")) { virBufferAddLit(buf, "(tap "); + } else if (def->driverName && STREQ(def->driverName, "tap2")) { + virBufferAddLit(buf, "(tap2 "); } else { virBufferAddLit(buf, "(vbd "); } @@ -5329,7 +5336,8 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, if (def->src) { if (def->driverName) { - if (STREQ(def->driverName, "tap")) { + if (STREQ(def->driverName, "tap") || + STREQ(def->driverName, "tap2")) { virBufferVSprintf(buf, "(uname '%s:%s:%s')", def->driverName, def->driverType ? def->driverType : "aio", @@ -5928,6 +5936,9 @@ virDomainXMLDevID(virDomainPtr domain, if (dev->data.disk->driverName && STREQ(dev->data.disk->driverName, "tap")) strcpy(class, "tap"); + else if (dev->data.disk->driverName && + STREQ(dev->data.disk->driverName, "tap2")) + strcpy(class, "tap2"); else strcpy(class, "vbd"); -- 1.6.0.2
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list