[libvirt] [PATCH] network: permit upstream forwarding of unqualified DNS names
by Laine Stump
This resolves the issue that prompted the filing of
https://bugzilla.redhat.com/show_bug.cgi?id=928638
(although the request there is for something much larger and more
general than this patch).
commit f3868259ca0517212e439a65c9060868f673b6c9 disabled the
forwarding to upstream DNS servers of unresolved DNS requests for
names that had no domain, but were just simple host names (no "."
character anywhere in the name). While this behavior is frowned upon
by DNS root servers (that's why it was changed in libvirt), it is
convenient in some cases, and since dnsmasq can be configured to allow
it, it must not be strictly forbidden.
This patch restores the old behavior, but since it is usually
undesirable, restoring it requires specification of a new option in
the network config. Adding the attribute "forwardPlainNames='yes'" to
the <dns> elemnt does the trick - when that attribute is added to a
network config, any simple hostnames that can't be resolved by the
network's dnsmasq instance will be forwarded to the DNS servers listed
in the host's /etc/resolv.conf for an attempt at resolution (just as
any FQDN would be forwarded).
When that attribute *isn't* specified, unresolved simple names will
*not* be forwarded to the upstream DNS server - this is the default
behavior.
---
docs/formatnetwork.html.in | 25 +++++++++++++++----
docs/schemas/network.rng | 8 +++++++
src/conf/network_conf.c | 28 ++++++++++++++++++++--
src/conf/network_conf.h | 1 +
src/network/bridge_driver.c | 20 +++++++++++-----
.../nat-network-dns-forward-plain.conf | 11 +++++++++
.../nat-network-dns-forward-plain.xml | 9 +++++++
tests/networkxml2conftest.c | 1 +
.../nat-network-dns-forward-plain.xml | 9 +++++++
.../nat-network-dns-forward-plain.xml | 11 +++++++++
tests/networkxml2xmltest.c | 1 +
11 files changed, 112 insertions(+), 12 deletions(-)
create mode 100644 tests/networkxml2confdata/nat-network-dns-forward-plain.conf
create mode 100644 tests/networkxml2confdata/nat-network-dns-forward-plain.xml
create mode 100644 tests/networkxml2xmlin/nat-network-dns-forward-plain.xml
create mode 100644 tests/networkxml2xmlout/nat-network-dns-forward-plain.xml
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index eb7c4c7..e1482db 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -663,10 +663,27 @@
with the idiosyncrasies of the platform where libvirt is
running. <span class="since">Since 0.8.8</span>
</dd>
- <dt><code>dns</code></dt><dd>
- The dns element of a network contains configuration information for the
- virtual network's DNS server. <span class="since">Since 0.9.3</span>
- Currently supported elements are:
+ <dt><code>dns</code></dt>
+ <dd> The dns element of a network contains configuration
+ information for the virtual network's DNS
+ server <span class="since">Since 0.9.3</span>.
+
+ <p>
+ The dns element
+ can have an optional <code>forwardPlainNames</code>
+ attribute <span class="since">Since 1.1.2</span>.
+ If <code>forwardPlainNames</code> is "no", then DNS resolution
+ requests for names that are not qualified with a domain
+ (i.e. names with no "." character) will not be forwarded to
+ the host's upstream DNS server - they will only be resolved if
+ they are known locally within the virtual network's own DNS
+ server. If <code>forwardPlainNames</code> is "yes",
+ unqualified names <b>will</b> be forwarded to the upstream DNS
+ server if they can't be resolved by the virtual network's own
+ DNS server.
+ </p>
+
+ Currently supported sub-elements of <code><dns></code> are:
<dl>
<dt><code>txt</code></dt>
<dd>A <code>dns</code> element can have 0 or more <code>txt</code> elements.
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index ded8580..ab183f1 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -208,6 +208,14 @@
and other features in the <dns> element -->
<optional>
<element name="dns">
+ <optional>
+ <attribute name="forwardPlainNames">
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </optional>
<zeroOrMore>
<element name="txt">
<attribute name="name"><ref name="dnsName"/></attribute>
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 9141bbb..bbc980b 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1037,6 +1037,7 @@ virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr *hostNodes = NULL;
xmlNodePtr *srvNodes = NULL;
xmlNodePtr *txtNodes = NULL;
+ char *forwardPlainNames = NULL;
int nhosts, nsrvs, ntxts;
size_t i;
int ret = -1;
@@ -1044,6 +1045,19 @@ virNetworkDNSDefParseXML(const char *networkName,
ctxt->node = node;
+ forwardPlainNames = virXPathString("string(./@forwardPlainNames)", ctxt);
+ if (forwardPlainNames) {
+ if (STREQ(forwardPlainNames, "yes")) {
+ def->forwardPlainNames = true;
+ } else if (STRNEQ(forwardPlainNames, "no")) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid dns forwardPlainNames setting '%s' "
+ "in network '%s'"),
+ forwardPlainNames, networkName);
+ goto cleanup;
+ }
+ }
+
nhosts = virXPathNodeSet("./host", ctxt, &hostNodes);
if (nhosts < 0) {
virReportError(VIR_ERR_XML_ERROR,
@@ -1106,6 +1120,7 @@ virNetworkDNSDefParseXML(const char *networkName,
ret = 0;
cleanup:
+ VIR_FREE(forwardPlainNames);
VIR_FREE(hostNodes);
VIR_FREE(srvNodes);
VIR_FREE(txtNodes);
@@ -2252,10 +2267,19 @@ virNetworkDNSDefFormat(virBufferPtr buf,
int result = 0;
size_t i, j;
- if (!(def->nhosts || def->nsrvs || def->ntxts))
+ if (!(def->forwardPlainNames || def->nhosts || def->nsrvs || def->ntxts))
goto out;
- virBufferAddLit(buf, "<dns>\n");
+ virBufferAddLit(buf, "<dns");
+ if (def->forwardPlainNames) {
+ virBufferAddLit(buf, " forwardPlainNames='yes'");
+ if (!(def->nhosts || def->nsrvs || def->ntxts)) {
+ virBufferAddLit(buf, "/>\n");
+ goto out;
+ }
+ }
+
+ virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
for (i = 0; i < def->ntxts; i++) {
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index a1d3282..920e899 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -115,6 +115,7 @@ struct _virNetworkDNSHostDef {
typedef struct _virNetworkDNSDef virNetworkDNSDef;
typedef virNetworkDNSDef *virNetworkDNSDefPtr;
struct _virNetworkDNSDef {
+ bool forwardPlainNames;
size_t ntxts;
virNetworkDNSTxtDefPtr txts;
size_t nhosts;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dd30244..00f2bef 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -678,20 +678,28 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
"## virsh net-edit %s\n"
"## or other application using the libvirt API.\n"
"##\n## dnsmasq conf file created by libvirt\n"
- "strict-order\n"
- "domain-needed\n",
+ "strict-order\n",
network->def->name);
+ if (!network->def->dns.forwardPlainNames)
+ virBufferAddLit(&configbuf, "domain-needed\n");
+
if (network->def->domain) {
virBufferAsprintf(&configbuf,
"domain=%s\n"
"expand-hosts\n",
network->def->domain);
}
- /* need to specify local even if no domain specified */
- virBufferAsprintf(&configbuf,
- "local=/%s/\n",
- network->def->domain ? network->def->domain : "");
+
+ if (network->def->domain || !network->def->dns.forwardPlainNames) {
+ /* need to specify local even if no domain specified, unless
+ * the config says we should forward "plain" names (i.e. not
+ * fully qualified, no '.' characters)
+ */
+ virBufferAsprintf(&configbuf,
+ "local=/%s/\n",
+ network->def->domain ? network->def->domain : "");
+ }
if (pidfile)
virBufferAsprintf(&configbuf, "pid-file=%s\n", pidfile);
diff --git a/tests/networkxml2confdata/nat-network-dns-forward-plain.conf b/tests/networkxml2confdata/nat-network-dns-forward-plain.conf
new file mode 100644
index 0000000..9a000b8
--- /dev/null
+++ b/tests/networkxml2confdata/nat-network-dns-forward-plain.conf
@@ -0,0 +1,11 @@
+##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
+## virsh net-edit default
+## or other application using the libvirt API.
+##
+## dnsmasq conf file created by libvirt
+strict-order
+except-interface=lo
+bind-dynamic
+interface=virbr0
+addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-forward-plain.xml b/tests/networkxml2confdata/nat-network-dns-forward-plain.xml
new file mode 100644
index 0000000..10bacb5
--- /dev/null
+++ b/tests/networkxml2confdata/nat-network-dns-forward-plain.xml
@@ -0,0 +1,9 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <forward dev='eth0' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns forwardPlainNames='yes'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ </ip>
+</network>
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index b234b30..5825af3 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -144,6 +144,7 @@ mymain(void)
DO_TEST("nat-network-dns-txt-record", full);
DO_TEST("nat-network-dns-srv-record", full);
DO_TEST("nat-network-dns-hosts", full);
+ DO_TEST("nat-network-dns-forward-plain", full);
DO_TEST("dhcp6-network", dhcpv6);
DO_TEST("dhcp6-nat-network", dhcpv6);
DO_TEST("dhcp6host-routed-network", dhcpv6);
diff --git a/tests/networkxml2xmlin/nat-network-dns-forward-plain.xml b/tests/networkxml2xmlin/nat-network-dns-forward-plain.xml
new file mode 100644
index 0000000..10bacb5
--- /dev/null
+++ b/tests/networkxml2xmlin/nat-network-dns-forward-plain.xml
@@ -0,0 +1,9 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <forward dev='eth0' mode='nat'/>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns forwardPlainNames='yes'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmlout/nat-network-dns-forward-plain.xml b/tests/networkxml2xmlout/nat-network-dns-forward-plain.xml
new file mode 100644
index 0000000..3b50828
--- /dev/null
+++ b/tests/networkxml2xmlout/nat-network-dns-forward-plain.xml
@@ -0,0 +1,11 @@
+<network>
+ <name>default</name>
+ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
+ <forward dev='eth0' mode='nat'>
+ <interface dev='eth0'/>
+ </forward>
+ <bridge name='virbr0' stp='on' delay='0' />
+ <dns forwardPlainNames='yes'/>
+ <ip address='192.168.122.1' netmask='255.255.255.0'>
+ </ip>
+</network>
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 0dfed16..11b3f02 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -104,6 +104,7 @@ mymain(void)
DO_TEST("netboot-proxy-network");
DO_TEST("nat-network-dns-txt-record");
DO_TEST("nat-network-dns-hosts");
+ DO_TEST("nat-network-dns-forward-plain");
DO_TEST("8021Qbh-net");
DO_TEST("direct-net");
DO_TEST("host-bridge-net");
--
1.7.11.7
11 years, 2 months
[libvirt] [PATCH 1/1] cpu: Add Power7+ and Power8 CPU definition in map.xml
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
Power7+ and Power8 are supported in QEMU, so it needs to define CPUs
in libvirt to support them.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
src/cpu/cpu_map.xml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 6d51283..7d34d40 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -603,5 +603,16 @@
<vendor name='IBM'/>
<pvr value='0x003f0203'/>
</model>
+
+ <model name='POWER7+_v2.1'>
+ <vendor name='IBM'/>
+ <pvr value='0x004a0201'/>
+ </model>
+
+ <model name='POWER8_v1.0'>
+ <vendor name='IBM'/>
+ <pvr value='0x004b0100'/>
+ </model>
+
</arch>
</cpus>
--
1.8.1.4
11 years, 2 months
[libvirt] [PATCH] doc: storage pool permission copy-paste fix
by Philipp Hahn
The description for <permissions> was copied from the storage volume
section to the storage pool section, but the semantics are different:
1. Currently only the "dir", "fs" and "netfs" storage pools use it.
2. They use it only to build the final directory.
3. A default for the storage volumes can't be set.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
docs/formatstorage.html.in | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
index f4d561f..1fcfb6b 100644
--- a/docs/formatstorage.html.in
+++ b/docs/formatstorage.html.in
@@ -214,11 +214,10 @@
<span class="since">Since 0.4.1</span>
</dd>
<dt><code>permissions</code></dt>
- <dd>Provides information about the default permissions to use
- when creating volumes. This is currently only useful for directory
- or filesystem based pools, where the volumes allocated are simple
- files. For pools where the volumes are device nodes, the hotplug
- scripts determine permissions. It contains 4 child elements. The
+ <dd>This is currently only useful for directory or filesystem based
+ pools, which are mapped as a directory into the local filesystem
+ namespace. It provides information about the permissions to use for the
+ final directory when the pool is built. The
<code>mode</code> element contains the octal permission set. The
<code>owner</code> element contains the numeric user ID. The <code>group</code>
element contains the numeric group ID. The <code>label</code> element
--
1.7.10.4
11 years, 2 months
[libvirt] Add virt-sandbox -s inherit, to execute the sandbox with parents label
by Dan Walsh
This will allow us to run sandbox as the calling process, If I am
running a shell as staff_u:unconfined_r:unconfined_t:s0, and I
execute virt-sandbox -c lxc/// -- /bin/sh
The second patch fixes a problem when users try to upgrade Generic Containers.
[sandbox PATCH 1/2] Add virt-sandbox -s inherit, to execute the
[sandbox PATCH 2/2] GenericContainers do not have unit files.
11 years, 2 months
[libvirt] [PATCH] Directly link against needed libraries
by Guido Günther
The Linux build revealed another missing direkt link target, this time
against selinux libs:
http://honk.sigxcpu.org:8001/view/libvirt/job/libvirt-build-debian-sid-am...
---
Sorry for missing this in the previous patch.
-- GUido
tests/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a9bcf4c..9098dec 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -722,7 +722,7 @@ libsecurityselinuxhelper_la_LDFLAGS = -module -avoid-version \
securityselinuxtest_SOURCES = \
securityselinuxtest.c testutils.h testutils.c
-securityselinuxtest_LDADD = $(LDADDS)
+securityselinuxtest_LDADD = $(LDADDS) $(SELINUX_LIBS)
securityselinuxtest_DEPENDENCIES = libsecurityselinuxhelper.la \
../src/libvirt.la
@@ -731,7 +731,7 @@ if WITH_ATTR
securityselinuxlabeltest_SOURCES = \
securityselinuxlabeltest.c testutils.h testutils.c \
testutilsqemu.h testutilsqemu.c
-securityselinuxlabeltest_LDADD = $(qemu_LDADDS)
+securityselinuxlabeltest_LDADD = $(qemu_LDADDS) $(SELINUX_LIBS)
securityselinuxlabeltest_DEPENDENCIES = libsecurityselinuxhelper.la \
../src/libvirt.la
endif
--
1.8.4.rc1
11 years, 2 months
[libvirt] [PATCH] Honour root prefix in lxcContainerMountFSBlockAuto
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The lxcContainerMountFSBlockAuto method can be used to mount the
initial root filesystem, so it cannot assume a prefix of /.oldroot.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index a943b22..0ab4026 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1144,7 +1144,8 @@ lxcContainerMountDetectFilesystem(const char *src ATTRIBUTE_UNUSED,
*/
static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs,
int fsflags,
- const char *src)
+ const char *src,
+ const char *srcprefix)
{
FILE *fp = NULL;
int ret = -1;
@@ -1154,11 +1155,11 @@ static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs,
char *line = NULL;
const char *type;
- VIR_DEBUG("src=%s dst=%s", src, fs->dst);
+ VIR_DEBUG("src=%s dst=%s srcprefix=%s", src, fs->dst, srcprefix);
/* First time around we use /etc/filesystems */
retry:
- if (virAsprintf(&fslist, "/.oldroot%s",
+ if (virAsprintf(&fslist, "%s%s", srcprefix,
tryProc ? "/proc/filesystems" : "/etc/filesystems") < 0)
goto cleanup;
@@ -1270,7 +1271,8 @@ cleanup:
* probing for filesystem type
*/
static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
- const char *src)
+ const char *src,
+ const char *srcprefix)
{
int fsflags = 0;
int ret = -1;
@@ -1300,7 +1302,7 @@ static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs,
}
ret = 0;
} else {
- ret = lxcContainerMountFSBlockAuto(fs, fsflags, src);
+ ret = lxcContainerMountFSBlockAuto(fs, fsflags, src, srcprefix);
}
cleanup:
@@ -1318,7 +1320,7 @@ static int lxcContainerMountFSBlock(virDomainFSDefPtr fs,
if (virAsprintf(&src, "%s%s", srcprefix, fs->src) < 0)
goto cleanup;
- ret = lxcContainerMountFSBlockHelper(fs, src);
+ ret = lxcContainerMountFSBlockHelper(fs, src, srcprefix);
VIR_DEBUG("Done mounting filesystem ret=%d", ret);
--
1.8.3.1
11 years, 2 months
[libvirt] [PATCH] Properly handle -h / -V for --help/--version aliases in virtlockd/libvirtd
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The virtlockd/libvirtd daemons had listed '?' as the short option
for --help. getopt_long uses '?' for any unknown option. We want
to be able to distinguish unknown options (which use EXIT_FAILURE)
from correct usage of help (which should use EXIT_SUCCESS). Thus
we should use 'h' as a short option for --help. Also add this to
the man page docs
The virtlockd/libvirtd daemons did not list any short option
for the --version arg. Add -V as a valid short option, since
-v is already used for --verbose.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
daemon/libvirtd.c | 31 ++++++++++++++-----------------
daemon/libvirtd.pod.in | 4 ++++
src/locking/lock_daemon.c | 29 +++++++++++++----------------
src/locking/virtlockd.pod.in | 6 +++++-
4 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 402b494..c9cd1a1 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1038,12 +1038,13 @@ daemonUsage(const char *argv0, bool privileged)
" %s [options]\n"
"\n"
"Options:\n"
+ " -h | --help Display program help:\n"
" -v | --verbose Verbose messages.\n"
" -d | --daemon Run as a daemon & write PID file.\n"
" -l | --listen Listen for TCP/IP connections.\n"
" -t | --timeout <secs> Exit after timeout period.\n"
" -f | --config <file> Configuration file.\n"
- " | --version Display version information.\n"
+ " -V | --version Display version information.\n"
" -p | --pid-file <file> Change name of PID file.\n"
"\n"
"libvirt management daemon:\n"),
@@ -1098,10 +1099,6 @@ daemonUsage(const char *argv0, bool privileged)
}
}
-enum {
- OPT_VERSION = 129
-};
-
#define MAX_LISTEN 5
int main(int argc, char **argv) {
virNetServerPtr srv = NULL;
@@ -1123,14 +1120,14 @@ int main(int argc, char **argv) {
mode_t old_umask;
struct option opts[] = {
- { "verbose", no_argument, &verbose, 1},
- { "daemon", no_argument, &godaemon, 1},
- { "listen", no_argument, &ipsock, 1},
+ { "verbose", no_argument, &verbose, 'v'},
+ { "daemon", no_argument, &godaemon, 'd'},
+ { "listen", no_argument, &ipsock, 'l'},
{ "config", required_argument, NULL, 'f'},
{ "timeout", required_argument, NULL, 't'},
{ "pid-file", required_argument, NULL, 'p'},
- { "version", no_argument, NULL, OPT_VERSION },
- { "help", no_argument, NULL, '?' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
{0, 0, 0, 0}
};
@@ -1173,7 +1170,7 @@ int main(int argc, char **argv) {
int c;
char *tmp;
- c = getopt_long(argc, argv, "ldf:p:t:v", opts, &optidx);
+ c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
if (c == -1) {
break;
@@ -1219,17 +1216,17 @@ int main(int argc, char **argv) {
}
break;
- case OPT_VERSION:
+ case 'V':
daemonVersion(argv[0]);
- return 0;
+ exit(EXIT_SUCCESS);
- case '?':
+ case 'h':
daemonUsage(argv[0], privileged);
- return 2;
+ exit(EXIT_SUCCESS);
+ case '?':
default:
- VIR_ERROR(_("%s: internal error: unknown flag: %c"),
- argv[0], c);
+ daemonUsage(argv[0], privileged);
exit(EXIT_FAILURE);
}
}
diff --git a/daemon/libvirtd.pod.in b/daemon/libvirtd.pod.in
index 930b752..9901ecf 100644
--- a/daemon/libvirtd.pod.in
+++ b/daemon/libvirtd.pod.in
@@ -36,6 +36,10 @@ from the configuration.
=over
+=item B<-h, --help>
+
+Display command line help usage then exit.
+
=item B<-d, --daemon>
Run as a daemon & write PID file.
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index c45f45c..77d6e0d 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -1096,10 +1096,11 @@ virLockDaemonUsage(const char *argv0, bool privileged)
" %s [options]\n"
"\n"
"Options:\n"
+ " -h | --help Display program help:\n"
" -v | --verbose Verbose messages.\n"
" -d | --daemon Run as a daemon & write PID file.\n"
" -f | --config <file> Configuration file.\n"
- " | --version Display version information.\n"
+ " -V | --version Display version information.\n"
" -p | --pid-file <file> Change name of PID file.\n"
"\n"
"libvirt lock management daemon:\n"), argv0);
@@ -1138,10 +1139,6 @@ virLockDaemonUsage(const char *argv0, bool privileged)
}
}
-enum {
- OPT_VERSION = 129
-};
-
#define MAX_LISTEN 5
int main(int argc, char **argv) {
virNetServerProgramPtr lockProgram = NULL;
@@ -1161,12 +1158,12 @@ int main(int argc, char **argv) {
int rv;
struct option opts[] = {
- { "verbose", no_argument, &verbose, 1},
- { "daemon", no_argument, &godaemon, 1},
+ { "verbose", no_argument, &verbose, 'v'},
+ { "daemon", no_argument, &godaemon, 'd'},
{ "config", required_argument, NULL, 'f'},
{ "pid-file", required_argument, NULL, 'p'},
- { "version", no_argument, NULL, OPT_VERSION },
- { "help", no_argument, NULL, '?' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
{0, 0, 0, 0}
};
@@ -1185,7 +1182,7 @@ int main(int argc, char **argv) {
int optidx = 0;
int c;
- c = getopt_long(argc, argv, "ldf:p:t:v", opts, &optidx);
+ c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
if (c == -1) {
break;
@@ -1218,17 +1215,17 @@ int main(int argc, char **argv) {
}
break;
- case OPT_VERSION:
+ case 'V':
virLockDaemonVersion(argv[0]);
- return 0;
+ exit(EXIT_SUCCESS);
- case '?':
+ case 'h':
virLockDaemonUsage(argv[0], privileged);
- return 2;
+ exit(EXIT_SUCCESS);
+ case '?':
default:
- fprintf(stderr, _("%s: internal error: unknown flag: %c\n"),
- argv[0], c);
+ virLockDaemonUsage(argv[0], privileged);
exit(EXIT_FAILURE);
}
}
diff --git a/src/locking/virtlockd.pod.in b/src/locking/virtlockd.pod.in
index f5748ca..99612aa 100644
--- a/src/locking/virtlockd.pod.in
+++ b/src/locking/virtlockd.pod.in
@@ -26,6 +26,10 @@ The virtlockd daemon listens for requests on a local Unix domain socket.
=over
+=item B<-h, --help>
+
+Display command line help usage then exit.
+
=item B<-d, --daemon>
Run as a daemon and write PID file.
@@ -42,7 +46,7 @@ Use this name for the PID file, overriding the default value.
Enable output of verbose messages.
-=item B< --version>
+=item B<-V, --version>
Display version information then exit.
--
1.8.3.1
11 years, 2 months
[libvirt] [PATCH] virsh-domain: Flip logic in cmdSetvcpus
by Peter Krempa
To avoid having to assign a failure code to the returned variable switch
this function to negative logic. This will fix issue with invalid number
of cpus returning success return code.
https://bugzilla.redhat.com/show_bug.cgi?id=996466
---
tools/virsh-domain.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4081451..3b2513b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5965,7 +5965,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int count = 0;
- bool ret = true;
+ bool ret = false;
bool maximum = vshCommandOptBool(cmd, "maximum");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
@@ -5996,9 +5996,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
}
if (flags == -1) {
- if (virDomainSetVcpus(dom, count) != 0) {
- ret = false;
- }
+ if (virDomainSetVcpus(dom, count) != 0)
+ goto cleanup;
} else {
/* If the --maximum flag was given, we need to ensure only the
--config flag is in effect as well */
@@ -6015,18 +6014,18 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
/* Warn the user about the invalid flag combination */
vshError(ctl, _("--maximum must be used with --config only"));
- ret = false;
goto cleanup;
}
}
/* Apply the virtual cpu changes */
- if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
- ret = false;
- }
+ if (virDomainSetVcpusFlags(dom, count, flags) < 0)
+ goto cleanup;
}
- cleanup:
+ ret = true;
+
+cleanup:
virDomainFree(dom);
return ret;
}
--
1.8.3.2
11 years, 2 months
[libvirt] [PATCH 0/2] Support settings the 'removable' flag for USB disks
by Fred A. Kemp
From: "Fred A. Kemp" <anonym(a)lavabit.com>
The commit message of patch #2 explains the purpose of this patch set.
A review would be greatly appreciated!
Note that I've only added the new capability for usb-storage.removable
to the qemu help tests of qemu(-kvm) version 1.2.0, since that's what I
had easily available to get the output of `-device usb-storage,?` from.
I hope that's not an issue, otherwise, is there a way to obtain these
outputs without having to hunt down and install all supported versions?
Previous submissions of this patch set to this list:
http://www.redhat.com/archives/libvir-list/2013-March/msg01051.html
http://www.redhat.com/archives/libvir-list/2013-May/msg02039.html
Cheers!
Fred A. Kemp (2):
qemu: Add capability flag for usb-storage
qemu: Support setting the 'removable' flag for USB disks
docs/formatdomain.html.in | 8 +++--
docs/schemas/domaincommon.rng | 8 +++++
src/conf/domain_conf.c | 31 ++++++++++++++++++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 10 +++++++
src/qemu/qemu_capabilities.h | 2 ++
src/qemu/qemu_command.c | 23 +++++++++++++--
tests/qemuhelpdata/qemu-1.2.0-device | 11 +++++++
tests/qemuhelpdata/qemu-kvm-1.2.0-device | 11 +++++++
tests/qemuhelptest.c | 20 +++++++++----
.../qemuxml2argv-disk-usb-device-removable.args | 8 +++++
.../qemuxml2argv-disk-usb-device-removable.xml | 27 +++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++-
13 files changed, 151 insertions(+), 15 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-usb-device-removable.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-usb-device-removable.xml
--
1.7.10.4
11 years, 2 months
[libvirt] [PATCH v2 0/2] Add support for adjusting the 64-bit PCI hole size
by Ján Tomko
v2:
Use 'pcihole64' attribute of the root PCI controller
instead of <pcihole64> element in domain features.
v1:
https://www.redhat.com/archives/libvir-list/2013-August/msg00510.html
https://bugzilla.redhat.com/show_bug.cgi?id=990418
Ján Tomko (2):
Add pcihole64 attribute to root PCI controllers
Build QEMU command line for pcihole64
docs/formatdomain.html.in | 8 +++
docs/schemas/domaincommon.rng | 32 +++++++++---
src/conf/domain_conf.c | 17 +++++++
src/conf/domain_conf.h | 8 +++
src/qemu/qemu_capabilities.c | 14 ++++++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 58 ++++++++++++++++++++++
.../qemuxml2argv-pcihole64-none.args | 4 ++
.../qemuxml2argv-pcihole64-none.xml | 21 ++++++++
.../qemuxml2argv-pcihole64-q35.args | 9 ++++
.../qemuxml2argv-pcihole64-q35.xml | 31 ++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args | 5 ++
tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml | 21 ++++++++
tests/qemuxml2argvtest.c | 10 ++++
tests/qemuxml2xmltest.c | 4 ++
15 files changed, 236 insertions(+), 8 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-none.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcihole64.xml
--
1.8.1.5
11 years, 2 months