[libvirt] Need your help
by Alex Jia
Hi all,
I want to use the utility library in the python directory such as
VIR_FREE, virTypedParameterArrayClear, or anything else from util,
I studied daemon/Makefile.am then changed python/Makefile.am, for
instance, to append '-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \',
'-I$(top_srcdir)/src -I../src \' and '-I$(top_srcdir)/src/util \'
into 'INCLUDES' section in python/Makefile.am, moreover, including
util.h and memory.h in libvirt-override.c. However, I got many
compilation warnings and errors, it seems my change is overwriting
previous header file path.
I wonder how to avoid this, could you give me some advice?
Thanks in advance,
Alex
12 years, 11 months
[libvirt] [PATCH v2] Allow 10 chars for domain IDs & 30 chars for names in virsh list
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Domain IDs are at least 16 bits for most hypervisors, theoretically
event 32-bits. 3 characters is clearly too small an alignment.
Increase alignment to 10 characters to allow 32-bit domain IDs to
display cleanly. Commonly seen with LXC where domain IDs are the
process IDs by default. Also increase the 'name' field from 20
to 30 characters to cope with longer guest names which are quite
common
In v2:
- Increase size to 10 chars
- Left align ID values
- Also increase name field to 30
- Increase number of '-' to compensate
---
tools/virsh.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index f4c0063..9da906e 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -944,8 +944,8 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&names[0], maxname, sizeof(char*), namesorter);
}
}
- vshPrintExtra(ctl, "%3s %-20s %s\n", _("Id"), _("Name"), _("State"));
- vshPrintExtra(ctl, "----------------------------------\n");
+ vshPrintExtra(ctl, " %-10s %-30s %s\n", _("Id"), _("Name"), _("State"));
+ vshPrintExtra(ctl, "----------------------------------------------------\n");
for (i = 0; i < maxid; i++) {
virDomainPtr dom = virDomainLookupByID(ctl->conn, ids[i]);
@@ -954,7 +954,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (!dom)
continue;
- vshPrint(ctl, "%3d %-20s %s\n",
+ vshPrint(ctl, " %-10d %-30s %s\n",
virDomainGetID(dom),
virDomainGetName(dom),
_(vshDomainStateToString(vshDomainState(ctl, dom, NULL))));
@@ -974,7 +974,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virDomainHasManagedSaveImage(dom, 0) > 0)
state = -2;
- vshPrint(ctl, "%3s %-20s %s\n",
+ vshPrint(ctl, " %-10s %-30s %s\n",
"-",
names[i],
state == -2 ? _("saved") : _(vshDomainStateToString(state)));
--
1.7.7.5
12 years, 11 months
[libvirt] [PATCH v2 0/6] Allow minimal bandwidth guarantee
by Michal Privoznik
Since 0.9.4 release libvirt supports setting some QoS attributes on virtual
bridges and/or virtual interfaces. Average and peak rate, namely. It lacks
minimal guaranteed bandwidth aka 'floor' attribute, though. This patch set
tries to fill that hole. However, there are some things you want to know before
diving into individual patches:
1) Hierarchical shaping
The whole magic hidden in here: Classes [1] can have multiple children and form
a tree. A class can borrow unused bandwidth from other sibling classes up
to its 'ceil'. This is done in kernel, though. Classes does not share any info
among interfaces. Therefore we need to group traffic from domain interfaces
so it goes over one point (a bridge). It is now obvious why this functionality
is limited to VIR_DOMAIN_NET_TYPE_NETWORK only as the other bridged network
type (VIR_DOMAIN_NET_TYPE_BRIDGE:) is meant to be not managed or touched
by libvirt at all.
This patches build that tree of classes. On network startup, a root class
with one child class are created. This child is supposed to be catchment for
all interfaces which will ever be plugged and don't have any 'floor'.
Once we have network prepared, an interface may be plugged in. That means
on a domain startup, as we create virtual devices for a domain and plug
them into a bridge, we can create separate class for created interface
(if it is needed = has 'floor' set). Class are distinguished by u_int16
identifier which:
- needs to be unique among one bridge, obviously
- we want to keep, and pass on interface unplugging
2) Network status file
Because of the class ID I am mentioning above, I found myself in need of
saving next free class ID among with network, so it survives daemon reboots.
That's what 5th patch does actually.
On interface plug event an unique class ID is taken and on successful
QoS set it is stored into an interface. Having said that, domain status
XML was extended to keep pair <interface alias; class id>
3) Tying interface traffic with class
is done via filter [2]. Filters direct packets into a classes during which
packet undergoes examination. Such filter is caller classifier. For example,
filter classify packets based on their marks, src/dest ip address, port, etc.
And here comes another magic trick. But not so nice as the first one.
Libvirt does not know anything about guest (interface) ip address(es).
The only thing that libvirt knows for sure is MAC address. But for some reason,
filters refuse to use ebtables marks even if iptables marks works well.
Filters, however does not support classifying by MAC address. Well, not directly.
u32 filter can match any part of a packet at any offset. Offset 0 is
start of IP header. And offsets can be negative :)
1: http://tldp.org/HOWTO/Traffic-Control-HOWTO/components.html#c-class
2: http://tldp.org/HOWTO/Traffic-Control-HOWTO/components.html#c-filter
diff to v1:
-rebased & resolved minor conflicts
Michal Privoznik (6):
bandwidth: add new 'floor' attribute
bandwidth: Create hierarchical shaping classes
bandwidth: Create (un)plug functions
bandwidth: Create network (un)plug functions
network: Create status files
domain: Keep assigned class_id in domstatus XML
daemon/libvirtd.c | 3 +
docs/formatdomain.html.in | 21 +++-
docs/schemas/networkcommon.rng | 5 +
po/POTFILES.in | 1 +
src/conf/domain_conf.c | 10 +-
src/conf/domain_conf.h | 1 +
src/conf/netdev_bandwidth_conf.c | 81 +++++++++++---
src/conf/netdev_bandwidth_conf.h | 3 +-
src/conf/network_conf.c | 224 ++++++++++++++++++++++++++++++++------
src/conf/network_conf.h | 9 ++
src/libvirt_network.syms | 2 +
src/libvirt_private.syms | 2 +
src/lxc/lxc_driver.c | 3 +-
src/network/bridge_driver.c | 109 +++++++++++++++++--
src/network/bridge_driver.h | 7 +
src/qemu/qemu_command.c | 20 +++-
src/qemu/qemu_domain.c | 66 ++++++++++-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 12 ++
src/util/virnetdevbandwidth.c | 205 +++++++++++++++++++++++++++++++++-
src/util/virnetdevbandwidth.h | 19 +++-
src/util/virnetdevmacvlan.c | 2 +-
22 files changed, 714 insertions(+), 93 deletions(-)
--
1.7.3.4
12 years, 11 months
[libvirt] RFC: Compiling out SSL support
by Mikhail Gusarov
Hi.
Attached is the RFC version of patch (against old version of libvirt)
which compiles out support for SSL encryption on libvirt connections.
It is meant only to provoke a discussion whether such option is deemed
acceptable to libvirt, or it would be a complete waste of time to rebase
this patch to current git and improve it by disabling other SSL-related
functionality.
The motivation behind the change: making possible to configure libvirt
to rely on absolute minimum of other libraries. Resulting configuration
ought to connect to local libvirt daemon through Unix sockets.
--
Mikhail Gusarov
Software Engineer
CFEngine AS
Nydalsveien 33
0484 Oslo
12 years, 11 months
[libvirt] [PATCH] Allow 5 characters for domain IDs
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Domain IDs are at least 16 bits for most hypervisors, theoretically
event 32-bits. 3 characters is clearly too small an alignment.
Increase alignment to 5 characters to allow 16-bit domain IDs to
display cleanly. Commonly seen with LXC where domain IDs are the
process IDs by default
---
tools/virsh.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index f4c0063..e3aca32 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -944,7 +944,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
qsort(&names[0], maxname, sizeof(char*), namesorter);
}
}
- vshPrintExtra(ctl, "%3s %-20s %s\n", _("Id"), _("Name"), _("State"));
+ vshPrintExtra(ctl, "%5s %-20s %s\n", _("Id"), _("Name"), _("State"));
vshPrintExtra(ctl, "----------------------------------\n");
for (i = 0; i < maxid; i++) {
@@ -954,7 +954,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
if (!dom)
continue;
- vshPrint(ctl, "%3d %-20s %s\n",
+ vshPrint(ctl, "%5d %-20s %s\n",
virDomainGetID(dom),
virDomainGetName(dom),
_(vshDomainStateToString(vshDomainState(ctl, dom, NULL))));
@@ -974,7 +974,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
virDomainHasManagedSaveImage(dom, 0) > 0)
state = -2;
- vshPrint(ctl, "%3s %-20s %s\n",
+ vshPrint(ctl, "%5s %-20s %s\n",
"-",
names[i],
state == -2 ? _("saved") : _(vshDomainStateToString(state)));
--
1.7.7.5
12 years, 11 months
[libvirt] [PATCH] stream: Check for stream EOF
by Michal Privoznik
If client stream does not have any data to sink and neither received
EOF, a dummy packet is sent to the daemon signalising client is ready to
sink some data. However, after we added event loop to client a race may
occur:
Thread 1 calls virNetClientStreamRecvPacket and since no data are cached
nor stream has EOF, it decides to send dummy packet to server which will
sent some data in turn. However, during this decision and actual message
exchange with server -
Thread 2 receives last stream data from server. Therefore an EOF is set
on stream and if there is a call waiting (which is not yet) it is woken
up. However, Thread 1 haven't sent anything so far, so there is no call
to be woken up. So this thread sent dummy packet to daemon, which
ignores that as no stream is associated with such packet and therefore
no reply will ever come.
---
To get better image, here are logs: http://pastebin.com/BQEbu8Zh
- on line 18 we decide to send dummy packet
- on line 21 we enqueue EOF packet but there is no call to wake up yet
- on line 24/26 the dummy packet is sent
src/rpc/virnetclient.c | 37 ++++++++++++++++++++++++++++++++++---
src/rpc/virnetclient.h | 3 +++
src/rpc/virnetclientstream.c | 7 ++++++-
src/rpc/virnetclientstream.h | 1 +
4 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 469c6a5..3ea1a8f 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1672,6 +1672,7 @@ done:
*/
static int virNetClientSendInternal(virNetClientPtr client,
virNetMessagePtr msg,
+ virNetClientStreamPtr st,
bool expectReply,
bool nonBlock)
{
@@ -1711,6 +1712,15 @@ static int virNetClientSendInternal(virNetClientPtr client,
goto cleanup;
}
+ /* Other thread might have already received
+ * stream EOF so we don't want sent anything.
+ * Server won't respond anyway.
+ */
+ if (virNetClientStreamEOF(st)) {
+ ret = 0;
+ goto cleanup;
+ }
+
if (virCondInit(&call->cond) < 0) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot initialize condition variable"));
@@ -1757,7 +1767,7 @@ cleanup:
int virNetClientSendWithReply(virNetClientPtr client,
virNetMessagePtr msg)
{
- int ret = virNetClientSendInternal(client, msg, true, false);
+ int ret = virNetClientSendInternal(client, msg, NULL, true, false);
if (ret < 0)
return -1;
return 0;
@@ -1777,7 +1787,7 @@ int virNetClientSendWithReply(virNetClientPtr client,
int virNetClientSendNoReply(virNetClientPtr client,
virNetMessagePtr msg)
{
- int ret = virNetClientSendInternal(client, msg, false, false);
+ int ret = virNetClientSendInternal(client, msg, NULL, false, false);
if (ret < 0)
return -1;
return 0;
@@ -1796,5 +1806,26 @@ int virNetClientSendNoReply(virNetClientPtr client,
int virNetClientSendNonBlock(virNetClientPtr client,
virNetMessagePtr msg)
{
- return virNetClientSendInternal(client, msg, false, true);
+ return virNetClientSendInternal(client, msg, NULL, false, true);
+}
+
+/*
+ * @msg: a message allocated on heap or stack
+ *
+ * Send a message synchronously, and wait for the reply synchronously
+ *
+ * The caller is responsible for free'ing @msg if it was allocated
+ * on the heap
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int virNetClientSendWithReplyStream(virNetClientPtr client,
+ virNetMessagePtr msg,
+ virNetClientStreamPtr st)
+{
+ int ret = virNetClientSendInternal(client, msg, st, true, false);
+ if (ret < 0)
+ return -1;
+ return 0;
}
+
diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h
index 61d51e1..7c30d2b 100644
--- a/src/rpc/virnetclient.h
+++ b/src/rpc/virnetclient.h
@@ -76,6 +76,9 @@ int virNetClientSendNoReply(virNetClientPtr client,
int virNetClientSendNonBlock(virNetClientPtr client,
virNetMessagePtr msg);
+int virNetClientSendWithReplyStream(virNetClientPtr client,
+ virNetMessagePtr msg,
+ virNetClientStreamPtr st);
# ifdef HAVE_SASL
void virNetClientSetSASLSession(virNetClientPtr client,
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index a4292e7..0b3e4f5 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -408,7 +408,7 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
VIR_DEBUG("Dummy packet to wait for stream data");
virMutexUnlock(&st->lock);
- ret = virNetClientSendWithReply(client, msg);
+ ret = virNetClientSendWithReplyStream(client, msg, st);
virMutexLock(&st->lock);
virNetMessageFree(msg);
@@ -530,3 +530,8 @@ cleanup:
virMutexUnlock(&st->lock);
return ret;
}
+
+bool virNetClientStreamEOF(virNetClientStreamPtr st)
+{
+ return st ? st->incomingEOF : false;
+}
diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index 6c8d538..07a335a 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -72,5 +72,6 @@ int virNetClientStreamEventUpdateCallback(virNetClientStreamPtr st,
int events);
int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st);
+bool virNetClientStreamEOF(virNetClientStreamPtr st);
#endif /* __VIR_NET_CLIENT_STREAM_H__ */
--
1.7.3.4
12 years, 11 months
[libvirt] [PATCH 0/5 v3] Interface pools and passthrough mode
by Shradha Shah
Interface Pools and Passthrough mode:
Current Method:
The passthrough mode uses a macvtap direct connection to connect each
guest to the network. The physical interface to be used is picked from
among those listed in <interface> sub elements of the <forward> element.
The current specification for <forward> extends to allow 0 or more
<interface> sub-elements:
Example:
<forward mode='passthrough' dev='eth10'/>
<interface dev='eth10'/>
<interface dev='eth12'/>
<interface dev='eth18'/>
<interface dev='eth20'/>
</forward>
However with an ethernet card with 64 VF's or more, the above method
gets tedious on the system.
On the other hand, just parameterizing a string (eth%d) is inadequate,
eg, when there are multiple non-contiguous ranges.
Proposed Method:
The 4 patches provided:
i) Introduce a new element 'pf' to implicitly create an interface pool
of all the Virtual Functions attached to the specified Physical
Function.
ii) Modify the networkAllocateActualDevice, networkNotifyActualDevice
and networkReleaseActualDevice API to use the above mentioned interface
pool in the passthrough mode.
iii) Allow virsh net-dumpxml to use an option --inactive to
differentiate between explicit and implicit interface pools
Hence Libvirt will now support both the methods mentioned below:
* Explicit interface list. App inputs:
<forward mode='passthrough'>
<interface dev='eth10'/>
<interface dev='eth11'/>
<interface dev='eth12'/>
<interface dev='eth13'/>
</forward>
libvirt does not change XML
* Automatically interface list from PF. App inputs:
<forward mode='passthrough'>
<pf dev='eth0'/>
</forward>
libvirt expands XML to be
<forward mode='passthrough'>
<pf dev='eth0'/>
<interface dev='eth10'/>
<interface dev='eth11'/>
<interface dev='eth12'/>
<interface dev='eth13'/>
</forward>
In the above case we need to differentiate between the implicit and
explicit interface pool, which can be done by comparing the dumpxml from
active and inactive domains.
This will need the addition of the flag VIR_NETWORK_XML_INACTIVE to
virNetworkGetXMLDesc().
This patch series supports the use of option --inactive with virsh
net-dumpxml.
Shradha Shah (5):
Added function pciSysfsFile to enable access to the PCI SYSFS files.
Added Function virNetDevGetVirtualFunctions
Adding the element pf to network xml.
Functionality to implicitly get interface pool from SR-IOV PF.
Added new option to virsh net-dumpxml called --inactive
docs/schemas/network.rng | 7 +++
include/libvirt/libvirt.h.in | 4 ++
src/conf/network_conf.c | 79 +++++++++++++++++++++++++++++++---
src/conf/network_conf.h | 5 ++-
src/network/bridge_driver.c | 97 ++++++++++++++++++++++++++++++++---------
src/test/test_driver.c | 2 +-
src/util/pci.c | 39 +++++++++++++++++
src/util/pci.h | 7 +++
src/util/virnetdev.c | 83 ++++++++++++++++++++++++++++++++++++
src/util/virnetdev.h | 6 +++
src/vbox/vbox_tmpl.c | 2 +-
tests/networkxml2xmltest.c | 2 +-
tools/virsh.c | 13 +++++-
13 files changed, 311 insertions(+), 35 deletions(-)
--
1.7.4.4
12 years, 11 months
[libvirt] [PATCH] docs: Add missed RNG schema for interface
by Osier Yang
We support <interface> of type "mcast", "server", and "client",
but the RNG schema for them are missed.
---
docs/schemas/domaincommon.rng | 44 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e93ae77..2caa781 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1295,6 +1295,50 @@
<ref name="interface-options"/>
</interleave>
</group>
+ <group>
+ <attribute name="type">
+ <value>mcast</value>
+ </attribute>
+ <element name="source">
+ <attribute name="address">
+ <ref name="ipv4Addr"/>
+ </attribute>
+ <attribute name="port">
+ <ref name="PortNumber"/>
+ </attribute>
+ <empty/>
+ </element>
+ </group>
+ <group>
+ <attribute name="type">
+ <value>client</value>
+ </attribute>
+ <element name="source">
+ <attribute name="address">
+ <ref name="ipv4Addr"/>
+ </attribute>
+ <attribute name="port">
+ <ref name="PortNumber"/>
+ </attribute>
+ <empty/>
+ </element>
+ </group>
+ <group>
+ <attribute name="type">
+ <value>server</value>
+ </attribute>
+ <element name="source">
+ <optional>
+ <attribute name="address">
+ <ref name="ipv4Addr"/>
+ </attribute>
+ </optional>
+ <attribute name="port">
+ <ref name="PortNumber"/>
+ </attribute>
+ <empty/>
+ </element>
+ </group>
</choice>
</element>
</define>
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH] virsh: New command print summary of all virtual interfaces
by Osier Yang
Just like command "domblklist", the command extracts "type",
"source", "target", "model", and "MAC" of all virtual interfaces
from domain XML (live or persistent).
---
tools/virsh.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 9 +++++
2 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index fb940b8..3af2fd7 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1984,6 +1984,103 @@ cleanup:
}
/*
+ * "domiflist" command
+ */
+static const vshCmdInfo info_domiflist[] = {
+ {"help", N_("list all domain virtual interfaces")},
+ {"desc", N_("Get the summary of virtual interfaces for a domain.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_domiflist[] = {
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+ {"inactive", VSH_OT_BOOL, 0,
+ N_("get inactive rather than running configuration")},
+ {NULL, 0, 0, NULL}
+};
+
+static bool
+cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
+{
+ virDomainPtr dom;
+ bool ret = false;
+ unsigned int flags = 0;
+ char *xml = NULL;
+ xmlDocPtr xmldoc = NULL;
+ xmlXPathContextPtr ctxt = NULL;
+ int ninterfaces;
+ xmlNodePtr *interfaces = NULL;
+ int i;
+
+ if (vshCommandOptBool(cmd, "inactive"))
+ flags |= VIR_DOMAIN_XML_INACTIVE;
+
+ if (!vshConnectionUsability(ctl, ctl->conn))
+ return false;
+
+ if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
+ return false;
+
+ xml = virDomainGetXMLDesc(dom, flags);
+ if (!xml)
+ goto cleanup;
+
+ xmldoc = virXMLParseStringCtxt(xml, _("(domain_definition)"), &ctxt);
+ if (!xmldoc)
+ goto cleanup;
+
+ ninterfaces = virXPathNodeSet("./devices/interface", ctxt, &interfaces);
+ if (ninterfaces < 0)
+ goto cleanup;
+
+ vshPrint(ctl, "%-10s %-10s %-10s %-11s %s\n", _("Type"), _("Source"),
+ _("Target"), _("Model"), _("MAC"));
+ vshPrint(ctl, "-------------------------------------------------------\n");
+
+ for (i = 0; i < ninterfaces; i++) {
+ char *type = NULL;
+ char *source = NULL;
+ char *target = NULL;
+ char *model = NULL;
+ char *mac = NULL;
+
+ ctxt->node = interfaces[i];
+ type = virXPathString("string(./@type)", ctxt);
+
+ source = virXPathString("string(./source/@bridge"
+ "|./source/@dev"
+ "|./source/@network"
+ "|./source/@name)", ctxt);
+
+ target = virXPathString("string(./target/@dev)", ctxt);
+ model = virXPathString("string(./model/@type)", ctxt);
+ mac = virXPathString("string(./mac/@address)", ctxt);
+
+ vshPrint(ctl, "%-10s %-10s %-10s %-11s %-10s\n", type,
+ source ? source : "-",
+ target ? target : "-",
+ model ? model : "-",
+ mac ? mac : "-");
+
+ VIR_FREE(type);
+ VIR_FREE(source);
+ VIR_FREE(target);
+ VIR_FREE(model);
+ VIR_FREE(mac);
+ }
+
+ ret = true;
+
+cleanup:
+ VIR_FREE(interfaces);
+ virDomainFree(dom);
+ VIR_FREE(xml);
+ xmlFreeDoc(xmldoc);
+ xmlXPathFreeContext(ctxt);
+ return ret;
+}
+
+/*
* "suspend" command
*/
static const vshCmdInfo info_suspend[] = {
@@ -15595,6 +15692,7 @@ static const vshCmdDef domMonitoringCmds[] = {
{"domblkstat", cmdDomblkstat, opts_domblkstat, info_domblkstat, 0},
{"domcontrol", cmdDomControl, opts_domcontrol, info_domcontrol, 0},
{"domif-getlink", cmdDomIfGetLink, opts_domif_getlink, info_domif_getlink, 0},
+ {"domiflist", cmdDomiflist, opts_domiflist, info_domiflist, 0},
{"domifstat", cmdDomIfstat, opts_domifstat, info_domifstat, 0},
{"dominfo", cmdDominfo, opts_dominfo, info_dominfo, 0},
{"dommemstat", cmdDomMemStat, opts_dommemstat, info_dommemstat, 0},
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 1abf448..bae6a13 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -522,6 +522,15 @@ domain. Other contexts that require a block device name (such as
I<domblkinfo> or I<snapshot-create> for disk snapshots) will accept
either target or unique source names printed by this command.
+=item B<domiflist> I<domain> [I<--inactive>]
+
+Print a table showing the brief information of all virtual interfaces
+associated with I<domain>. If I<--inactive> is specified, query the
+virtual interfaces that will be used on the next boot, rather than those
+currently in use by a running domain. Other contexts that require a MAC
+address of virtual interface (such as I<detach-interface> or
+I<domif-setlink>) will accept the MAC address printed by this command.
+
=item B<blockpull> I<domain> I<path> [I<bandwidth>]
Populate a disk from its backing image. Once all data from its backing
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH v2] Do not generate security_model when fs driver is anything but 'path'
by Deepak C Shetty
QEMU does not support security_model for anything but 'path' fs driver type.
Currently in libvirt, when security_model ( accessmode attribute) is not
specified it auto-generates it irrespective of the fs driver type, which
can result in a qemu error for drivers other than path. This patch ensures
that the qemu cmdline is correctly generated by taking into account the
fs driver type.
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
v2:
- removed xml accessmode changes as suggested by dan.
- every fs driver having a default accessmode always, retained.
src/qemu/qemu_command.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ea1b763..e3a509a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2098,13 +2098,24 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
}
virBufferAdd(&opt, driver, -1);
- if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
- virBufferAddLit(&opt, ",security_model=mapped");
- } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
- virBufferAddLit(&opt, ",security_model=passthrough");
- } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
- virBufferAddLit(&opt, ",security_model=none");
+ if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_PATH ||
+ fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
+ if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
+ virBufferAddLit(&opt, ",security_model=mapped");
+ } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
+ virBufferAddLit(&opt, ",security_model=passthrough");
+ } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
+ virBufferAddLit(&opt, ",security_model=none");
+ }
+ } else {
+ /* For other fs drivers, default(passthru) should always */
+ /* be supported */
+ if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("only supports passthrough accessmode"));
+ }
}
+
virBufferAsprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias);
virBufferAsprintf(&opt, ",path=%s", fs->src);
12 years, 11 months