[libvirt] [libvirt-glib] Call gvir_init_config() in GVirConfig test programs
by Christophe Fergeau
While not strictly necessary, this sets up glib logging properly on
older glib so that debug logs are not shown by default.
---
libvirt-gconfig/tests/test-domain-create.c | 4 ++--
libvirt-gconfig/tests/test-domain-parse.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index c42deaf..5334668 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -32,7 +32,7 @@
const char *features[] = { "foo", "bar", "baz", NULL };
-int main(void)
+int main(int argc, char **argv)
{
GVirConfigDomain *domain;
char *name;
@@ -40,7 +40,7 @@ int main(void)
unsigned int i;
char *xml;
- g_type_init();
+ gvir_init_config(&argc, &argv);
domain = gvir_config_domain_new();
g_assert(domain != NULL);
diff --git a/libvirt-gconfig/tests/test-domain-parse.c b/libvirt-gconfig/tests/test-domain-parse.c
index f95e062..77b0a3b 100644
--- a/libvirt-gconfig/tests/test-domain-parse.c
+++ b/libvirt-gconfig/tests/test-domain-parse.c
@@ -39,6 +39,7 @@ int main(int argc, char **argv)
char *xml;
GError *error = NULL;
+ gvir_init_config(&argc, &argv);
if (argc != 2) {
g_print("Usage: %s filename\n", argv[0]);
g_print("Attempt to parse the libvirt XML definition from filename\n");
--
1.7.7.5
12 years, 10 months
[libvirt] PATCH: Inform QEMU "prepare" hook of migration in progress
by Adam Tilghman
>From: Eric Blake <eblake redhat com>
>Subject: Re: [libvirt-users] Wanted: method for qemu hook script to know if called for migration
>Date: Mon, 25 Jul 2011 14:17:08 -0600
>
>>As a feature suggestion, it would be nice if that fourth input variable,
>>currently "-", was something like "migrate" in this instance.
>
>Yes, that is probably a bug worth fixing.
I would also find it useful for the QEMU "prepare" hook
to be told whether it's being called in the context of a migration.
(In our case, we use that hook to manage shared DRBD storage, and only permit
Primary/Primary mode in the context of a migration.)
The attached 1-line patch supplies the hook with an additional
argument "migration-target" when appropriate.
Submitted as https://bugzilla.redhat.com/show_bug.cgi?id=768054
---
src/qemu/qemu_process.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9123f4c..ef9f7eb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2936,7 +2936,7 @@ int qemuProcessStart(virConnectPtr conn,
int hookret;
hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
- VIR_HOOK_QEMU_OP_PREPARE, VIR_HOOK_SUBOP_BEGIN, NULL, xml);
+ VIR_HOOK_QEMU_OP_PREPARE, VIR_HOOK_SUBOP_BEGIN, migrateFrom ? "migration-target" : NULL, xml);
VIR_FREE(xml);
/*
--
1.7.1
--
Adam Tilghman Systems Support / Academic Computing & Media Services
agt(a)ucsd.edu 858-822-0711 University of California, San Diego
12 years, 10 months
[libvirt] [PATCH] domiftune: clean up previous patches
by Eric Blake
Most severe here is a latent (but currently untriggered) memory leak
if any hypervisor ever adds a string interface property; the
remainder are mainly cosmetic.
* include/libvirt/libvirt.h.in (VIR_DOMAIN_BANDWIDTH_*): Move
macros closer to interface that uses them, and document type.
* src/libvirt.c (virDomainSetInterfaceParameters)
(virDomainGetInterfaceParameters): Formatting tweaks.
* daemon/remote.c (remoteDispatchDomainGetInterfaceParameters):
Avoid memory leak.
* src/libvirt_public.syms (LIBVIRT_0.9.9): Sort lines.
* src/libvirt_private.syms (domain_conf.h): Likewise.
* src/qemu/qemu_driver.c (qemuDomainSetInterfaceParameters): Fix
comments, break long lines.
---
daemon/remote.c | 5 +-
include/libvirt/libvirt.h.in | 104 +++++++++++++++++++++++-------------------
src/libvirt.c | 21 ++++++--
src/libvirt_private.syms | 10 ++--
src/libvirt_public.syms | 4 +-
src/qemu/qemu_driver.c | 24 ++++++----
6 files changed, 97 insertions(+), 71 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index b7ba321..a28a754 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1,7 +1,7 @@
/*
* remote.c: handlers for RPC method calls
*
- * Copyright (C) 2007-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2012 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
@@ -3495,9 +3495,10 @@ success:
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
if (dom)
virDomainFree(dom);
- VIR_FREE(params);
return rv;
}
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index f59c3b1..ad6fcce 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4,7 +4,7 @@
* Description: Provides the interfaces of the libvirt library to handle
* virtualized domains
*
- * Copy: Copyright (C) 2005-2006, 2010-2011 Red Hat, Inc.
+ * Copy: Copyright (C) 2005-2006, 2010-2012 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -645,48 +645,6 @@ typedef virTypedParameter *virTypedParameterPtr;
*/
#define VIR_DOMAIN_SCHEDULER_SHARES "shares"
-/**
- * VIR_DOMAIN_BANDWIDTH_IN_AVERAGE:
- *
- * Macro represents the inbound average of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE "inbound.average"
-
-/**
- * VIR_DOMAIN_BANDWIDTH_IN_PEAK:
- *
- * Macro represents the inbound peak of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_IN_PEAK "inbound.peak"
-
-/**
- * VIR_DOMAIN_BANDWIDTH_IN_BURST:
- *
- * Macro represents the inbound burst of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_IN_BURST "inbound.burst"
-
-/**
- * VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE:
- *
- * Macro represents the outbound average of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE "outbound.average"
-
-/**
- * VIR_DOMAIN_BANDWIDTH_OUT_PEAK:
- *
- * Macro represents the outbound peak of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_OUT_PEAK "outbound.peak"
-
-/**
- * VIR_DOMAIN_BANDWIDTH_OUT_BURST:
- *
- * Macro represents the outbound burst of NIC bandwidth.
- */
-#define VIR_DOMAIN_BANDWIDTH_OUT_BURST "outbound.burst"
-
/*
* Fetch scheduler parameters, caller allocates 'params' field of size 'nparams'
*/
@@ -1488,6 +1446,51 @@ int virDomainInterfaceStats (virDomainPtr dom,
const char *path,
virDomainInterfaceStatsPtr stats,
size_t size);
+
+/* Management of interface parameters */
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_AVERAGE:
+ *
+ * Macro represents the inbound average of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE "inbound.average"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_PEAK:
+ *
+ * Macro represents the inbound peak of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_PEAK "inbound.peak"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_IN_BURST:
+ *
+ * Macro represents the inbound burst of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_IN_BURST "inbound.burst"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE:
+ *
+ * Macro represents the outbound average of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE "outbound.average"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_PEAK:
+ *
+ * Macro represents the outbound peak of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_PEAK "outbound.peak"
+
+/**
+ * VIR_DOMAIN_BANDWIDTH_OUT_BURST:
+ *
+ * Macro represents the outbound burst of NIC bandwidth, as a uint.
+ */
+#define VIR_DOMAIN_BANDWIDTH_OUT_BURST "outbound.burst"
+
int virDomainSetInterfaceParameters (virDomainPtr dom,
const char *device,
virTypedParameterPtr params,
@@ -1496,10 +1499,9 @@ int virDomainGetInterfaceParameters (virDomainPtr dom,
const char *device,
virTypedParameterPtr params,
int *nparams, unsigned int flags);
-int virDomainMemoryStats (virDomainPtr dom,
- virDomainMemoryStatPtr stats,
- unsigned int nr_stats,
- unsigned int flags);
+
+/* Management of domain block devices */
+
int virDomainBlockPeek (virDomainPtr dom,
const char *disk,
unsigned long long offset,
@@ -1546,7 +1548,15 @@ int virDomainGetBlockInfo(virDomainPtr dom,
virDomainBlockInfoPtr info,
unsigned int flags);
+/* Management of domain memory */
+
+int virDomainMemoryStats (virDomainPtr dom,
+ virDomainMemoryStatPtr stats,
+ unsigned int nr_stats,
+ unsigned int flags);
+
/* Memory peeking flags. */
+
typedef enum {
VIR_MEMORY_VIRTUAL = 1, /* addresses are virtual addresses */
VIR_MEMORY_PHYSICAL = 2, /* addresses are physical addresses */
diff --git a/src/libvirt.c b/src/libvirt.c
index 9507902..feb3ca6 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2,7 +2,7 @@
* libvirt.c: Main interfaces for the libvirt library to handle virtualization
* domains from a process running in domain 0
*
- * Copyright (C) 2005-2006, 2008-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2006, 2008-2012 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -7084,7 +7084,12 @@ error:
* less than the number of parameters supported)
* @flags: bitwise-OR of virDomainModificationImpact
*
- * Currently this function sets bandwidth parameters of interface.
+ * Change a subset or all parameters of interface; currently this
+ * includes bandwidth parameters. The value of @flags should be
+ * either VIR_DOMAIN_AFFECT_CURRENT, or a bitwise-or of values from
+ * VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CURRENT, although
+ * hypervisors vary in which flags are supported.
+ *
* This function may require privileged access to the hypervisor.
*
* Returns -1 in case of error, 0 in case of success.
@@ -7122,7 +7127,9 @@ virDomainSetInterfaceParameters(virDomainPtr domain,
if (conn->driver->domainSetInterfaceParameters) {
int ret;
- ret = conn->driver->domainSetInterfaceParameters(domain, device, params, nparams, flags);
+ ret = conn->driver->domainSetInterfaceParameters(domain, device,
+ params, nparams,
+ flags);
if (ret < 0)
goto error;
return ret;
@@ -7141,8 +7148,8 @@ error:
* @device: the interface name or mac address
* @params: pointer to interface parameter objects
* (return value, allocated by the caller)
- * @nparams: pointer to number of interface parameter
- * @flags: one of virDomainModificationImpact
+ * @nparams: pointer to number of interface parameter; input and output
+ * @flags: bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
*
* Get all interface parameters. On input, @nparams gives the size of
* the @params array; on output, @nparams gives how many slots were
@@ -7193,7 +7200,9 @@ virDomainGetInterfaceParameters(virDomainPtr domain,
if (conn->driver->domainGetInterfaceParameters) {
int ret;
- ret = conn->driver->domainGetInterfaceParameters (domain, device, params, nparams, flags);
+ ret = conn->driver->domainGetInterfaceParameters(domain, device,
+ params, nparams,
+ flags);
if (ret < 0)
goto error;
return ret;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 216a5a5..ac2c52e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -260,10 +260,10 @@ virDomainConfigFile;
virDomainControllerDefFree;
virDomainControllerInsert;
virDomainControllerInsertPreAlloced;
-virDomainControllerModelUSBTypeFromString;
-virDomainControllerModelUSBTypeToString;
virDomainControllerModelSCSITypeFromString;
virDomainControllerModelSCSITypeToString;
+virDomainControllerModelUSBTypeFromString;
+virDomainControllerModelUSBTypeToString;
virDomainControllerTypeToString;
virDomainCpuSetFormat;
virDomainCpuSetParse;
@@ -308,7 +308,6 @@ virDomainDiskSnapshotTypeFromString;
virDomainDiskSnapshotTypeToString;
virDomainDiskTypeFromString;
virDomainDiskTypeToString;
-virDomainNetFind;
virDomainFSDefFree;
virDomainFSTypeFromString;
virDomainFSTypeToString;
@@ -366,12 +365,13 @@ virDomainLoadAllConfigs;
virDomainMemballoonModelTypeFromString;
virDomainMemballoonModelTypeToString;
virDomainNetDefFree;
+virDomainNetFind;
virDomainNetGetActualBandwidth;
virDomainNetGetActualBridgeName;
virDomainNetGetActualDirectDev;
virDomainNetGetActualDirectMode;
-virDomainNetGetActualType;
virDomainNetGetActualDirectVirtPortProfile;
+virDomainNetGetActualType;
virDomainNetIndexByMac;
virDomainNetInsert;
virDomainNetRemoveByMac;
@@ -462,9 +462,9 @@ virDomainVideoDefaultRAM;
virDomainVideoDefaultType;
virDomainVideoTypeFromString;
virDomainVideoTypeToString;
+virDomainVirtTypeToString;
virDomainVirtioEventIdxTypeFromString;
virDomainVirtioEventIdxTypeToString;
-virDomainVirtTypeToString;
virDomainWatchdogActionTypeFromString;
virDomainWatchdogActionTypeToString;
virDomainWatchdogModelTypeFromString;
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index ea6d562..4ca7216 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -510,10 +510,10 @@ LIBVIRT_0.9.8 {
LIBVIRT_0.9.9 {
global:
- virDomainGetNumaParameters;
- virDomainSetNumaParameters;
virDomainGetInterfaceParameters;
+ virDomainGetNumaParameters;
virDomainSetInterfaceParameters;
+ virDomainSetNumaParameters;
} LIBVIRT_0.9.8;
# .... define new API here using predicted next version number ....
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e93fe87..ad592d6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1,7 +1,7 @@
/*
* qemu_driver.c: core driver methods for managing qemu guests
*
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -7920,7 +7920,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_IN_AVERAGE)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth average tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth average tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7928,7 +7929,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_IN_PEAK)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth peak tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth peak tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7936,7 +7938,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_IN_BURST)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth burst tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth burst tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7944,7 +7947,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth average tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth average tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7952,7 +7956,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_OUT_PEAK)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth peak tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth peak tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7960,7 +7965,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
} else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_OUT_BURST)) {
if (param->type != VIR_TYPED_PARAM_UINT) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for bandwidth burst tunable, expected a 'unsigned int'"));
+ _("invalid type for bandwidth burst tunable, "
+ "expected an 'unsigned int'"));
goto cleanup;
}
@@ -7973,9 +7979,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
}
}
- /* average is mandatory, peak and burst is optional. So if no
+ /* average is mandatory, peak and burst are optional. So if no
* average is given, we free inbound/outbound here which causes
- * inbound/outbound won't be set. */
+ * inbound/outbound to not be set. */
if (!bandwidth->in->average) {
VIR_FREE(bandwidth->in);
bandwidth->in = NULL;
--
1.7.7.4
12 years, 10 months
[libvirt] [PATCH] qemu: fix block stat naming
by Eric Blake
Typo has existed since API introduction in commit ee0d8c3.
* src/qemu/qemu_driver.c (qemuDomainBlockStatsFlags): Use correct
name.
---
Pushing under the trivial rule.
src/qemu/qemu_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ad592d6..82bab67 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7763,10 +7763,10 @@ qemuDomainBlockStatsFlags(virDomainPtr dom,
if (tmp < *nparams && flush_total_times != -1) {
param = ¶ms[tmp];
if (virStrcpyStatic(param->field,
- VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) {
+ VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Field name '%s' too long"),
- VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES);
+ VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES);
goto endjob;
}
param->type = VIR_TYPED_PARAM_LLONG;
--
1.7.7.4
12 years, 10 months
[libvirt] [PATCHv4 0/6] Add new command domiftune
by Hu Tao
This series adds a new command domiftune to get/set parameters of
domain's network interfaces. Supported parameters are bandwidth
settings.
Currently the network interface bandwidth can only be set:
- in domain's xml before the domain is up
- when attaching an interface by attach-interface
With this series, users can change network interface bandwidth
settings using virsh, whether the domain is running or not.
changes:
- fix a bug that previous bandwidth parameters are lost when
setting only inbound or outbound lively
- some minor improvements
- rename virDomainFindNetDef to virDomainNetFind
Hu Tao (6):
Add API virDomain{S,G}etInterfaceParameters
virDomain{S,G}etInterfaceParameters: the main entry points
Add virDomain{S,G}etInterfaceparameters support to the remote driver
Add a function virDomainNetFind
Add virDomain{S,G}etInterfaceParameters support to qemu driver
Enable the virDomain{S,G}etInterfaceParameters in virsh
daemon/remote.c | 64 ++++++++
include/libvirt/libvirt.h.in | 50 ++++++
python/generator.py | 2 +
src/conf/domain_conf.c | 39 +++++
src/conf/domain_conf.h | 3 +
src/driver.h | 12 ++
src/libvirt.c | 130 ++++++++++++++++
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 2 +
src/qemu/qemu_driver.c | 353 ++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 52 ++++++
src/remote/remote_protocol.x | 28 ++++-
src/remote_protocol-structs | 24 +++
tools/virsh.c | 198 +++++++++++++++++++++++
tools/virsh.pod | 21 +++
15 files changed, 978 insertions(+), 1 deletions(-)
--
1.7.4.4
12 years, 10 months
[libvirt] [PATCH] virsh: Fix checking for reconnect conditions
by Peter Krempa
virshReportError() function frees the most recent error reported from
libvirt. Condition that checks if connection to the daemon was broken
during last command was then limited to check for SIGPIPE signal not
taking into account possible errors signalized without SIGPIPE.
This patch moves the check before the error is freed, to take into
account code that does not emit SIGPIPE while failing.
* tools/virsh.c: - move check for broken connection before error print.
---
tools/virsh.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index e089f7b..2ed1186 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -17041,20 +17041,23 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd)
if (enable_timing)
GETTIMEOFDAY(&after);
+ /* try to automatically catch disconnections */
+ if (!ret &&
+ ((last_error != NULL) &&
+ (((last_error->code == VIR_ERR_SYSTEM_ERROR) &&
+ (last_error->domain == VIR_FROM_REMOTE)) ||
+ (last_error->code == VIR_ERR_RPC) ||
+ (last_error->code == VIR_ERR_NO_CONNECT) ||
+ (last_error->code == VIR_ERR_INVALID_CONN))))
+ disconnected++;
+
if (!ret)
virshReportError(ctl);
- /* try to automatically catch disconnections */
- if (!ret &&
- ((disconnected != 0) ||
- ((last_error != NULL) &&
- (((last_error->code == VIR_ERR_SYSTEM_ERROR) &&
- (last_error->domain == VIR_FROM_REMOTE)) ||
- (last_error->code == VIR_ERR_RPC) ||
- (last_error->code == VIR_ERR_NO_CONNECT) ||
- (last_error->code == VIR_ERR_INVALID_CONN)))))
+ if (!ret && disconnected != 0)
vshReconnect(ctl);
+
if (STREQ(cmd->def->name, "quit")) /* hack ... */
return ret;
--
1.7.3.4
12 years, 10 months
[libvirt] [PATCH] network_conf: Fix whitespace to pass syntax-check
by Peter Krempa
---
Pushed under trivial rule.
src/conf/network_conf.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 975d5e8..8920e18 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -24,7 +24,7 @@
#ifndef __NETWORK_CONF_H__
# define __NETWORK_CONF_H__
- #define DNS_RECORD_LENGTH_SRV (512 - 30) /* Limit minus overhead as mentioned in RFC-2782 */
+# define DNS_RECORD_LENGTH_SRV (512 - 30) /* Limit minus overhead as mentioned in RFC-2782 */
# include <libxml/parser.h>
# include <libxml/tree.h>
--
1.7.3.4
12 years, 10 months
[libvirt] [PATCH 0/2] qemu: add new disk type='lun' for bus='virtio'
by Laine Stump
These two patches are in response to CVE-2011-4127:
http://seclists.org/oss-sec/2011/q4/536
Once the kernel security fix and corresponding qemu mitigation patch
are in place, access to SG_IO commands from qemu guests will be
disabled by default. This patch series provides a way to explicitly
enable such support when it is required.
In a discussion just before sending this patch series, Paolo Bonzini
wondered if rather than the xml syntax being what's proposed
here:
<disk type='block' device='disk' dev='/dev/sda'> <!-- SG_IO off -->
<disk type='lun' device='disk' dev='/dev/sda'> <!-- SG_IO on -->
maybe it should instead be:
<disk type='block' device='disk' dev='/dev/sda'> <!-- SG_IO off -->
<disk type='block' device='lun' dev='/dev/sda'> <!-- SG_IO on -->
I guess it partly depends on whether we would ever want to turn on
SG_IO for a disk with device='cdrom|floppy' vs. if we would ever want
to turn it on for type='file|dir|network'.
Opinions?
12 years, 10 months
[libvirt] [PATCH v5] Implement DNS SRV record into the bridge driver
by Michal Novotny
Hi,
this is the fifth version of my SRV record for DNSMasq patch rebased
for the current codebase to the bridge driver and libvirt XML file to
include support for the SRV records in the DNS. The syntax is based on
DNSMasq man page and tests for both xml2xml and xml2argv were added as
well. There are some things written a better way in comparison with
version 4, mainly there's no hack in tests/networkxml2argvtest.c and
also the xPath context is changed to use a simpler query using the
virXPathInt() function relative to the current node.
Also, the patch is also fixing the networkxml2argv test to pass both
checks, i.e. both unit tests and also syntax check.
Please review,
Michal
Signed-off-by: Michal Novotny <minovotn(a)redhat.com>
---
docs/formatnetwork.html.in | 12 ++
docs/schemas/network.rng | 20 ++-
docs/schemas/networkcommon.rng | 17 +++
src/conf/network_conf.c | 134 +++++++++++++++++++-
src/conf/network_conf.h | 16 +++
src/network/bridge_driver.c | 43 +++++++
.../nat-network-dns-srv-record-minimal.argv | 16 +++
.../nat-network-dns-srv-record-minimal.xml | 26 ++++
.../nat-network-dns-srv-record.argv | 16 +++
.../nat-network-dns-srv-record.xml | 26 ++++
tests/networkxml2argvtest.c | 2 +
.../nat-network-dns-srv-record-minimal.xml | 26 ++++
.../nat-network-dns-srv-record.xml | 26 ++++
.../nat-network-dns-srv-record-minimal.xml | 26 ++++
.../nat-network-dns-srv-record.xml | 26 ++++
15 files changed, 423 insertions(+), 9 deletions(-)
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml
create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml
create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml
create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml
create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index 02302fa..755d510 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -345,6 +345,7 @@
<domain name="example.com"/>
<dns>
<txt name="example" value="example value" />
+ <srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/>
<host ip='192.168.122.2'>
<hostname>myhost</hostname>
<hostname>myhostalias</hostname>
@@ -396,6 +397,17 @@
<span class="since">Since 0.9.3</span>
</dd>
</dl>
+ <dl>
+ <dt><code>srv</code></dt>
+ <dd>The <code>dns</code> element can have also 0 or more <code>srv</code>
+ record elements. Each <code>srv</code> record element defines a DNS SRV record
+ and has 2 mandatory and 5 optional attributes. The mandatory attributes
+ are service name and protocol (tcp, udp) and the optional attributes are
+ target, port, priority, weight and domain as defined in DNS server SRV
+ RFC (RFC 2782).
+ <span class="since">Since 0.9.9</span>
+ </dd>
+ </dl>
</dd>
<dt><code>ip</code></dt>
<dd>The <code>address</code> attribute defines an IPv4 address in
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 937e180..5d58fe4 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -138,6 +138,19 @@
</element>
</zeroOrMore>
<zeroOrMore>
+ <element name="srv">
+ <attribute name="service"><text/></attribute>
+ <attribute name="protocol"><ref name="protocol"/></attribute>
+ <optional>
+ <attribute name="domain"><ref name="dnsName"/></attribute>
+ <attribute name="target"><text/></attribute>
+ <attribute name="port"><ref name="unsignedShort"/></attribute>
+ <attribute name="priority"><ref name="unsignedShort"/></attribute>
+ <attribute name="weight"><ref name="unsignedShort"/></attribute>
+ </optional>
+ </element>
+ </zeroOrMore>
+ <zeroOrMore>
<element name="host">
<attribute name="ip"><ref name="ipv4Addr"/></attribute>
<oneOrMore>
@@ -216,11 +229,4 @@
</interleave>
</element>
</define>
-
- <define name='addr-family'>
- <data type='string'>
- <param name="pattern">(ipv4)|(ipv6)</param>
- </data>
- </define>
-
</grammar>
diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng
index 3a168c3..2328892 100644
--- a/docs/schemas/networkcommon.rng
+++ b/docs/schemas/networkcommon.rng
@@ -95,4 +95,21 @@
<param name="minInclusive">1</param>
</data>
</define>
+
+ <define name='unsignedShort'>
+ <data type='integer'>
+ <param name="minInclusive">0</param>
+ <param name="maxInclusive">65535</param>
+ </data>
+ </define>
+ <define name='protocol'>
+ <data type='string'>
+ <param name='pattern'>(tcp)|(udp)</param>
+ </data>
+ </define>
+ <define name='addr-family'>
+ <data type='string'>
+ <param name="pattern">(ipv4)|(ipv6)</param>
+ </data>
+ </define>
</grammar>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 1058b07..3479543 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -138,6 +138,15 @@ static void virNetworkDNSDefFree(virNetworkDNSDefPtr def)
}
}
VIR_FREE(def->hosts);
+ if (def->nsrvrecords) {
+ while (def->nsrvrecords--) {
+ VIR_FREE(def->srvrecords[def->nsrvrecords].domain);
+ VIR_FREE(def->srvrecords[def->nsrvrecords].service);
+ VIR_FREE(def->srvrecords[def->nsrvrecords].protocol);
+ VIR_FREE(def->srvrecords[def->nsrvrecords].target);
+ }
+ }
+ VIR_FREE(def->srvrecords);
VIR_FREE(def);
}
}
@@ -553,8 +562,103 @@ error:
}
static int
+virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def,
+ xmlNodePtr cur,
+ xmlXPathContextPtr ctxt)
+{
+ char *domain;
+ char *service;
+ char *protocol;
+ char *target;
+ int port;
+ int priority;
+ int weight;
+ int ret = 0;
+
+ if (!(service = virXMLPropString(cur, "service"))) {
+ virNetworkReportError(VIR_ERR_XML_DETAIL,
+ "%s", _("Missing required service attribute in dns srv record"));
+ goto error;
+ }
+
+ if (strlen(service) > DNS_RECORD_LENGTH_SRV) {
+ char *name = NULL;
+
+ virAsprintf(&name, _("Service name is too long, limit is %d bytes"), DNS_RECORD_LENGTH_SRV);
+ virNetworkReportError(VIR_ERR_XML_DETAIL,
+ "%s", name);
+ free(name);
+ goto error;
+ }
+
+ if (!(protocol = virXMLPropString(cur, "protocol"))) {
+ virNetworkReportError(VIR_ERR_XML_DETAIL,
+ _("Missing required protocol attribute in dns srv record '%s'"), service);
+ goto error;
+ }
+
+ /* Check whether protocol value is the supported one */
+ if (STRNEQ(protocol, "tcp") && (STRNEQ(protocol, "udp"))) {
+ virNetworkReportError(VIR_ERR_XML_DETAIL,
+ _("Invalid protocol attribute value '%s'"), protocol);
+ goto error;
+ }
+
+ if (VIR_REALLOC_N(def->srvrecords, def->nsrvrecords + 1) < 0) {
+ virReportOOMError();
+ goto error;
+ }
+
+ def->srvrecords[def->nsrvrecords].service = service;
+ def->srvrecords[def->nsrvrecords].protocol = protocol;
+ def->srvrecords[def->nsrvrecords].domain = NULL;
+ def->srvrecords[def->nsrvrecords].target = NULL;
+ def->srvrecords[def->nsrvrecords].port = 0;
+ def->srvrecords[def->nsrvrecords].priority = 0;
+ def->srvrecords[def->nsrvrecords].weight = 0;
+
+ /* Following attributes are optional but we had to make sure they're NULL above */
+ if ((target = virXMLPropString(cur, "target")) && (domain = virXMLPropString(cur, "domain"))) {
+ xmlNodePtr save_ctxt = ctxt->node;
+
+ ctxt->node = cur;
+ if (virXPathInt("string(./@port)", ctxt, &port))
+ def->srvrecords[def->nsrvrecords].port = port;
+
+ if (virXPathInt("string(./@priority)", ctxt, &priority))
+ def->srvrecords[def->nsrvrecords].priority = priority;
+
+ if (virXPathInt("string(./@weight)", ctxt, &weight))
+ def->srvrecords[def->nsrvrecords].weight = weight;
+ ctxt->node = save_ctxt;
+
+ def->srvrecords[def->nsrvrecords].domain = domain;
+ def->srvrecords[def->nsrvrecords].target = target;
+ def->srvrecords[def->nsrvrecords].port = port;
+ def->srvrecords[def->nsrvrecords].priority = priority;
+ def->srvrecords[def->nsrvrecords].weight = weight;
+ }
+
+ def->nsrvrecords++;
+
+ goto cleanup;
+
+error:
+ VIR_FREE(domain);
+ VIR_FREE(service);
+ VIR_FREE(protocol);
+ VIR_FREE(target);
+
+ ret = -1;
+
+cleanup:
+ return ret;
+}
+
+static int
virNetworkDNSDefParseXML(virNetworkDNSDefPtr *dnsdef,
- xmlNodePtr node)
+ xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
{
xmlNodePtr cur;
int ret = -1;
@@ -599,6 +703,11 @@ virNetworkDNSDefParseXML(virNetworkDNSDefPtr *dnsdef,
name = NULL;
value = NULL;
} else if (cur->type == XML_ELEMENT_NODE &&
+ xmlStrEqual(cur->name, BAD_CAST "srv")) {
+ ret = virNetworkDNSSrvDefParseXML(def, cur, ctxt);
+ if (ret < 0)
+ goto error;
+ } else if (cur->type == XML_ELEMENT_NODE &&
xmlStrEqual(cur->name, BAD_CAST "host")) {
ret = virNetworkDNSHostsDefParseXML(def, cur);
if (ret < 0)
@@ -887,7 +996,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
dnsNode = virXPathNode("./dns", ctxt);
if (dnsNode != NULL) {
- if (virNetworkDNSDefParseXML(&def->dns, dnsNode) < 0)
+ if (virNetworkDNSDefParseXML(&def->dns, dnsNode, ctxt) < 0)
goto error;
}
@@ -1146,6 +1255,27 @@ virNetworkDNSDefFormat(virBufferPtr buf,
def->txtrecords[i].value);
}
+ for (i = 0 ; i < def->nsrvrecords ; i++) {
+ if (def->srvrecords[i].service && def->srvrecords[i].protocol) {
+ virBufferAsprintf(buf, " <srv service='%s' protocol='%s'",
+ def->srvrecords[i].service,
+ def->srvrecords[i].protocol);
+
+ if (def->srvrecords[i].domain)
+ virBufferAsprintf(buf, " domain='%s'", def->srvrecords[i].domain);
+ if (def->srvrecords[i].target)
+ virBufferAsprintf(buf, " target='%s'", def->srvrecords[i].target);
+ if (def->srvrecords[i].port)
+ virBufferAsprintf(buf, " port='%d'", def->srvrecords[i].port);
+ if (def->srvrecords[i].priority)
+ virBufferAsprintf(buf, " priority='%d'", def->srvrecords[i].priority);
+ if (def->srvrecords[i].weight)
+ virBufferAsprintf(buf, " weight='%d'", def->srvrecords[i].weight);
+
+ virBufferAsprintf(buf, "/>\n");
+ }
+ }
+
if (def->nhosts) {
int ii, j;
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 1be20f8..5ef4878 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -24,6 +24,8 @@
#ifndef __NETWORK_CONF_H__
# define __NETWORK_CONF_H__
+ #define DNS_RECORD_LENGTH_SRV (512 - 30) /* Limit minus overhead as mentioned in RFC-2782 */
+
# include <libxml/parser.h>
# include <libxml/tree.h>
# include <libxml/xpath.h>
@@ -69,6 +71,18 @@ struct _virNetworkDNSTxtRecordsDef {
char *value;
};
+typedef struct _virNetworkDNSSrvRecordsDef virNetworkDNSSrvRecordsDef;
+typedef virNetworkDNSSrvRecordsDef *virNetworkDNSSrvRecordsDefPtr;
+struct _virNetworkDNSSrvRecordsDef {
+ char *domain;
+ char *service;
+ char *protocol;
+ char *target;
+ int port;
+ int priority;
+ int weight;
+};
+
struct _virNetworkDNSHostsDef {
virSocketAddr ip;
int nnames;
@@ -82,6 +96,8 @@ struct _virNetworkDNSDef {
virNetworkDNSTxtRecordsDefPtr txtrecords;
unsigned int nhosts;
virNetworkDNSHostsDefPtr hosts;
+ unsigned int nsrvrecords;
+ virNetworkDNSSrvRecordsDefPtr srvrecords;
};
typedef struct _virNetworkDNSDef *virNetworkDNSDefPtr;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 63338a2..0c0e7a7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -527,6 +527,49 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
virCommandAddArgPair(cmd, "--txt-record", record);
VIR_FREE(record);
}
+
+ for (i = 0; i < dns->nsrvrecords; i++) {
+ char *record = NULL;
+ char *recordPort = NULL;
+ char *recordPriority = NULL;
+ char *recordWeight = NULL;
+
+ if (dns->srvrecords[i].service && dns->srvrecords[i].protocol) {
+ if (dns->srvrecords[i].port) {
+ if (virAsprintf(&recordPort, "%d", dns->srvrecords[i].port) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+ if (dns->srvrecords[i].priority) {
+ if (virAsprintf(&recordPriority, "%d", dns->srvrecords[i].priority) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+ if (dns->srvrecords[i].weight) {
+ if (virAsprintf(&recordWeight, "%d", dns->srvrecords[i].weight) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+
+ if (virAsprintf(&record, "%s.%s.%s,%s,%s,%s,%s",
+ dns->srvrecords[i].service,
+ dns->srvrecords[i].protocol,
+ dns->srvrecords[i].domain ? dns->srvrecords[i].domain : "",
+ dns->srvrecords[i].target ? dns->srvrecords[i].target : "",
+ recordPort ? recordPort : "",
+ recordPriority ? recordPriority : "",
+ recordWeight ? recordWeight : "") < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ virCommandAddArgPair(cmd, "--srv-host", record);
+ VIR_FREE(record);
+ }
+ }
}
/*
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
new file mode 100644
index 0000000..021e8f0
--- /dev/null
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
@@ -0,0 +1,16 @@
+/usr/sbin/dnsmasq \
+--strict-order \
+--bind-interfaces \
+--conf-file= \
+--except-interface lo \
+--srv-host=name.tcp.,,,, \
+--listen-address 192.168.122.1 \
+--listen-address 192.168.123.1 \
+--listen-address 2001:db8:ac10:fe01::1 \
+--listen-address 2001:db8:ac10:fd01::1 \
+--listen-address 10.24.10.1 \
+--dhcp-range 192.168.122.2,192.168.122.254 \
+--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-lease-max=253 \
+--dhcp-no-override \
+--dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile\
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml
new file mode 100644
index 0000000..e9b7680
--- /dev/null
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record.argv b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
new file mode 100644
index 0000000..85afbba
--- /dev/null
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
@@ -0,0 +1,16 @@
+/usr/sbin/dnsmasq \
+--strict-order \
+--bind-interfaces \
+--conf-file= \
+--except-interface lo \
+--srv-host=name.tcp.test-domain-name,.,1024,10,10 \
+--listen-address 192.168.122.1 \
+--listen-address 192.168.123.1 \
+--listen-address 2001:db8:ac10:fe01::1 \
+--listen-address 2001:db8:ac10:fd01::1 \
+--listen-address 10.24.10.1 \
+--dhcp-range 192.168.122.2,192.168.122.254 \
+--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-lease-max=253 \
+--dhcp-no-override \
+--dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile\
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record.xml b/tests/networkxml2argvdata/nat-network-dns-srv-record.xml
new file mode 100644
index 0000000..4be85b5
--- /dev/null
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2argvtest.c b/tests/networkxml2argvtest.c
index 4a11d6f..2dd9b7f 100644
--- a/tests/networkxml2argvtest.c
+++ b/tests/networkxml2argvtest.c
@@ -120,6 +120,8 @@ mymain(void)
DO_TEST("netboot-network");
DO_TEST("netboot-proxy-network");
DO_TEST("nat-network-dns-txt-record");
+ DO_TEST("nat-network-dns-srv-record");
+ DO_TEST("nat-network-dns-srv-record-minimal");
DO_TEST("nat-network-dns-hosts");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
diff --git a/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml
new file mode 100644
index 0000000..e9b7680
--- /dev/null
+++ b/tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlin/nat-network-dns-srv-record.xml b/tests/networkxml2xmlin/nat-network-dns-srv-record.xml
new file mode 100644
index 0000000..4be85b5
--- /dev/null
+++ b/tests/networkxml2xmlin/nat-network-dns-srv-record.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml b/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml
new file mode 100644
index 0000000..e9b7680
--- /dev/null
+++ b/tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlout/nat-network-dns-srv-record.xml b/tests/networkxml2xmlout/nat-network-dns-srv-record.xml
new file mode 100644
index 0000000..4be85b5
--- /dev/null
+++ b/tests/networkxml2xmlout/nat-network-dns-srv-record.xml
@@ -0,0 +1,26 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid>
+ <forward dev='eth1' mode='nat'>
+ <interface dev='eth1'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns>
+ <srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10' />
+ </dns>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254' />
+ <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' />
+ <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' />
+ </dhcp>
+ </ip>
+ <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'>
+ </ip>
+ <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'>
+ </ip>
+ <ip family='ipv4' address='10.24.10.1'>
+ </ip>
+</network>
--
1.7.7.3
12 years, 10 months
[libvirt] [libvirt-glib] Add gvir_config_domain_graphics_vnc_set_password
by Christophe Fergeau
Based on the similar patch for SPICE
---
.../libvirt-gconfig-domain-graphics-vnc.c | 10 ++++++++++
.../libvirt-gconfig-domain-graphics-vnc.h | 3 +++
libvirt-gconfig/libvirt-gconfig.sym | 1 +
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
index d4554df..b00a155 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c
@@ -94,3 +94,13 @@ void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graph
"port", G_TYPE_INT, port,
NULL);
}
+
+void gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc *graphics,
+ const char *password)
+{
+ g_return_if_fail(GVIR_IS_CONFIG_DOMAIN_GRAPHICS_VNC(graphics));
+
+ gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics),
+ "passwd", password,
+ NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
index e69ec54..6dbe32c 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.h
@@ -68,6 +68,9 @@ void gvir_config_domain_graphics_vnc_set_autoport(GVirConfigDomainGraphicsVnc *g
void gvir_config_domain_graphics_vnc_set_port(GVirConfigDomainGraphicsVnc *graphics,
int port);
+void gvir_config_domain_graphics_vnc_set_password(GVirConfigDomainGraphicsVnc *graphics,
+ const char *password);
+
G_END_DECLS
#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_VNC_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index bf1948a..20dc969 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -111,6 +111,7 @@ LIBVIRT_GCONFIG_0.0.3 {
gvir_config_domain_graphics_vnc_new;
gvir_config_domain_graphics_vnc_new_from_xml;
gvir_config_domain_graphics_vnc_set_autoport;
+ gvir_config_domain_graphics_vnc_set_password;
gvir_config_domain_graphics_vnc_set_port;
gvir_config_domain_input_bus_get_type;
--
1.7.7.4
12 years, 10 months