[libvirt] [PATCH] virconf: Fix config file path construction
by Erik Skultety
Since commit c4bdff19, the path to the configuration file has been constructed
in the following manner:
- if no config filename was passed to virConfLoadConfigPath, libvirt.conf was
used as default
- otherwise the filename was concatenated with
"<config_dir>/libvirt/libvirt%s%s.conf" which in admin case resulted in
"libvirt-libvirt-admin.conf.conf". Obviously, this non-existent config led to
ignoring all user settings in libvirt-admin.conf. This patch requires the
config filename to be always provided as an argument with the concatenation
being simplified.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357364
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/libvirt.c | 2 +-
src/util/virconf.c | 12 ++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 68c8317..52462e3 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -969,7 +969,7 @@ virConnectOpenInternal(const char *name,
if (ret == NULL)
return NULL;
- if (virConfLoadConfig(&conf, NULL) < 0)
+ if (virConfLoadConfig(&conf, "libvirt.conf") < 0)
goto failed;
if (name && name[0] == '\0')
diff --git a/src/util/virconf.c b/src/util/virconf.c
index ee54072..3e49f41 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1566,20 +1566,16 @@ virConfLoadConfigPath(const char *name)
{
char *path;
if (geteuid() == 0) {
- if (virAsprintf(&path, "%s/libvirt/libvirt%s%s.conf",
- SYSCONFDIR,
- name ? "-" : "",
- name ? name : "") < 0)
+ if (virAsprintf(&path, "%s/libvirt/%s",
+ SYSCONFDIR, name) < 0)
return NULL;
} else {
char *userdir = virGetUserConfigDirectory();
if (!userdir)
return NULL;
- if (virAsprintf(&path, "%s/libvirt%s%s.conf",
- userdir,
- name ? "-" : "",
- name ? name : "") < 0) {
+ if (virAsprintf(&path, "%s/%s",
+ userdir, name) < 0) {
VIR_FREE(userdir);
return NULL;
}
--
2.5.5
8 years, 4 months
[libvirt] [PATCH] admin: Fix default uri config option name s/admin_uri_default/uri_default
by Erik Skultety
The original name 'admin_uri_default' was introduced to our code by commit
dbecb87f. However, at that time we already had a separate config file for
admin library but the commit mentioned above didn't properly adjust the
config's option name. The result is that when we're loading the config, we
check a non-existent config option (there's not much to do with the URIs
anyway, since we only allow local connection). Additionally, virt-admin's man
page documents, that the default URI can be altered by setting
admin_uri_default option. So the fix proposed by this patch leaves the
libvirt-admin.conf as is and adjusts the naming in the code as well as in the
virt-admin's man page.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/libvirt-admin.c | 2 +-
tools/virt-admin.pod | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 859f937..4bf29b1 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -167,7 +167,7 @@ virAdmGetDefaultURI(virConfPtr conf, char **uristr)
return -1;
VIR_DEBUG("Using LIBVIRT_ADMIN_DEFAULT_URI '%s'", *uristr);
} else {
- if (virConfGetValueString(conf, "admin_uri_default", uristr) < 0)
+ if (virConfGetValueString(conf, "uri_default", uristr) < 0)
return -1;
if (*uristr) {
diff --git a/tools/virt-admin.pod b/tools/virt-admin.pod
index 2765bc5..2199038 100644
--- a/tools/virt-admin.pod
+++ b/tools/virt-admin.pod
@@ -127,7 +127,7 @@ Will print the current directory.
(Re)-Connect to a daemon's administrating server. The I<URI> parameter
specifies how to connect to the administrating server.
-If I<LIBVIRT_ADMIN_DEFAULT_URI> or I<admin_uri_default> (see below) were set,
+If I<LIBVIRT_ADMIN_DEFAULT_URI> or I<uri_default> (see below) were set,
I<connect> is automatically issued every time a command that requires an
active connection is executed. Note that this only applies if there is no
connection at all or there is an inactive one.
@@ -137,8 +137,9 @@ To find the currently used URI, check the I<uri> command documented below.
=item B<uri>
Prints the administrating server canonical URI, can be useful in shell mode. If
-no I<uri> was specified, neither I<LIBVIRT_ADMIN_DEFAULT_URI> or
-I<admin_uri_default> were set, libvirtd:///system is used.
+no I<uri> was specified, neither I<LIBVIRT_ADMIN_DEFAULT_URI> environment
+variable nor I<uri_default> option (libvirt-admin.conf) were set,
+libvirtd:///system is used.
=back
--
2.5.5
8 years, 4 months
[libvirt] [PATCH v7 0/7] qemu: expand domain memory statistics
by Derbyshev Dmitriy
From: Derbyshev Dmitry <dderbyshev(a)virtuozzo.com>
QEMU reports timestamp and available along with other memory statistics.
This information was not saved into domain statistics.
1st to 3rd patches add new stats to reports.
Also, to collect all balloon statistics for all guests it was necessary to make
several libvirt requests (one per VE)..
4th and 5th patch allows doing this via qemuConnectGetAllDomainStats in one
request.
6th patch speed-ups DomainMemoryStats by caching so that requests would not gain
much additional overhead from previous patches.
7th patch adds probbing and can be dropped.
Changes since v1:
* Enum numeration fixed
* Macro getting "usage" field fixed
Changes since v2:
* Previous patches were on wrong branch
* qemu's stat name was "stat-available-memory"
Changes since v3:
* domstats patch added
Changes since v4:
* Formatted and rephrased commit messages
* Fixed libvirt crash, caused by simultaneous incorrect QUERY job execution
Changes since v5:
* Updated virsh.pod
* Splitted patch about domstats into 2 patches
* Do not report balloon.current as balloon.actual
Changes since v6:
* caching added for DomainMemoryStats
Derbyshev Dmitry (5):
virsh: Add balloon stats description to .pod
qemu: expand domain memory statistics with 'usable'
qemu: expand domain memory statistics with 'last-update' timestamp
qemu: split qemuDomainMemoryStats into internal and external functions
qemu: return balloon statistics when all domain statistics reported
Igor Redko (2):
qemu: add cache for DomainMemoryStats
qemu-probes: add probes for cache MemoryStats cache
include/libvirt/libvirt-domain.h | 11 ++-
src/libvirt-domain.c | 5 ++
src/libvirt_qemu_probes.d | 4 +
src/qemu/qemu_domain.h | 6 ++
src/qemu/qemu_driver.c | 187 +++++++++++++++++++++++++++++++++++----
src/qemu/qemu_monitor_json.c | 24 +++--
tools/virsh-domain-monitor.c | 4 +
tools/virsh.pod | 29 +++++-
8 files changed, 242 insertions(+), 28 deletions(-)
--
1.9.5.msysgit.0
8 years, 4 months
[libvirt] [PATCH] virsh: use virConnectGetDomainCapabilities with maxvcpus
by Shivaprasad G Bhat
The following patch fixes the maxvcpus output on PPC64.
Earlier I tried fixing this in kvmGetMaxVcpus() which was
later decided to be document not use the virConnectGetMaxVcpus() instead
use the virConnectGetDomainCapabilities api.
I have not implemented the suggestedcpus as mentioned in my previous
patches in this yet.
Previous series fixing the virConnectGetDomainCapabilities can be found here.
https://www.redhat.com/archives/libvir-list/2016-June/msg01873.html
---
Shivaprasad G Bhat (1):
virsh: use virConnectGetDomainCapabilities with maxvcpus
tools/virsh-host.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
--
Signature
8 years, 4 months
[libvirt] [PATCH sandbox] image: Rename 'create' and 'delete' to 'prepare' and 'purge'
by Daniel P. Berrange
Currently we have three virt-sandbox-image commands
- 'create' - downloads a template and creates qcow2
- 'delete' - deletes template qcow2 files
- 'run' - runs an instance of a template
The 'run' command is generating a transient guest which
disappears when it stops. We want to have the ability to
create / delete persistent guests later, for which the
command names "create" and "delete" are a natural fit.
So to avoid clash, rename the existing "create" command
to "prepare" and the "delete" command to "purge"
---
libvirt-sandbox/image/cli.py | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index 66854e4..3a5ccfa 100644
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -68,13 +68,13 @@ def get_template_dir(args):
tmpl = template.Template.from_uri(args.template)
return "%s/%s" % (args.template_dir, tmpl.source)
-def delete(args):
+def purge(args):
tmpl = template.Template.from_uri(args.template)
source = tmpl.get_source_impl()
source.delete_template(template=tmpl,
templatedir=get_template_dir(args))
-def create(args):
+def prepare(args):
tmpl = template.Template.from_uri(args.template)
source = tmpl.get_source_impl()
source.create_template(template=tmpl,
@@ -91,7 +91,7 @@ def run(args):
# Create the template image if needed
if not source.has_template(tmpl, template_dir):
- create(args)
+ prepare(args)
name = args.name
if name is None:
@@ -197,26 +197,26 @@ Example supported URI formats:
""")
return parser
-def gen_delete_args(subparser):
- parser = gen_command_parser(subparser, "delete",
- _("Delete template data"))
+def gen_purge_args(subparser):
+ parser = gen_command_parser(subparser, "purge",
+ _("Purge cached template"))
requires_debug(parser)
requires_template(parser)
requires_template_dir(parser)
- parser.set_defaults(func=delete)
+ parser.set_defaults(func=purge)
-def gen_create_args(subparser):
- parser = gen_command_parser(subparser, "create",
- _("Create image from template data"))
+def gen_prepare_args(subparser):
+ parser = gen_command_parser(subparser, "prepare",
+ _("Prepare local template"))
requires_debug(parser)
requires_template(parser)
requires_connect(parser)
requires_template_dir(parser)
- parser.set_defaults(func=create)
+ parser.set_defaults(func=prepare)
def gen_run_args(subparser):
parser = gen_command_parser(subparser, "run",
- _("Run an already built image"))
+ _("Run an instance of a template"))
requires_debug(parser)
requires_name(parser)
requires_template(parser)
@@ -248,8 +248,8 @@ def main():
parser = argparse.ArgumentParser(description="Sandbox Container Image Tool")
subparser = parser.add_subparsers(help=_("commands"))
- gen_delete_args(subparser)
- gen_create_args(subparser)
+ gen_purge_args(subparser)
+ gen_prepare_args(subparser)
gen_run_args(subparser)
gen_list_args(subparser)
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] virt-admin.pod: Remove a statement about remote access to the daemon
by Erik Skultety
There's been a forgotten fragment (copy-paste error probably) in the
virt-admin's man page referring the reader to our web page on how to construct
URIs in case of remote access, which sort of implies that we support it which
we don't at the moment, so better remove that.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
Pushed under trivial rule.
Erik
tools/virt-admin.pod | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/virt-admin.pod b/tools/virt-admin.pod
index afc4689..2765bc5 100644
--- a/tools/virt-admin.pod
+++ b/tools/virt-admin.pod
@@ -134,9 +134,6 @@ connection at all or there is an inactive one.
To find the currently used URI, check the I<uri> command documented below.
-For remote access see the documentation page at
-L<http://libvirt.org/uri.html> on how to make URIs.
-
=item B<uri>
Prints the administrating server canonical URI, can be useful in shell mode. If
--
2.5.5
8 years, 4 months
[libvirt] [PATCH 00/25] Add support for multi-host gluster drives
by Peter Krempa
This is a updated take based on stuff I had laying around and parts from
https://www.redhat.com/archives/libvir-list/2016-July/msg00872.html
This addresses the backing store parser, adds and improves bits to the
JSON->commandline generator prior to plugging in the gluster support.
This series does not yet address block jobs (snapshot/block copy) using
multi-host gluster volumes.
Peter Krempa (24):
tests: qemuxml2xml: Avoid crash when processing an XML that fails to
parse
tests: Add testing of backing store string parser
util: storage: Add parser for qemu's "json" backing pseudo-protocol
util: storage: Add support for host device backing specified via JSON
util: storage: Add support for URI based backing volumes in qemu's
JSON pseudo-protocol
util: storage: Add json pseudo protocol support for gluster volumes
util: storage: Add json pseudo protocol support for iSCSI volumes
util: storage: Add JSON backing volume parser for 'nbd' protocol
util: storage: Add JSON backing store parser for 'sheepdog' protocol
util: storage: Add 'ssh' network storage protocol
util: storage: Add JSON backing volume parser for 'ssh' protocol
util: json: Make first argument of virJSONValueObjectForeachKeyValue
const
util: qemu: Add wrapper for JSON -> commandline conversion
util: qemu: Add support for user-passed strings in JSON->commandline
util: qemu: Allow nested objects in JSON -> commandline generator
util: qemu: Allow for different approaches to format JSON arrays
util: qemu: Don't generate any extra commas in
virQEMUBuildCommandLineJSON
qemu: command: Rename qemuBuildNetworkDriveURI to
qemuBuildNetworkDriveStr
qemu: command: Split out network disk URI building
qemu: command: Extract drive source command line formatter
qemu: command: Refactor code extracted to qemuBuildDriveSourceStr
storage: gluster: Support multiple hosts in backend functions
util: qemu: Add support for numbered array members
qemu: command: Add infrastructure for object specified disk sources
Prasanna Kumar Kalever (1):
qemu: command: Add support for multi-host gluster disks
docs/formatdomain.html.in | 2 +-
src/libvirt_private.syms | 5 +
src/libxl/libxl_conf.c | 1 +
src/qemu/qemu_command.c | 428 +++++++++++++++------
src/qemu/qemu_driver.c | 3 +
src/qemu/qemu_parse_command.c | 1 +
src/storage/storage_backend_gluster.c | 82 ++--
src/util/virjson.c | 2 +-
src/util/virjson.h | 2 +-
src/util/virqemu.c | 219 +++++++++--
src/util/virqemu.h | 16 +
src/util/virstoragefile.c | 375 +++++++++++++++++-
src/util/virstoragefile.h | 4 +
src/xenconfig/xen_xl.c | 1 +
tests/qemucommandutiltest.c | 68 +++-
.../qemuxml2argv-disk-drive-network-gluster.args | 9 +-
.../qemuxml2argv-disk-drive-network-gluster.xml | 9 +
.../qemuxml2xmlout-disk-drive-network-gluster.xml | 10 +
tests/qemuxml2xmltest.c | 9 +-
tests/virstoragetest.c | 150 ++++++++
20 files changed, 1169 insertions(+), 227 deletions(-)
--
2.9.0
8 years, 4 months
[libvirt] [PATCHv2 00/10] JSON pseudo-protocol support for backing chains
by Peter Krempa
This part is extracted from the gluster series since Eric's comment on the
original RFC triggered a rework of certain parts.
This version allows to handle both flattened and hierarchical syntaxes (see
patch 1/10) for details.
Peter Krempa (10):
util: storage: Add parser for qemu's json backing pseudo-protocol
util: json: Make first argument of virJSONValueCopy const
util: storage: Add support for host device backing specified via JSON
util: storage: Add support for URI based backing volumes in qemu's
JSON pseudo-protocol
util: storage: Add json pseudo protocol support for gluster volumes
util: storage: Add json pseudo protocol support for iSCSI volumes
util: storage: Add JSON backing volume parser for 'nbd' protocol
util: storage: Add JSON backing store parser for 'sheepdog' protocol
util: storage: Add 'ssh' network storage protocol
util: storage: Add JSON backing volume parser for 'ssh' protocol
src/libxl/libxl_conf.c | 1 +
src/qemu/qemu_command.c | 7 +
src/qemu/qemu_driver.c | 3 +
src/qemu/qemu_parse_command.c | 1 +
src/util/virjson.c | 2 +-
src/util/virjson.h | 2 +-
src/util/virstoragefile.c | 447 +++++++++++++++++++++++++++++++++++++++++-
src/util/virstoragefile.h | 1 +
src/xenconfig/xen_xl.c | 1 +
tests/virstoragetest.c | 131 +++++++++++++
10 files changed, 586 insertions(+), 10 deletions(-)
--
2.9.0
8 years, 4 months
[libvirt] [PATCH] qemu: Adjust the cur_ballon on coldplug/unplug of dimms
by Shivaprasad G Bhat
The cur_balloon also increases/decreases with dimm hotplug/unplug.
To be consistent, adjust the value for coldplug too. This was inconsistently
taken care when cur_ballon != memory to begin with. The patch fixes it
irrespective of that.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/conf/domain_conf.c | 3 +--
src/qemu/qemu_driver.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6dfcf81..8b0b790 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14674,8 +14674,7 @@ virDomainMemoryRemove(virDomainDefPtr def,
VIR_DELETE_ELEMENT(def->mems, idx, def->nmems);
/* fix up balloon size */
- if (def->mem.cur_balloon > virDomainDefGetMemoryTotal(def))
- def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
+ def->mem.cur_balloon -= ret->size;
/* fix total memory size of the domain */
virDomainDefSetMemoryTotal(def, memory - ret->size);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cda85f6..3824e1d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7769,8 +7769,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
return -1;
}
- if (vmdef->mem.cur_balloon == virDomainDefGetMemoryTotal(vmdef))
- vmdef->mem.cur_balloon += dev->data.memory->size;
+ vmdef->mem.cur_balloon += dev->data.memory->size;
if (virDomainMemoryInsert(vmdef, dev->data.memory) < 0)
return -1;
8 years, 4 months