[libvirt] [PATCH] test: include qemuhotplugtest data files in source rpm
by Laine Stump
commit 0fc12bca added a new test called qemuhotplugtest which has
several data files in tests/qemuhotplugtestdata, but didn't add that
directory to EXTRA_DIST in the tests Makefile.am, so the make check
done during a make rpm was failing due to missing data files.
---
Pushed under the build breaker rule.
tests/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a019eb9..4c49151 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -80,6 +80,7 @@ EXTRA_DIST = \
nwfilterxml2xmlout \
oomtrace.pl \
qemuhelpdata \
+ qemuhotplugtestdata \
qemuxml2argvdata \
qemuxml2xmloutdata \
qemuxmlnsdata \
--
1.7.11.7
11 years, 6 months
[libvirt] [PATCHv4] Configure native vlan modes on Open vSwitch ports
by james robson
This patch adds functionality to allow libvirt to configure the
'native-tagged' and 'native-untagged' modes on openvswitch networks.
v2 changes:
Fix problems reported by Eric Blake
v3 changes:
Re work patch to address review comments
v4 changes:
Use enum for native modes
---
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9284534..ba32185 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3498,6 +3498,13 @@ qemu-kvm -net nic,model=? /dev/null
<parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
</virtualport>
</interface>
+ <interface type='bridge'>
+ <b><vlan trunk='yes'></b>
+ <b><tag id='42'/></b>
+ <b><tag id='123' nativeMode='untagged'/></b>
+ <b></vlan></b>
+ ...
+ </interface>
<devices>
...</pre>
@@ -3524,6 +3531,15 @@ qemu-kvm -net nic,model=? /dev/null
vlan element.
</p>
+ <p>
+ For network connections using openvswitch it is possible to
+ configure the 'native-tagged' and 'native-untagged' vlan modes
+ <span class="since">(Since 1.0.5).</span> This uses the optional
+ <code>nativeMode</code> attribute on the <code><tag></code>
+ element: <code>nativeMode</code> may be set to 'tagged' or
+ 'untagged'. The id atribute of the element sets the native vlan.
+ </p>
+
<h5><a name="elementLink">Modifying virtual link state</a></h5>
<pre>
...
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index a1198ce..29e12d9 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -446,6 +446,13 @@
<parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
</virtualport>
</interface>
+ <interface type='bridge'>
+ <b><vlan trunk='yes'></b>
+ <b><tag id='42'/></b>
+ <b><tag id='123' nativeMode='untagged'/></b>
+ <b></vlan></b>
+ ...
+ </interface>
<devices>
...</pre>
@@ -469,6 +476,14 @@
be added to the vlan element.
</p>
<p>
+ For network connections using openvswitch it is possible to
+ configure the 'native-tagged' and 'native-untagged' vlan modes
+ <span class="since">(Since 1.0.6).</span> This uses the optional
+ <code>nativeMode</code> attribute on the <code><tag></code>
+ element: <code>nativeMode</code> may be set to 'tagged' or
+ 'untagged'. The id atribute of the element sets the native vlan.
+ </p>
+ <p>
<code><vlan></code> elements can also be specified in
a <code><portgroup></code> element, as well as directly in
a domain's <code><interface></code> element. In the case
diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng
index 51ff759..e60f1fc 100644
--- a/docs/schemas/networkcommon.rng
+++ b/docs/schemas/networkcommon.rng
@@ -204,6 +204,14 @@
<param name="maxInclusive">4095</param>
</data>
</attribute>
+ <optional>
+ <attribute name="nativeMode">
+ <choice>
+ <value>tagged</value>
+ <value>untagged</value>
+ </choice>
+ </attribute>
+ </optional>
<empty/>
</element>
</oneOrMore>
diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index 13ba8c6..2b4cd48 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -17,6 +17,7 @@
*
* Authors:
* Laine Stump <laine(a)redhat.com>
+ * James Robson <jrobson(a)websense.com>
*/
#include <config.h>
@@ -27,12 +28,15 @@
#define VIR_FROM_THIS VIR_FROM_NONE
+VIR_ENUM_IMPL(virNativeVlanMode, VIR_NATIVE_VLAN_MODE_LAST, "default", "tagged", "untagged")
+
int
virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr def)
{
int ret = -1;
xmlNodePtr save = ctxt->node;
const char *trunk = NULL;
+ const char *nativeMode = NULL;
xmlNodePtr *tagNodes = NULL;
int nTags, ii;
@@ -54,6 +58,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
goto error;
}
+ def->nativeMode = 0;
+ def->nativeTag = 0;
for (ii = 0; ii < nTags; ii++) {
unsigned long id;
@@ -68,6 +74,19 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
_("vlan tag id %lu too large (maximum 4095)"), id);
goto error;
}
+ if ((nativeMode = virXPathString("string(./@nativeMode)", ctxt)) != NULL) {
+ if (def->nativeMode != 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("duplicate native vlan setting"));
+ goto error;
+ }
+ if ((def->nativeMode = virNativeVlanModeTypeFromString(nativeMode)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Attribute \"nativeMode='%s'\" is invalid"), nativeMode);
+ goto error;
+ }
+ def->nativeTag = id;
+ }
def->tag[ii] = id;
}
@@ -89,6 +108,12 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
"is required for more than one vlan tag"), trunk);
goto error;
}
+ if (def->nativeMode != 0) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("invalid configuration in <vlan> - \"trunk='no'\" is "
+ "not allowed with a native vlan id"));
+ goto error;
+ }
/* allow (but discard) "trunk='no' if there is a single tag */
if (STRCASENEQ(trunk, "no")) {
virReportError(VIR_ERR_XML_ERROR,
@@ -125,7 +150,17 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : "");
for (ii = 0; ii < def->nTags; ii++) {
- virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[ii]);
+ if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT && def->nativeTag == def->tag[ii]) {
+ /* check the nativeMode in case we get <tag id='0'/>*/
+ const char *mode = virNativeVlanModeTypeToString(def->nativeMode);
+ if (!mode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Bad vlaue for nativeMode"));
+ }
+ virBufferAsprintf(buf, " <tag id='%u' nativeMode='%s'/>\n", def->tag[ii], mode);
+ } else {
+ virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[ii]);
+ }
}
virBufferAddLit(buf, "</vlan>\n");
return 0;
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 2aee445..47e6027 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -109,8 +109,22 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
virCommandAddArgList(cmd, "--timeout=5", "--", "--may-exist", "add-port",
brname, ifname, NULL);
- if (virBufferUse(&buf) != 0)
+ if (virBufferUse(&buf) != 0) {
+ switch (virtVlan->nativeMode) {
+ case VIR_NATIVE_VLAN_MODE_TAGGED:
+ virCommandAddArg(cmd, "vlan_mode=native-tagged");
+ virCommandAddArgFormat(cmd, "tag=%d", virtVlan->nativeTag);
+ break;
+ case VIR_NATIVE_VLAN_MODE_UNTAGGED:
+ virCommandAddArg(cmd, "vlan_mode=native-untagged");
+ virCommandAddArgFormat(cmd, "tag=%d", virtVlan->nativeTag);
+ break;
+ case VIR_NATIVE_VLAN_MODE_DEFAULT:
+ default:
+ break;
+ }
virCommandAddArgList(cmd, virBufferCurrentContent(&buf), NULL);
+ }
if (ovsport->profileID[0] == '\0') {
virCommandAddArgList(cmd,
diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c
index 2fe2017..eed32f7 100644
--- a/src/util/virnetdevvlan.c
+++ b/src/util/virnetdevvlan.c
@@ -33,6 +33,8 @@ virNetDevVlanClear(virNetDevVlanPtr vlan)
{
VIR_FREE(vlan->tag);
vlan->nTags = 0;
+ vlan->nativeMode = 0;
+ vlan->nativeTag = 0;
}
void
@@ -54,7 +56,9 @@ virNetDevVlanEqual(const virNetDevVlanPtr a, const virNetDevVlanPtr b)
return false;
if (a->trunk != b->trunk ||
- a->nTags != b->nTags) {
+ a->nTags != b->nTags ||
+ a->nativeMode != b->nativeMode ||
+ a->nativeTag != b->nativeTag) {
return false;
}
@@ -89,6 +93,8 @@ virNetDevVlanCopy(virNetDevVlanPtr dst, const virNetDevVlanPtr src)
dst->trunk = src->trunk;
dst->nTags = src->nTags;
+ dst->nativeMode = src->nativeMode;
+ dst->nativeTag = src->nativeTag;
memcpy(dst->tag, src->tag, src->nTags * sizeof(*src->tag));
return 0;
}
diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h
index c6b16ef..a084938 100644
--- a/src/util/virnetdevvlan.h
+++ b/src/util/virnetdevvlan.h
@@ -18,16 +18,28 @@
* Authors:
* Laine Stump <laine(a)redhat.com>
*/
-
+# include <virutil.h>
#ifndef __VIR_NETDEV_VLAN_H__
# define __VIR_NETDEV_VLAN_H__
+typedef enum {
+ VIR_NATIVE_VLAN_MODE_DEFAULT = 0,
+ VIR_NATIVE_VLAN_MODE_TAGGED,
+ VIR_NATIVE_VLAN_MODE_UNTAGGED,
+
+ VIR_NATIVE_VLAN_MODE_LAST
+} virNativeVlanMode;
+
+VIR_ENUM_DECL(virNativeVlanMode)
+
typedef struct _virNetDevVlan virNetDevVlan;
typedef virNetDevVlan *virNetDevVlanPtr;
struct _virNetDevVlan {
bool trunk; /* true if this is a trunk */
int nTags; /* number of tags in array */
unsigned int *tag; /* pointer to array of tags */
+ int nativeMode;
+ unsigned int nativeTag;
};
void virNetDevVlanClear(virNetDevVlanPtr vlan);
diff --git a/tests/networkxml2xmlin/openvswitch-net.xml b/tests/networkxml2xmlin/openvswitch-net.xml
index a3d82b1..2f6084d 100644
--- a/tests/networkxml2xmlin/openvswitch-net.xml
+++ b/tests/networkxml2xmlin/openvswitch-net.xml
@@ -21,4 +21,13 @@
<parameters profileid='alice-profile'/>
</virtualport>
</portgroup>
+ <portgroup name='native'>
+ <vlan trunk='yes'>
+ <tag id='123' nativeMode='tagged'/>
+ <tag id='444'/>
+ </vlan>
+ <virtualport>
+ <parameters profileid='native-profile'/>
+ </virtualport>
+ </portgroup>
</network>
diff --git a/tests/networkxml2xmlout/openvswitch-net.xml b/tests/networkxml2xmlout/openvswitch-net.xml
index a3d82b1..2f6084d 100644
--- a/tests/networkxml2xmlout/openvswitch-net.xml
+++ b/tests/networkxml2xmlout/openvswitch-net.xml
@@ -21,4 +21,13 @@
<parameters profileid='alice-profile'/>
</virtualport>
</portgroup>
+ <portgroup name='native'>
+ <vlan trunk='yes'>
+ <tag id='123' nativeMode='tagged'/>
+ <tag id='444'/>
+ </vlan>
+ <virtualport>
+ <parameters profileid='native-profile'/>
+ </virtualport>
+ </portgroup>
</network>
Protected by Websense Hosted Email Security -- www.websense.com
11 years, 6 months
[libvirt] [PATCH v2 0/5] Make migration APIs more extensible -- qemu patches
by Jiri Denemark
These are the patches for qemu driver that were already acked but had to
be reworked due to the introduction of ACL checks.
Jiri Denemark (5):
qemu: Move internals of Begin phase to qemu_migration.c
qemu: Move common parts of Prepare phase to qemu_migration.c
qemu: Move internals of Confirm phase to qemu_migration.c
Implement extensible migration APIs in qemu driver
qemu: Implement support for VIR_MIGRATE_PARAM_GRAPHICS_URI
src/qemu/qemu_driver.c | 506 ++++++++++++++++++++--------------
src/qemu/qemu_migration.c | 690 +++++++++++++++++++++++++++++++++-------------
src/qemu/qemu_migration.h | 22 +-
3 files changed, 825 insertions(+), 393 deletions(-)
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH] Use 1.1.0 everywhere in the documentation
by Ján Tomko
Since we already have the v1.1.0-rc1 tag in git.
---
Pushed as trivial.
docs/formatdomain.html.in | 2 +-
docs/formatnetwork.html.in | 2 +-
docs/formatstorage.html.in | 4 ++--
src/libxl/libxl_driver.c | 2 +-
src/xen/xen_driver.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 17ea9c2..f000cdb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3559,7 +3559,7 @@ qemu-kvm -net nic,model=? /dev/null
<p>
For network connections using openvswitch it is possible to
configure the 'native-tagged' and 'native-untagged' vlan modes
- <span class="since">Since 1.0.7.</span> This uses the optional
+ <span class="since">Since 1.1.0.</span> This uses the optional
<code>nativeMode</code> attribute on the <code><tag></code>
element: <code>nativeMode</code> may be set to 'tagged' or
'untagged'. The id atribute of the element sets the native vlan.
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index 6a4b36d..641f15e 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -478,7 +478,7 @@
<p>
For network connections using openvswitch it is possible to
configure the 'native-tagged' and 'native-untagged' vlan modes
- <span class="since">Since 1.0.7</span>. This uses the optional
+ <span class="since">Since 1.1.0</span>. This uses the optional
<code>nativeMode</code> attribute on the <code><tag></code>
element: <code>nativeMode</code> may be set to 'tagged' or
'untagged'. The id atribute of the element sets the native vlan.
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index c1c1b15..d702eb1 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -372,14 +372,14 @@
and <code>1.1</code> so far, specifying QEMU version the images should
be compatible with. If the <code>feature</code> element is present,
1.1 is used. If omitted, qemu-img default is used.
- <span class="since">Since 1.0.7</span>
+ <span class="since">Since 1.1.0</span>
</dd>
<dt><code>features</code></dt>
<dd>Format-specific features. Only used for <code>qcow2</code> now.
Valid sub-elements are:
<ul>
<li><code><lazy_refcounts/></code> - allow delayed reference
- counter updates. <span class="since">Since 1.0.7</span></li>
+ counter updates. <span class="since">Since 1.1.0</span></li>
</ul>
</dd>
</dl>
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index a311d78..9f52394 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4625,7 +4625,7 @@ static virDriver libxlDriver = {
.connectGetType = libxlConnectGetType, /* 0.9.0 */
.connectGetVersion = libxlConnectGetVersion, /* 0.9.0 */
.connectGetHostname = libxlConnectGetHostname, /* 0.9.0 */
- .connectGetSysinfo = libxlConnectGetSysinfo, /* 1.0.7 */
+ .connectGetSysinfo = libxlConnectGetSysinfo, /* 1.1.0 */
.connectGetMaxVcpus = libxlConnectGetMaxVcpus, /* 0.9.0 */
.nodeGetInfo = libxlNodeGetInfo, /* 0.9.0 */
.connectGetCapabilities = libxlConnectGetCapabilities, /* 0.9.0 */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index ffc6e41..38adb23 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2676,7 +2676,7 @@ static virDriver xenUnifiedDriver = {
.connectGetType = xenUnifiedConnectGetType, /* 0.0.3 */
.connectGetVersion = xenUnifiedConnectGetVersion, /* 0.0.3 */
.connectGetHostname = xenUnifiedConnectGetHostname, /* 0.7.3 */
- .connectGetSysinfo = xenUnifiedConnectGetSysinfo, /* 1.0.7 */
+ .connectGetSysinfo = xenUnifiedConnectGetSysinfo, /* 1.1.0 */
.connectGetMaxVcpus = xenUnifiedConnectGetMaxVcpus, /* 0.2.1 */
.nodeGetInfo = xenUnifiedNodeGetInfo, /* 0.1.0 */
.connectGetCapabilities = xenUnifiedConnectGetCapabilities, /* 0.2.1 */
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH 00/21] Make migration APIs more extensible
by Jiri Denemark
Current migration APIs support a fixed set of optional parameters and
whenever there is a need for a new parameter, a whole bunch of new
internal and external APIs have to be introduced. This patch set
introduces new extensible APIs that use virTypedParameters for passing
optional parameters to a migration protocol. Thus making it possible to
introduce new parameters without the need for new APIs.
The first 7 patches provide some basic infrastructure needed by the
following patches. Patches 8 to 19 add support for the new extensible
APIs and patches 20 and 21 make use of the new APIs to introduce
additional migration parameter.
Have fun.
Jiri Denemark (21):
1 Rename virTypedParameterArrayValidate as virTypedParamsValidate
2 util: Emit proper error code in virTypedParamsValidate
3 Introduce virTypedParamsCheck internal API
4 Introduce virTypedParamsReplaceString internal API
5 Introduce VIR_TYPED_PARAMS_DEBUG macro for dumping typed params
6 Log input type parameters in API entry points
7 Introduce virTypedParamsCopy internal API
8 Introduce migration parameters
9 New internal migration APIs with extensible parameters
10 Implement extensible migration APIs in remote driver
11 Implement extensible migration APIs in qemu driver
12 qemu: Move internals of Begin phase to qemu_migration.c
13 qemu: Move internals of Prepare phase to qemu_migration.c
14 qemu: Move internals of Confirm phase to qemu_migration.c
15 Adapt virDomainMigrateVersion3 for extensible migration APIs
16 Adapt virDomainMigratePeer2Peer for extensible migration APIs
17 Extensible migration APIs
18 python: Add bindings for extensible migration APIs
19 virsh: Use extensible migration APIs
20 Introduce VIR_MIGRATE_PARAM_GRAPHICS_URI parameter
21 qemu: Implement support for VIR_MIGRATE_PARAM_GRAPHICS_URI
daemon/remote.c | 331 ++++++++++++-
docs/apibuild.py | 11 +-
docs/hvsupport.pl | 7 +
include/libvirt/libvirt.h.in | 87 ++++
python/generator.py | 2 +
python/libvirt-override-api.xml | 18 +
python/libvirt-override.c | 218 +++++++++
src/driver.h | 67 +++
src/esx/esx_driver.c | 24 +-
src/libvirt.c | 1022 ++++++++++++++++++++++++++++++++++-----
src/libvirt_internal.h | 59 +++
src/libvirt_private.syms | 14 +-
src/libvirt_public.syms | 6 +
src/libxl/libxl_driver.c | 12 +-
src/lxc/lxc_driver.c | 40 +-
src/nodeinfo.c | 16 +-
src/openvz/openvz_driver.c | 16 +-
src/qemu/qemu_driver.c | 633 ++++++++++++------------
src/qemu/qemu_migration.c | 730 ++++++++++++++++++++--------
src/qemu/qemu_migration.h | 45 +-
src/remote/remote_driver.c | 398 +++++++++++++++
src/remote/remote_protocol.x | 96 +++-
src/remote_protocol-structs | 107 ++++
src/test/test_driver.c | 8 +-
src/util/virtypedparam.c | 163 ++++++-
src/util/virtypedparam.h | 36 +-
src/xen/xen_hypervisor.c | 12 +-
tools/virsh-domain.c | 88 +++-
tools/virsh.pod | 18 +-
29 files changed, 3548 insertions(+), 736 deletions(-)
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH] tests: Introduce qemuhotplugtest
by Michal Privoznik
As my punishment for the break in 7f15ebc7 (fixed in 752596b5dd) I'm
introducing this test to make sure it won't happen again. Currently,
only test for <graphics/> is supported.
---
.gitignore | 1 +
tests/Makefile.am | 11 +-
tests/qemuhotplugtest.c | 208 +++++++++++++++++++++
.../qemuhotplug-disk-cdrom-nochange.xml | 6 +
.../qemuhotplug-graphics-spice-listen.xml | 11 ++
.../qemuhotplug-graphics-spice-nochange.xml | 11 ++
...qemuhotplug-graphics-spice-timeout-nochange.xml | 1 +
...qemuhotplug-graphics-spice-timeout-password.xml | 1 +
.../qemuxml2argv-graphics-spice-listen-network.xml | 45 +++++
9 files changed, 293 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuhotplugtest.c
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-disk-cdrom-nochange.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-nochange.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-nochange.xml
create mode 100644 tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-password.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml
diff --git a/.gitignore b/.gitignore
index 7a28941..3efc2e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -167,6 +167,7 @@
/tests/openvzutilstest
/tests/qemuargv2xmltest
/tests/qemuhelptest
+/tests/qemuhotplugtest
/tests/qemumonitorjsontest
/tests/qemumonitortest
/tests/qemuxmlnstest
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9c9c802..a019eb9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -155,7 +155,7 @@ endif
if WITH_QEMU
test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \
qemuargv2xmltest qemuhelptest domainsnapshotxml2xmltest \
- qemumonitortest qemumonitorjsontest
+ qemumonitortest qemumonitorjsontest qemuhotplugtest
endif
if WITH_LXC
@@ -405,6 +405,13 @@ qemumonitorjsontest_SOURCES = \
$(NULL)
qemumonitorjsontest_LDADD = $(qemu_LDADDS) libqemumonitortestutils.la
+qemuhotplugtest_SOURCES = \
+ qemuhotplugtest.c \
+ testutils.c testutils.h \
+ testutilsqemu.c testutilsqemu.h \
+ $(NULL)
+qemuhotplugtest_LDADD = $(qemu_LDADDS) libqemumonitortestutils.la
+
domainsnapshotxml2xmltest_SOURCES = \
domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \
testutils.c testutils.h
@@ -413,7 +420,7 @@ else
EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
qemuxmlnstest.c qemuhelptest.c domainsnapshotxml2xmltest.c \
qemumonitortest.c testutilsqemu.c testutilsqemu.h \
- qemumonitorjsontest.c \
+ qemumonitorjsontest.c qemuhotplugtest.c \
$(QEMUMONITORTESTUTILS_SOURCES)
endif
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
new file mode 100644
index 0000000..ed3ca7f
--- /dev/null
+++ b/tests/qemuhotplugtest.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2011-2013 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+
+#include "qemu/qemu_conf.h"
+#include "qemu/qemu_hotplug.h"
+#include "qemumonitortestutils.h"
+#include "testutils.h"
+#include "testutilsqemu.h"
+#include "virerror.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virfile.h"
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+static virQEMUDriver driver;
+
+struct qemuHotplugTestData {
+ const char *domain_filename;
+ const char *device_filename;
+ bool fail;
+ const char *const *mon;
+};
+
+static int
+qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
+ virDomainObjPtr *vm,
+ const char *filename)
+{
+ int ret = -1;
+
+ if (!(*vm = virDomainObjNew(xmlopt)))
+ goto cleanup;
+
+ if (!((*vm)->def = virDomainDefParseFile(filename,
+ driver.caps,
+ driver.xmlopt,
+ QEMU_EXPECTED_VIRT_TYPES,
+ 0)))
+ goto cleanup;
+
+ ret = 0;
+cleanup:
+ return ret;
+}
+
+static int
+testQemuHotplug(const void *data)
+{
+ int ret = -1;
+ struct qemuHotplugTestData *test = (struct qemuHotplugTestData *) data;
+ char *domain_filename = NULL;
+ char *device_filename = NULL;
+ char *device_xml = NULL;
+ const char *const *tmp;
+ bool fail = test->fail;
+ virDomainObjPtr vm = NULL;
+ virDomainDeviceDefPtr dev = NULL;
+ virCapsPtr caps = NULL;
+ qemuMonitorTestPtr test_mon = NULL;
+ qemuDomainObjPrivatePtr priv;
+
+ if (virAsprintf(&domain_filename, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
+ abs_srcdir, test->domain_filename) < 0 ||
+ virAsprintf(&device_filename, "%s/qemuhotplugtestdata/qemuhotplug-%s.xml",
+ abs_srcdir, test->device_filename) < 0)
+ goto cleanup;
+
+ if (!(caps = virQEMUDriverGetCapabilities(&driver, false)))
+ goto cleanup;
+
+ if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_filename) < 0)
+ goto cleanup;
+
+ priv = vm->privateData;
+
+ if (virtTestLoadFile(device_filename, &device_xml) < 0)
+ goto cleanup;
+
+ if (!(dev = virDomainDeviceDefParse(device_xml, vm->def,
+ caps, driver.xmlopt,
+ VIR_DOMAIN_XML_INACTIVE)))
+ goto cleanup;
+
+ /* Now is the best time to feed the spoofed monitor with predefined
+ * replies. */
+ if (!(test_mon = qemuMonitorTestNew(true, driver.xmlopt)))
+ goto cleanup;
+
+ tmp = test->mon;
+ while (tmp && *tmp) {
+ const char *command_name;
+ const char *response;
+
+ if (!(command_name = *tmp++) ||
+ !(response = *tmp++))
+ break;
+ if (qemuMonitorTestAddItem(test_mon, command_name, response) < 0)
+ goto cleanup;
+ }
+
+ priv->mon = qemuMonitorTestGetMonitor(test_mon);
+ priv->monJSON = true;
+
+ /* XXX We need to unlock the monitor here, as
+ * qemuDomainObjEnterMonitorInternal (called from qemuDomainChangeGraphics)
+ * tries to lock it again */
+ virObjectUnlock(priv->mon);
+
+ /* XXX Ideally, we would call qemuDomainUpdateDeviceLive here. But that
+ * would require us to provide virConnectPtr and virDomainPtr (they're used
+ * in case of updating a disk device. So for now, we will proceed with
+ * breaking the function into pieces. If we ever learn how to fake those
+ * required object, we can replace this code then. */
+ switch (dev->type) {
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ ret = qemuDomainChangeGraphics(&driver, vm, dev->data.graphics);
+ break;
+ default:
+ if (virTestGetVerbose())
+ fprintf(stderr, "device type '%s' cannot be updated",
+ virDomainDeviceTypeToString(dev->type));
+ break;
+ }
+
+cleanup:
+ VIR_FREE(domain_filename);
+ VIR_FREE(device_filename);
+ VIR_FREE(device_xml);
+ /* don't dispose test monitor with VM */
+ priv->mon = NULL;
+ virObjectUnref(vm);
+ virDomainDeviceDefFree(dev);
+ virObjectUnref(caps);
+ qemuMonitorTestFree(test_mon);
+ return ((ret < 0 && fail) || (!ret && !fail)) ? 0 : -1;
+}
+
+static int
+mymain(void)
+{
+ int ret = 0;
+
+#if !WITH_YAJL
+ fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
+ if (virThreadInitialize() < 0 ||
+ !(driver.caps = testQemuCapsInit()) ||
+ !(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
+ return EXIT_FAILURE;
+
+ virEventRegisterDefaultImpl();
+
+ driver.config = virQEMUDriverConfigNew(false);
+ VIR_FREE(driver.config->spiceListen);
+ VIR_FREE(driver.config->vncListen);
+
+ /* some dummy values from 'config file' */
+ if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
+ return EXIT_FAILURE;
+
+#define DO_TEST(file, dev, fial, ...) \
+ do { \
+ const char *my_mon[] = { __VA_ARGS__, NULL}; \
+ struct qemuHotplugTestData data = \
+ {.domain_filename = file, .device_filename = dev, .fail = fial, \
+ .mon = my_mon}; \
+ if (virtTestRun(#file, 1, testQemuHotplug, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
+ DO_TEST("graphics-spice", "graphics-spice-nochange", false, NULL);
+ DO_TEST("graphics-spice-timeout", "graphics-spice-timeout-nochange", false,
+ "set_password", "{\"return\":{}}", "expire_password", "{\"return\":{}}");
+ DO_TEST("graphics-spice-timeout", "graphics-spice-timeout-password", false,
+ "set_password", "{\"return\":{}}", "expire_password", "{\"return\":{}}");
+ DO_TEST("graphics-spice", "graphics-spice-listen", true, NULL);
+ DO_TEST("graphics-spice-listen-network", "graphics-spice-listen-network", false,
+ "set_password", "{\"return\":{}}", "expire_password", "{\"return\":{}}");
+ /* Strange huh? Currently, only graphics can be testet :-P */
+ DO_TEST("disk-cdrom", "disk-cdrom-nochange", true, NULL);
+
+ virObjectUnref(driver.caps);
+ virObjectUnref(driver.xmlopt);
+ return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+VIRT_TEST_MAIN(mymain)
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-disk-cdrom-nochange.xml b/tests/qemuhotplugtestdata/qemuhotplug-disk-cdrom-nochange.xml
new file mode 100644
index 0000000..26841ea
--- /dev/null
+++ b/tests/qemuhotplugtestdata/qemuhotplug-disk-cdrom-nochange.xml
@@ -0,0 +1,6 @@
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen.xml b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen.xml
new file mode 100644
index 0000000..d4a8d04
--- /dev/null
+++ b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-listen.xml
@@ -0,0 +1,11 @@
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='192.168.0.1' defaultMode='secure'>
+ <listen type='address' address='192.168.0.1'/>
+ <channel name='main' mode='secure'/>
+ <channel name='inputs' mode='insecure'/>
+ <image compression='auto_glz'/>
+ <jpeg compression='auto'/>
+ <zlib compression='auto'/>
+ <playback compression='on'/>
+ <streaming mode='filter'/>
+ <clipboard copypaste='no'/>
+ </graphics>
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-nochange.xml b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-nochange.xml
new file mode 100644
index 0000000..498ffa2
--- /dev/null
+++ b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-nochange.xml
@@ -0,0 +1,11 @@
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'>
+ <listen type='address' address='127.0.0.1'/>
+ <channel name='main' mode='secure'/>
+ <channel name='inputs' mode='insecure'/>
+ <image compression='auto_glz'/>
+ <jpeg compression='auto'/>
+ <zlib compression='auto'/>
+ <playback compression='on'/>
+ <streaming mode='filter'/>
+ <clipboard copypaste='no'/>
+ </graphics>
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-nochange.xml b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-nochange.xml
new file mode 100644
index 0000000..f7ea796
--- /dev/null
+++ b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-nochange.xml
@@ -0,0 +1 @@
+ <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'/>
diff --git a/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-password.xml b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-password.xml
new file mode 100644
index 0000000..f826459
--- /dev/null
+++ b/tests/qemuhotplugtestdata/qemuhotplug-graphics-spice-timeout-password.xml
@@ -0,0 +1 @@
+ <graphics type='spice' port='5900' autoport='no' passwd='secret' passwdValidTo='2013-05-31T16:11:22' connected='disconnect'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml
new file mode 100644
index 0000000..34971fe
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-listen-network.xml
@@ -0,0 +1,45 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics autoport='yes' connected='disconnect' keymap='en-us' passwd='password' passwdValidTo='2013-06-20T01:34:37' port='5900' tlsPort='5901' type='spice'>
+ <listen address='10.65.210.231' network='vdsm-rhevm' type='network'/>
+ <channel mode='secure' name='main'/>
+ <channel mode='secure' name='display'/>
+ <channel mode='secure' name='inputs'/>
+ <channel mode='secure' name='cursor'/>
+ <channel mode='secure' name='playback'/>
+ <channel mode='secure' name='record'/>
+ <channel mode='secure' name='smartcard'/>
+ <channel mode='secure' name='usbredir'/>
+ </graphics>
+ <video>
+ <model type='qxl' ram='65536' vram='18432' heads='1'/>
+ </video>
+ <video>
+ <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] virsh: edit: don't leak XML string on reedit or redefine
by Ján Tomko
Free the old XML strings before overwriting them if the user
has chosen to reedit the file or force the redefinition.
Found by Alex Jia trying to reproduce another bug:
https://bugzilla.redhat.com/show_bug.cgi?id=977430#c3
---
tools/virsh-edit.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c
index 9d612a3..bb79853 100644
--- a/tools/virsh-edit.c
+++ b/tools/virsh-edit.c
@@ -86,6 +86,7 @@ reedit:
goto edit_cleanup;
/* Read back the edited file. */
+ VIR_FREE(doc_edited);
doc_edited = vshEditReadBackFile(ctl, tmp);
if (!doc_edited)
goto edit_cleanup;
@@ -102,6 +103,7 @@ redefine:
* it was being edited? This also catches problems such as us
* losing a connection or the object going away.
*/
+ VIR_FREE(doc_reread);
doc_reread = (EDIT_GET_XML);
if (!doc_reread)
goto edit_cleanup;
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] BSD: implement virNetDev(Set|Clear)IPv4Address
by Roman Bogorodskiy
Provide an implementation of virNetDev(Set|Clear)IPv4Address based on
BSD ifconfig tool in addition to 'ip' from Linux iproute2 package.
---
configure.ac | 15 +++++++++++++++
src/util/virnetdev.c | 16 ++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/configure.ac b/configure.ac
index ef246a6..16560fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -386,6 +386,10 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
sysconfdir='/etc'
fi
+dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
+dnl we're working on BSD)
+want_ifconfig=no
+
dnl Make some notes about which OS we're compiling for, as the lxc and qemu
dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
dnl are also linux specific. The "network" and storage_fs drivers are known
@@ -408,6 +412,8 @@ if test $with_linux = no; then
fi
if test $with_freebsd = yes; then
+ want_ifconfig=yes
+
with_firewalld=no
fi
@@ -2410,6 +2416,15 @@ AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
#include <net/if_bridgevar.h>
])
+# Check if we need to look for ifconfig
+if test "$want_ifconfig" = "yes"; then
+ AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
+ if test -z "$IFCONFIG_PATH"; then
+ AC_MSG_ERROR([Failed to find ifconfig.])
+ fi
+ AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
+fi
+
# Detect when running under the clang static analyzer's scan-build driver
# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
AC_CACHE_CHECK([whether this build is done by a static analysis tool],
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 7aba515..85f39a3 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -814,12 +814,21 @@ int virNetDevSetIPv4Address(const char *ifname,
!(bcaststr = virSocketAddrFormat(&broadcast)))) {
goto cleanup;
}
+#ifdef IFCONFIG_PATH
+ cmd = virCommandNew(IFCONFIG_PATH);
+ virCommandAddArgList(cmd, ifname, "inet", NULL);
+ virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ if (bcaststr)
+ virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
+ virCommandAddArg(cmd, "alias");
+#else
cmd = virCommandNew(IP_PATH);
virCommandAddArgList(cmd, "addr", "add", NULL);
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
if (bcaststr)
virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
virCommandAddArgList(cmd, "dev", ifname, NULL);
+#endif
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
@@ -899,10 +908,17 @@ int virNetDevClearIPv4Address(const char *ifname,
if (!(addrstr = virSocketAddrFormat(addr)))
goto cleanup;
+#ifdef IFCoNFIG_PATH
+ cmd = virCommandNew(IFCONFIG_PATH);
+ virCommandAddArgList(cmd, ifname, "inet", NULL);
+ virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ virCommandAddArg(cmd, "-alias");
+#else
cmd = virCommandNew(IP_PATH);
virCommandAddArgList(cmd, "addr", "del", NULL);
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
virCommandAddArgList(cmd, "dev", ifname, NULL);
+#endif
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
--
1.8.2.3
11 years, 6 months
[libvirt] [PATCH v2] BSD: implement virNetDev(Set|Clear)IPv4Address
by Roman Bogorodskiy
Provide an implementation of virNetDev(Set|Clear)IPv4Address based on
BSD ifconfig tool in addition to 'ip' from Linux iproute2 package.
---
configure.ac | 15 +++++++++++++++
src/util/virnetdev.c | 26 ++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/configure.ac b/configure.ac
index ef246a6..15618dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -386,6 +386,10 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
sysconfdir='/etc'
fi
+dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
+dnl we're working on BSD)
+want_ifconfig=no
+
dnl Make some notes about which OS we're compiling for, as the lxc and qemu
dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
dnl are also linux specific. The "network" and storage_fs drivers are known
@@ -408,6 +412,8 @@ if test $with_linux = no; then
fi
if test $with_freebsd = yes; then
+ want_ifconfig=yes
+
with_firewalld=no
fi
@@ -2410,6 +2416,15 @@ AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
#include <net/if_bridgevar.h>
])
+# Check if we need to look for ifconfig
+if test "$want_ifconfig" = "yes"; then
+ AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
+ if test -z "$IFCONFIG_PATH"; then
+ AC_MSG_ERROR([Failed to find ifconfig.])
+ fi
+ AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
+fi
+
# Detect when running under the clang static analyzer's scan-build driver
# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
AC_CACHE_CHECK([whether this build is done by a static analysis tool],
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index ebe20d0..4d53ac3 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -816,12 +816,26 @@ int virNetDevSetIPv4Address(const char *ifname,
!(bcaststr = virSocketAddrFormat(&broadcast)))) {
goto cleanup;
}
+#ifdef IFCONFIG_PATH
+ cmd = virCommandNew(IFCONFIG_PATH);
+ virCommandAddArg(cmd, ifname);
+ if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) {
+ virCommandAddArg(cmd, "inet");
+ } else if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET6)) {
+ virCommandAddArg(cmd, "inet6");
+ }
+ virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ if (bcaststr)
+ virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
+ virCommandAddArg(cmd, "alias");
+#else
cmd = virCommandNew(IP_PATH);
virCommandAddArgList(cmd, "addr", "add", NULL);
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
if (bcaststr)
virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
virCommandAddArgList(cmd, "dev", ifname, NULL);
+#endif
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
@@ -901,10 +915,22 @@ int virNetDevClearIPv4Address(const char *ifname,
if (!(addrstr = virSocketAddrFormat(addr)))
goto cleanup;
+#ifdef IFCONFIG_PATH
+ cmd = virCommandNew(IFCONFIG_PATH);
+ virCommandAddArg(cmd, ifname);
+ if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) {
+ virCommandAddArg(cmd, "inet");
+ } else if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET6)) {
+ virCommandAddArg(cmd, "inet6");
+ }
+ virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ virCommandAddArg(cmd, "-alias");
+#else
cmd = virCommandNew(IP_PATH);
virCommandAddArgList(cmd, "addr", "del", NULL);
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
virCommandAddArgList(cmd, "dev", ifname, NULL);
+#endif
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
--
1.7.11.5
11 years, 6 months
[libvirt] [PATCH] build: Fix check-aclrules in VPATH build
by Jiri Denemark
---
Pushed as a build-breaker.
src/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 530de53..e6b1927 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -500,7 +500,7 @@ check-driverimpls:
check-aclrules:
$(AM_V_GEN)$(PERL) $(srcdir)/check-aclrules.pl \
- $(STATEFUL_DRIVER_SOURCE_FILES)
+ $(addprefix $(srcdir)/,$(filter-out /%,$(STATEFUL_DRIVER_SOURCE_FILES)))
EXTRA_DIST += check-driverimpls.pl check-aclrules.pl
--
1.8.2.1
11 years, 6 months