Re: [libvirt] [PATCH] Clear bandwidth settings for a shutoff domain using domiftune
On 08/11/2014 06:05 PM, Michal Privoznik wrote: On 11.08.2014 08:41, Jianwei Hu wrote: qemu: To clear bandwidth settings for a shutoff domain by using domiftune. After applying this patch, we can use virsh domiftune command to clear inbound or/and outbound setting for a shutoff domain. for example: virsh domiftune $domain $interface 0 0 Thanks for catching this. Please refer to below virsh help message: man virsh: To clear inbound or outbound settings, use --inbound or --outbound respectfully with average value of zero. --- src/qemu/qemu_driver.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 82a82aa..7db2e9c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9983,11 +9983,17 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, VIR_FREE(persistentNet-bandwidth-in); persistentNet-bandwidth-in = bandwidth-in; bandwidth-in = NULL; +} else { +VIR_FREE(persistentNet-bandwidth-in); +persistentNet-bandwidth-in = 0; We like NULL for pointer more than 0. Moreover, there's no need to explicitly set pointer freed to NULL as the VIR_FREE() macro does that already for you (in fact virFree() function does that, whatever). } if (bandwidth-out) { VIR_FREE(persistentNet-bandwidth-out); persistentNet-bandwidth-out = bandwidth-out; bandwidth-out = NULL; +} else { +VIR_FREE(persistentNet-bandwidth-out); +persistentNet-bandwidth-out = 0; } } But the fix isn't quite right. For instance: virsh # domiftune dummy 52:54:00:89:3a:c2 --config inbound.average: 10 inbound.peak : 0 inbound.burst : 0 outbound.average: 10 outbound.peak : 0 outbound.burst : 0 virsh # domiftune dummy 52:54:00:89:3a:c2 --config 100 virsh # domiftune dummy 52:54:00:89:3a:c2 --config inbound.average: 100 inbound.peak : 0 inbound.burst : 0 outbound.average: 0 outbound.peak : 0 outbound.burst : 0 The bandwidth is cleared unconditionally. What we really need is: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 82a82aa..2c3f179 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9983,11 +9983,15 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, VIR_FREE(persistentNet-bandwidth-in); persistentNet-bandwidth-in = bandwidth-in; bandwidth-in = NULL; +} else if (inboundSpecified) { +VIR_FREE(persistentNet-bandwidth-in); } if (bandwidth-out) { VIR_FREE(persistentNet-bandwidth-out); persistentNet-bandwidth-out = bandwidth-out; bandwidth-out = NULL; +} else if (outboundSpecified) { +VIR_FREE(persistentNet-bandwidth-out); } } I'm fixing this patch though and pushing. ACK. Thanks for your advice and correction. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 libvirt 1/8] conf: add model child element to filesystem
On 2014/8/11 22:47, Giuseppe Scrivano wrote: @@ -6458,6 +6463,7 @@ virDomainFSDefParseXML(xmlNodePtr node, virDomainFSDefPtr def; xmlNodePtr cur, save_node = ctxt-node; char *type = NULL; +char *model = NULL; char *fsdriver = NULL; char *source = NULL; char *target = NULL; @@ -6535,6 +6541,9 @@ virDomainFSDefParseXML(xmlNodePtr node, wrpolicy = virXMLPropString(cur, wrpolicy); if (!format) format = virXMLPropString(cur, format); +} else if (!model + xmlStrEqual(cur-name, BAD_CAST model)) { +model = virXMLPropString(cur, type); } } cur = cur-next; @@ -6556,6 +6565,14 @@ virDomainFSDefParseXML(xmlNodePtr node, } } +if (model) { +if ((def-model = virDomainFSModelTypeFromString(model)) = 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(unknown model value '%s'), model); +goto error; +} +} + if (wrpolicy) { if ((def-wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) = 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, The memory allocated by model should be freed in cleanup. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] qemu: min_guarantee: Parameter 'min_guarantee' not supported
On 2014/8/11 18:07, Erik Skultety wrote: The 'min_guarantee' is used by esx and vmx drivers, with qemu however, libvirt should report error when starting a domain, because this element is not used. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455 --- The idea seems good. I misunderstood 'min_guarantee' till I saw your patch (and code). So I think the users will be clearer if the document(formatdomain.html) shows min_guarantee is only used for some drivers. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC][scale] new API for querying domains stats
On Tue, Aug 05, 2014 at 01:36:02PM +0800, Li Wei wrote: Hi Richard, Thanks for your comment! On 08/04/2014 04:39 PM, Richard W.M. Jones wrote: On Mon, Aug 04, 2014 at 11:38:41AM +0800, Li Wei wrote: Hi, On 07/22/2014 03:25 PM, Richard W.M. Jones wrote: Did anything come of this discussion, and/or is someone working on this? I am working on an API to query block stats in a bulk style and proposed an API as follow: virDomainBlockStatsBulkFlags(virDomainPtr dom, virTypedParameterPtr params, int nparams, int ndisks, unsigned int flags) @dom: pointer to domain object @params: an array of typed param to be populated with block stats @nparams: how many params used for each block device @ndisks: how many block devices to query @flags: flags to filter block devices (not used for now) Returns -1 in case of error, 0 in case of success. with params == NULL, nparams == -1, ndisks == 1, return number of params for each block device. with params == NULL, nparams == -1, ndisks == -1, return number of disks in the domain. A typical usage of this API should be: nparams = virDomainBlockStatsBulkFlags(dom, NULL, -1, 1, 0); ndisks = virDomainBlockStatsBulkFlags(dom, NULL, -1, -1, 0); params = VIR_ALLOC_N(params, nparams * ndisks); ret = virDomainBlockStatsBulkFlags(dom, params, nparams, ndisks, 0); ... do something with params VIR_FREE(params); With this bulk API, virt-top can updates in a short interval for a domain with a lot of disks. Any comments? I think this works OK for the case where you have 1 domains with lots of disks. However if you have a large number of domains each with 1 or 2 disks I think you would have the same problem as currently. Yes, it is. Is it possible to design an API that can work across all domains in a single call? How about the following API: int virConnectGetAllBlockStats(virConnectPtr conn, virDomainPtr domain, virDomainBlockBulkStatsPtr *stats, unsigned int flags); @conn: pointer to libvirt connection @domain: pointer to the domain to be queried, NULL for all domains @stats: array of virDomainBlockBulkStats struct(see below) to be populated @flags: filter flags Return the number of virDomainBlockBulkStats populated. where virDomainBlockBulkStats defined as: struct _virDomainBlockBulkStats { virDomainPtr domain; /* domain the block stats belongs to */ virTypedParameterPtr params; /* params to store block stats */ unsigned int nparams; /* how many params used for each block stats */ unsigned int ndisks; /* how many block stats in this domain */ }; Works for me. Please CC me on any patches so I can review them more easily for you. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC] LXC: add HOME environment variable
On Mon, Aug 11, 2014 at 11:13 AM, Daniel P. Berrange berra...@redhat.com wrote: On Tue, Aug 05, 2014 at 02:40:53AM +, chenhanx...@cn.fujitsu.com wrote: ping -Original Message- From: libvir-list-boun...@redhat.com [mailto:libvir-list-boun...@redhat.com] On Behalf Of Chen Hanxiao Sent: Friday, July 25, 2014 2:40 PM To: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC] LXC: add HOME environment variable We lacked of HOME environment variable, set 'HOME=/' as default. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_container.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 1cf2c8f..9df9c04 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -236,6 +236,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef, virCommandAddEnvString(cmd, PATH=/bin:/sbin); virCommandAddEnvString(cmd, TERM=linux); virCommandAddEnvString(cmd, container=lxc-libvirt); +virCommandAddEnvString(cmd, HOME=/); virCommandAddEnvPair(cmd, container_uuid, uuidstr); if (nttyPaths 1) virCommandAddEnvPair(cmd, container_ttys, virBufferCurrentContent(buf)); I'm curious what expects to have a $HOME env var set. I'd tend to view the setting of $HOME to be something that the software in the container should take care of. The kernel sets up $HOME for the init process. Therefore any init can assume that $HOME is set. libvirt currently violates that implicit rule. Setting HOME=/ in libvirt isn't a problem, I'm just curious why we need it. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Thanks, //richard -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Verifying libvirt release tarballs
On Mon, Aug 11, 2014 at 11:40:11PM +0200, Richard Weinberger wrote: Hi! How can I cryptographically verify libvirt releases? There are no signature/hash files in http://libvirt.org/sources/. All I see is that your git release tags are PGP signed. So, anyone who cares has to ignore everything in http://libvirt.org/sources/ and needs to regenerate the tarball from git. Or do I miss something? Yeah, re-generate tarball from git doesn't really fly because it contains auto-generated autoconf stuff that will never give you the exact matching content without huge amounts of trouble. I wonder if DV would be willing to generate sigs during release. It is merely a case of running 'gpg --armour --detach libvirt-x.y.z.tar.gz' and then uploading the .asc file to libvirt.org too. Likewise for the python binding tar.gz - pypi would like if we uploaded a .sig file Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC] LXC: add HOME environment variable
On Tue, Aug 12, 2014 at 11:21:41AM +0200, Richard Weinberger wrote: On Mon, Aug 11, 2014 at 11:13 AM, Daniel P. Berrange berra...@redhat.com wrote: On Tue, Aug 05, 2014 at 02:40:53AM +, chenhanx...@cn.fujitsu.com wrote: ping -Original Message- From: libvir-list-boun...@redhat.com [mailto:libvir-list-boun...@redhat.com] On Behalf Of Chen Hanxiao Sent: Friday, July 25, 2014 2:40 PM To: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC] LXC: add HOME environment variable We lacked of HOME environment variable, set 'HOME=/' as default. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- src/lxc/lxc_container.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 1cf2c8f..9df9c04 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -236,6 +236,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef, virCommandAddEnvString(cmd, PATH=/bin:/sbin); virCommandAddEnvString(cmd, TERM=linux); virCommandAddEnvString(cmd, container=lxc-libvirt); +virCommandAddEnvString(cmd, HOME=/); virCommandAddEnvPair(cmd, container_uuid, uuidstr); if (nttyPaths 1) virCommandAddEnvPair(cmd, container_ttys, virBufferCurrentContent(buf)); I'm curious what expects to have a $HOME env var set. I'd tend to view the setting of $HOME to be something that the software in the container should take care of. The kernel sets up $HOME for the init process. Therefore any init can assume that $HOME is set. libvirt currently violates that implicit rule. Ah ok, that makese sense then. ACK Setting HOME=/ in libvirt isn't a problem, I'm just curious why we need it. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib] [PATCH 3/4] GVirDomainSnapshot: Add _set_config
On Thu, Aug 7, 2014 at 12:03 PM, Himanshu Sharma himanshu.sha...@nectechnologies.in wrote: You have any idea how I can clone VM of ESXi from libvirt? Can you please ask in a separate thread (an new email with an appropriate subject line) you exact questions on this list? There are good chances at least some people can answer your questions. Thank you. http://en.wikipedia.org/wiki/Conversation_threading -- Regards, Zeeshan Ali (Khattak) Befriend GNOME: http://www.gnome.org/friends/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] Fix libvirtd crash when starting two managedsave operations on a single domain
We had an unfortunate code path where when you'd start two managedsave operations simultaneously libvirtd would crash. Fix it by adding a VM liveness check. Peter Krempa (3): qemu: managedsave: Check that VM is alive after entering async job security: selinux: Set saved state label only if it is available qemu: migration: Check domain live state after exitting the monitor src/qemu/qemu_driver.c | 6 ++ src/qemu/qemu_migration.c | 19 +-- src/security/security_selinux.c | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] qemu: managedsave: Check that VM is alive after entering async job
Saving a shutoff VM doesn't make sense (and has suboptimal effects on stability of the libvirt daemon). Check that the domain is alive after entering the save async job. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1129207 --- src/qemu/qemu_driver.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2c3f179..b6219ba 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3096,6 +3096,12 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE) 0) goto cleanup; +if (!virDomainObjIsActive(vm)) { +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(guest unexpectedly quit)); +goto endjob; +} + memset(priv-job.info, 0, sizeof(priv-job.info)); priv-job.info.type = VIR_DOMAIN_JOB_UNBOUNDED; -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] security: selinux: Set saved state label only if it is available
Check that secdef-imagelabel exists before blindly applying it. --- src/security/security_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index c078cab..cf59d6c 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1962,7 +1962,7 @@ virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, virSecurityLabelDefPtr secdef; secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); -if (!secdef || !secdef-relabel) +if (!secdef || !secdef-imagelabel || !secdef-relabel) return 0; return virSecuritySELinuxSetFilecon(savefile, secdef-imagelabel); -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor
In qemuMigrationToFile we enter the monitor multiple times and don't check if the VM is still alive after returning form the monitor. Add the checks to skip pieces of code in case the VM crashes while saving it's state. --- src/qemu/qemu_migration.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 767d840..50a1eab 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4731,6 +4731,13 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainObjExitMonitor(driver, vm); } +if (!virDomainObjIsActive(vm)) { +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(guest unexpectedly quit)); +/* nothing to tear down */ +return -1; +} + if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) (!compressor || pipe(pipeFD) == 0)) { /* All right! We can use fd migration, which means that qemu @@ -4818,6 +4825,12 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, } qemuDomainObjExitMonitor(driver, vm); +if (!virDomainObjIsActive(vm)) { +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(guest unexpectedly quit)); +goto cleanup; +} + if (rc 0) goto cleanup; @@ -4827,7 +4840,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, if (rc == -2) { orig_err = virSaveLastError(); virCommandAbort(cmd); -if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { +if (virDomainObjIsActive(vm) +qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { qemuMonitorMigrateCancel(priv-mon); qemuDomainObjExitMonitor(driver, vm); } @@ -4845,7 +4859,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, orig_err = virSaveLastError(); /* Restore max migration bandwidth */ -if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { +if (virDomainObjIsActive(vm) +qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { qemuMonitorSetMigrationSpeed(priv-mon, saveMigBandwidth); priv-migMaxBandwidth = saveMigBandwidth; qemuDomainObjExitMonitor(driver, vm); -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] libvirtd: conf: Mention support for logging into journald
Our docs didn't mention the explicit option to log into journald. --- daemon/libvirtd.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf index e5856d4..c73423f 100644 --- a/daemon/libvirtd.conf +++ b/daemon/libvirtd.conf @@ -342,6 +342,8 @@ # use syslog for the output and use the given name as the ident #x:file:file_path # output to a file, with the given filepath +#x:journald +# output to journald logging system # In all case the x prefix is the minimal level, acting as a filter #1: DEBUG #2: INFO -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] daemon: Limit default log level to journald to VIR_LOG_INFO
Libvirt is really chatty when the DEBUG log level is enabled. When a host uses journald we'd enable debug logging to journald when only specifying the debug log level. As journald may employ rate throttling this would lock up the daemon until it's able to flush all debug messages. This patch changes the default log level to VIR_LOG_INFO when using the default (unconfigured) log output to journald. To still allow debug logging to journad the user now has to explicitly specify journald as a log output with priority 1 in the log_outputs configuration option. This patch also changes the config file template to be explicit about this change and notify the user about the possible consequence of debug logging into journald. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1121955 --- daemon/libvirtd.c| 10 +- daemon/libvirtd.conf | 4 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 946081a..2783c97 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -678,7 +678,15 @@ daemonSetupLogging(struct daemonConfig *config, (godaemon || !isatty(STDIN_FILENO))) { char *tmp; if (access(/run/systemd/journal/socket, W_OK) = 0) { -if (virAsprintf(tmp, %d:journald, virLogGetDefaultPriority()) 0) +virLogPriority priority = virLogGetDefaultPriority(); + +/* By default we don't want to log too much stuff into journald as + * it may employ rate limiting and thus blocking libvirt execution. + */ +if (priority == VIR_LOG_DEBUG) +priority = VIR_LOG_INFO; + +if (virAsprintf(tmp, %d:journald, priority) 0) goto error; virLogParseOutputs(tmp); VIR_FREE(tmp); diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf index c73423f..0560b69 100644 --- a/daemon/libvirtd.conf +++ b/daemon/libvirtd.conf @@ -309,6 +309,10 @@ # Logging level: 4 errors, 3 warnings, 2 information, 1 debug # basically 1 will log everything possible +# Note: Journald may employ rate limiting of the messages logged +# and thus lock up the libvirt daemon. To use the debug level with +# journald you have to specify it explicitly in 'log_outputs' otherwise +# only information level messages will be logged. #log_level = 3 # Logging filters: -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] journald logging rate limit fix
Peter Krempa (2): libvirtd: conf: Mention support for logging into journald daemon: Limit default log level to journald to VIR_LOG_INFO daemon/libvirtd.c| 10 +- daemon/libvirtd.conf | 6 ++ 2 files changed, 15 insertions(+), 1 deletion(-) -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/2] journald logging rate limit fix
On 08/12/2014 04:34 PM, Peter Krempa wrote: Peter Krempa (2): libvirtd: conf: Mention support for logging into journald daemon: Limit default log level to journald to VIR_LOG_INFO daemon/libvirtd.c| 10 +- daemon/libvirtd.conf | 6 ++ 2 files changed, 15 insertions(+), 1 deletion(-) ACK series. It would be nice to do the same for virtlockd. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3] numatune: Fix parsing of empty nodeset (0, ^0)
On 08/11/2014 04:06 PM, Erik Skultety wrote: Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1121837 --- src/util/virbitmap.c | 3 +++ ...emuxml2argv-numatune-memory-invalid-nodeset.xml | 31 ++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 35 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-memory-invalid-nodeset.xml ACK and pushed. Congratulations on your first libvirt patch! Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC][scale] new API for querying domains stats
- Original Message - From: Richard W.M. Jones rjo...@redhat.com To: Li Wei l...@cn.fujitsu.com Cc: Francesco Romani from...@redhat.com, libvir-list@redhat.com Sent: Tuesday, August 12, 2014 11:04:05 AM Subject: Re: [libvirt] [RFC][scale] new API for querying domains stats [...] Is it possible to design an API that can work across all domains in a single call? How about the following API: int virConnectGetAllBlockStats(virConnectPtr conn, virDomainPtr domain, virDomainBlockBulkStatsPtr *stats, unsigned int flags); @conn: pointer to libvirt connection @domain: pointer to the domain to be queried, NULL for all domains @stats: array of virDomainBlockBulkStats struct(see below) to be populated @flags: filter flags Return the number of virDomainBlockBulkStats populated. where virDomainBlockBulkStats defined as: struct _virDomainBlockBulkStats { virDomainPtr domain; /* domain the block stats belongs to */ virTypedParameterPtr params; /* params to store block stats */ unsigned int nparams;/* how many params used for each block stats */ unsigned int ndisks; /* how many block stats in this domain */ }; Works for me. Same here. oVirt, more specifically VDSM, needs to check all the stats of all the domains on a given host at once, so this API should fit the task. Since VDSM takes ownership (read: keep track and control) of all the VMs, the filtering capability of this new API should be good enough. +++ It would be nice, but less important, to be able to somehow reuse the `stats' argument. What I'm looking here is a way to avoid to allocate/deallocate every time all the needed structure before and after each call. I'm saying so because is a pretty common scenario for a VM (at least in the cases I'm aware of) to have the same number of disks during all its life. But I believe this is an optimization which can be added later. Thanks, -- Francesco Romani RedHat Engineering Virtualization R D Phone: 8261328 IRC: fromani -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor
On 08/12/2014 03:44 PM, Peter Krempa wrote: In qemuMigrationToFile we enter the monitor multiple times and don't check if the VM is still alive after returning form the monitor. Add the checks to skip pieces of code in case the VM crashes while saving it's state. --- src/qemu/qemu_migration.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) ACK Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] security: selinux: Set saved state label only if it is available
On 08/12/2014 03:44 PM, Peter Krempa wrote: Check that secdef-imagelabel exists before blindly applying it. --- src/security/security_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index c078cab..cf59d6c 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1962,7 +1962,7 @@ virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, virSecurityLabelDefPtr secdef; secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); -if (!secdef || !secdef-relabel) +if (!secdef || !secdef-imagelabel || !secdef-relabel) return 0; return virSecuritySELinuxSetFilecon(savefile, secdef-imagelabel); I think this is just covers up incorrect usage of this function on shutoff domains, because if a running domain has a selinux label, it should have the imagelabel generated. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] qemu: managedsave: Check that VM is alive after entering async job
On 08/12/2014 03:44 PM, Peter Krempa wrote: Saving a shutoff VM doesn't make sense (and has suboptimal effects on stability of the libvirt daemon). Check that the domain is alive after Saying it 'crashes' is more readable IMHO. entering the save async job. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1129207 --- src/qemu/qemu_driver.c | 6 ++ 1 file changed, 6 insertions(+) ACK signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/1] qemu: min_guarantee: Parameter 'min_guarantee' not supported
On 08/11/2014 12:07 PM, Erik Skultety wrote: The 'min_guarantee' is used by esx and vmx drivers, with qemu however, libvirt should report error when starting a domain, because this element is not used. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455 --- src/qemu/qemu_process.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 407da5e..22247fd 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3994,6 +3994,13 @@ int qemuProcessStart(virConnectPtr conn, flags VIR_QEMU_PROCESS_START_COLD) 0) goto cleanup; +if (vm-def-mem.min_guarantee) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Parameter 'min_guarantee' + not supported)); I'd say not supported by QEMU here. The message as you wrote it seems like it's not supported at all here. As Wang Rui pointed out, it would be nice to mention in docs/formatdomain.html.in that this is only supported by esx, openvz and and vmx drivers. Jan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: process: Fix header format of qemuProcessSetVcpuAffinities
Fix header alignment and remove the unused conn parameter. --- Notes: Pushed as trivial. src/qemu/qemu_process.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 407da5e..9e6a9ae 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2221,8 +2221,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm) /* Set CPU affinities for vcpus if vcpupin xml provided. */ static int -qemuProcessSetVcpuAffinities(virConnectPtr conn ATTRIBUTE_UNUSED, -virDomainObjPtr vm) +qemuProcessSetVcpuAffinities(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm-privateData; virDomainDefPtr def = vm-def; @@ -4243,7 +4242,7 @@ int qemuProcessStart(virConnectPtr conn, goto cleanup; VIR_DEBUG(Setting VCPU affinities); -if (qemuProcessSetVcpuAffinities(conn, vm) 0) +if (qemuProcessSetVcpuAffinities(vm) 0) goto cleanup; VIR_DEBUG(Setting affinity of emulator threads); -- 2.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/66] vbox: Rewrite vboxConnectGetCapabilities
On 11.08.2014 12:06, Taowei wrote: --- src/vbox/vbox_common.c| 11 +++ src/vbox/vbox_tmpl.c | 16 ++-- src/vbox/vbox_uniformed_api.h |1 + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index cb73f97..eaefe81 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -463,3 +463,14 @@ vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) VBOX_RELEASE(systemProperties); return ret; } + +char *vboxConnectGetCapabilities(virConnectPtr conn) +{ +VBOX_OBJECT_CHECK(conn, char *, NULL); + +vboxDriverLock(data); +ret = virCapabilitiesFormatXML(data-caps); +vboxDriverUnlock(data); + +return ret; +} diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index deb3067..7f9b4cc 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -256,6 +256,10 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml); static int vboxDomainCreate(virDomainPtr dom); static int vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags); +#if VBOX_API_VERSION 2002000 VBOX_API_VERSION 400 +/* Since vboxConnectGetCapabilities has been rewriten, + * vboxDiverLock and Unlock only be used in 3.* */ + s/rewriten/rewritten/ s/vboxDiverLock/vboxDriverLock/ we are not locking any diver but the driver :-P static void vboxDriverLock(vboxGlobalData *data) { virMutexLock(data-lock); @@ -266,6 +270,8 @@ static void vboxDriverUnlock(vboxGlobalData *data) virMutexUnlock(data-lock); } +#endif + #if VBOX_API_VERSION == 2002000 static void nsIDtoChar(unsigned char *uuid, const nsID *iid) @@ -914,16 +920,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16, return result; } -static char *vboxConnectGetCapabilities(virConnectPtr conn) { -VBOX_OBJECT_CHECK(conn, char *, NULL); - -vboxDriverLock(data); -ret = virCapabilitiesFormatXML(data-caps); -vboxDriverUnlock(data); - -return ret; -} - static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) { VBOX_OBJECT_CHECK(conn, int, -1); diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 2cc0674..e49b881 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -233,6 +233,7 @@ int vboxConnectIsSecure(virConnectPtr conn); int vboxConnectIsEncrypted(virConnectPtr conn); int vboxConnectIsAlive(virConnectPtr conn); int vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type); +char *vboxConnectGetCapabilities(virConnectPtr conn); /* Version specified functions for installing uniformed API */ void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 14/66] vbox: Rewrite vboxDomainLookupByUUID
On 11.08.2014 12:06, Taowei wrote: --- src/vbox/vbox_common.c| 73 + src/vbox/vbox_tmpl.c | 73 - src/vbox/vbox_uniformed_api.h |2 ++ 3 files changed, 75 insertions(+), 73 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index d901b7f..5d9a4f0 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -624,3 +624,76 @@ virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) gVBoxAPI.UArray.vboxArrayRelease(machines); return ret; } + +virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, +const unsigned char *uuid) +{ +VBOX_OBJECT_CHECK(conn, virDomainPtr, NULL); +vboxArray machines = VBOX_ARRAY_INITIALIZER; +vboxIIDUnion iid; +char *machineNameUtf8 = NULL; +PRUnichar *machineNameUtf16 = NULL; +unsigned char iid_as_uuid[VIR_UUID_BUFLEN]; +size_t i; +int matched = 0; When you're at this, s/int matched/bool matched/. It's used as a boolean anyway. Here and in the following patches too. +nsresult rc; + +VBOX_IID_INITIALIZE(iid); +rc = gVBoxAPI.UArray.vboxArrayGet(machines, data-vboxObj, ARRAY_GET_MACHINES); +if (NS_FAILED(rc)) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(Could not get list of machines, rc=%08x), (unsigned)rc); +return NULL; +} + +for (i = 0; i machines.count; ++i) { +IMachine *machine = machines.items[i]; +PRBool isAccessible = PR_FALSE; + +if (!machine) +continue; + +gVBoxAPI.UIMachine.GetAccessible(machine, isAccessible); +if (!isAccessible) +continue; + +rc = gVBoxAPI.UIMachine.GetId(machine, iid); +if (NS_FAILED(rc)) +continue; +vboxIIDToUUID(iid, iid_as_uuid); +vboxIIDUnalloc(iid); + +if (memcmp(uuid, iid_as_uuid, VIR_UUID_BUFLEN) == 0) { + +PRUint32 state; + +matched = 1; + +gVBoxAPI.UIMachine.GetName(machine, machineNameUtf16); +VBOX_UTF16_TO_UTF8(machineNameUtf16, machineNameUtf8); + +gVBoxAPI.UIMachine.GetState(machine, state); + +/* get a new domain pointer from virGetDomain, if it fails + * then no need to assign the id, else assign the id, cause + * it is -1 by default. rest is taken care by virGetDomain + * itself, so need not worry. + */ + +ret = virGetDomain(conn, machineNameUtf8, iid_as_uuid); +if (ret +gVBoxAPI.machineStateChecker.Online(state)) +ret-id = i + 1; + } + + if (matched == 1) + break; +} + +/* Do the cleanup and take care you dont leak any memory */ +VBOX_UTF8_FREE(machineNameUtf8); +VBOX_COM_UNALLOC_MEM(machineNameUtf16); +gVBoxAPI.UArray.vboxArrayRelease(machines); + +return ret; +} Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 45/66] vbox: Rewrite vboxDomainAttachDeviceFlags
On 11.08.2014 12:06, Taowei wrote: --- src/vbox/vbox_common.c| 14 ++ src/vbox/vbox_tmpl.c | 15 --- src/vbox/vbox_uniformed_api.h |2 ++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 84d82d7..f22cb5b 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -4155,3 +4155,17 @@ int vboxDomainAttachDevice(virDomainPtr dom, const char *xml) { return vboxDomainAttachDeviceImpl(dom, xml, 0); } + +int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, +unsigned int flags) +{ +virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); + +if (flags VIR_DOMAIN_AFFECT_CONFIG) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(cannot modify the persistent configuration of a domain)); +return -1; +} I know you're just copying pre-existing code, but this doesn't make much sense to me. I'd just drop VIR_DOMAIN_AFFECT_CONFIG flag from the virCheckFlags(). Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/66] vbox: Rewrite vbox domain driver
On 11.08.2014 12:06, Taowei wrote: This series of patches rewrite the vbox's domain driver. The driver is separated into two parts: the version specified and the common part. The common driver use vboxUniformedAPI to build a general driver for all vbox versions. The vboxUniformedAPI take the responsiblity to communicate with virtualbox. Since there are some incompatible changes in virtualbox, vboxUniformedAPI should be aware of these changes and provide a uniformed api for the upper layer. The significant result of this patch is that we replace all vir${vbox_version}Driver into one virCommonDriver. So, we will have only one vbox driver implementation for all vbox versions in libvirt. PS: I have send part of my patches before: https://www.redhat.com/archives/libvir-list/2014-July/msg00937.html But I have to resend it beacuse I did some improvement on previous patches: *Remove the test case for vboxUniformedAPI, because it would raise break strict-aliasing rules warning in some distibutions *Merged the flag fdWatchNeedInitialize into domainEventCallbacks, So, we use one flag to indicate whether vbox support callbacks as well as we need to initialize variables for it. Taowei (66): vbox: Begin to rewrite, vboxConnectOpen vbox: Rewrite vboxConnectClose vbox: Rewrite vboxDomainSave vbox: Rewrite vboxConnectGetVersion vbox: Rewrite vboxConnectGetHostname vbox: Rewrite vboxConnectIsSecure vbox: Rewrite vboxConnectIsEncrypted vbox: Rewrite vboxConnectIsAlive vbox: Rewrite vboxConnectGetMaxVcpus vbox: Rewrite vboxConnectGetCapabilities vbox: Rewrite vboxConnectListDomains vbox: Rewrite vboxConnectNumOfDomains vbox: Rewrite vboxDomainLookupById vbox: Rewrite vboxDomainLookupByUUID vbox: Rewrite vboxDomainUndefineFlags vbox: Rewrite vboxDomainDefineXML vbox: Rewrite vboxDomainCreateWithFlags vbox: Rewrite vboxDomainCreate vbox: Rewrite vboxDomainCreateXML vbox: Rewrite vboxDomainLookupByName vbox: Rewrite vboxDomainIsActive vbox: Rewrite vboxDomainIsPersistent vbox: Rewrite vboxDomainIsUpdated vbox: Rewrite vboxDomainSuspend vbox: Rewrite vboxDomainResume vbox: Rewrite vboxDomainShutdownFlags vbox: Rewrite vboxDomainShutdown vbox: Rewrite vboxDomainReboot vbox: Rewrite vboxDomainDestroyFlags vbox: Rewrite vboxDomainDestroy vbox: Rewrite vboxDomainGetOSType vbox: Rewrite vboxDomainSetMemory vbox: Rewrite vboxDomainGetInfo vbox: Rewrite vboxDomainGetState vbox: Rewrite vboxDomainSetVcpusFlags vbox: Rewrite vboxDomainSetVcpus vbox: Rewrite vboxDomainGetVcpusFlags vbox: Rewrite vboxDomainGetMaxVcpus vbox: Add API for vboxDomainGetXMLDesc vbox: Rewrite vboxDomainGetXMLDesc vbox: Rewrite vboxConnectListDefinedDomains vbox: Rewrite vboxConnectNumOfDefinedDomains vbox: Rewrite vboxDomainUndefine vbox: Rewrite vboxDomainAttachDevice vbox: Rewrite vboxDomainAttachDeviceFlags vbox: Rewrite vboxDomainUpdateDeviceFlags vbox: Rewrite vboxDomainDetachDevice vbox: Rewrite vboxDomainDetachDeviceFlags vbox: Add API for vboxDomainSnapshotCreateXML vbox: Rewrite vboxDomainSnapshotCreateXML vbox: Rewrite vboxDomainSnapshotGetXMLDesc vbox: Rewrite vboxDomainSnapshotNum vbox: Rewrite vboxDomainSnapshotListNames vbox: Rewrite vboxSnapshotLookupByName vbox: Rewrite vboxDomainHasCurrentSnapshot vbox: Rewrite vboxDomainSnapshotGetParent vbox: Rewrite vboxDomainSnapshotCurrent vbox: Rewrite vboxDomainSnapshotIsCurrent vbox: Rewrite vboxDomainSnapshotHasMetadata vbox: Rewrite vboxDomainRevertToSnapshot vbox: Rewrite vboxDomainSnapshotDelete vbox: Rewrite vboxDomainScreenshot vbox: Rewrite vboxConnectListAllDomains vbox: Rewrite vboxNode functions vbox: Add registerDomainEvent vbox: Introducing vboxCommonDriver po/POTFILES.in|1 + src/Makefile.am |5 +- src/vbox/README |7 +- src/vbox/vbox_common.c| 7550 + src/vbox/vbox_common.h| 306 + src/vbox/vbox_driver.c| 40 +- src/vbox/vbox_install_api.h | 26 + src/vbox/vbox_tmpl.c |14557 + src/vbox/vbox_uniformed_api.h | 551 ++ 9 files changed, 13186 insertions(+), 9857 deletions(-) create mode 100644 src/vbox/vbox_common.c create mode 100644 src/vbox/vbox_common.h create mode 100644 src/vbox/vbox_install_api.h create mode 100644 src/vbox/vbox_uniformed_api.h ACK to all the patches. I've fixed all the small nits I found. I'm keeping the patches on my private branch for some time to give others time to share their opinions. Nevertheless, incredible work in making the vbox driver look more sane what you've done! Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/3] security: selinux: Set saved state label only if it is available
On 08/12/14 17:17, Ján Tomko wrote: On 08/12/2014 03:44 PM, Peter Krempa wrote: Check that secdef-imagelabel exists before blindly applying it. --- src/security/security_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index c078cab..cf59d6c 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1962,7 +1962,7 @@ virSecuritySELinuxSetSavedStateLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, virSecurityLabelDefPtr secdef; secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); -if (!secdef || !secdef-relabel) +if (!secdef || !secdef-imagelabel || !secdef-relabel) return 0; return virSecuritySELinuxSetFilecon(savefile, secdef-imagelabel); I think this is just covers up incorrect usage of this function on shutoff domains, because if a running domain has a selinux label, it should have the imagelabel generated. Fair enough. I'll drop this one. signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor
On 08/12/14 17:17, Ján Tomko wrote: On 08/12/2014 03:44 PM, Peter Krempa wrote: In qemuMigrationToFile we enter the monitor multiple times and don't check if the VM is still alive after returning form the monitor. Add the checks to skip pieces of code in case the VM crashes while saving it's state. --- src/qemu/qemu_migration.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) ACK I've tweaked the commit message in 1/3 and pushed 1/3 and 3/3. Thanks. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] storage: ZFS support
Ján Tomko wrote: On 07/26/2014 06:13 PM, Roman Bogorodskiy wrote: Implement ZFS storage backend driver. Currently supported only on FreeBSD because of ZFS limitations on Linux. --- configure.ac | 43 + docs/schemas/storagepool.rng | 20 +++ docs/storage.html.in | 34 include/libvirt/libvirt.h.in | 1 + po/POTFILES.in| 1 + src/Makefile.am | 8 + src/conf/storage_conf.c | 15 +- src/conf/storage_conf.h | 4 +- src/qemu/qemu_conf.c | 1 + src/storage/storage_backend.c | 6 + src/storage/storage_backend_zfs.c | 329 ++ src/storage/storage_backend_zfs.h | 29 src/storage/storage_driver.c | 1 + tools/virsh-pool.c| 3 + 14 files changed, 492 insertions(+), 3 deletions(-) create mode 100644 src/storage/storage_backend_zfs.c create mode 100644 src/storage/storage_backend_zfs.h ACK Pushed, thanks! Roman Bogorodskiy pgpm4ZQRanFoc.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] bhyve: fix error message in bhyveStateInitialize
If we failed to create BHYVE_STATE_DIR, we should show this path, not BHYVE_LOG_DIR. --- src/bhyve/bhyve_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 135cb24..eb8f9af 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1191,7 +1191,7 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED, if (virFileMakePath(BHYVE_STATE_DIR) 0) { virReportSystemError(errno, _(Failed to mkdir %s), - BHYVE_LOG_DIR); + BHYVE_STATE_DIR); goto cleanup; } -- 1.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu_conf: Undefine the correct symbol
At the beginning of the qemu config file parsing function there are 3 helper macros defined: GET_VALUE_BOOL, GET_VALUE_LONG and GET_VALUE_STR. Later, when they are no longer needed they are undefined in order to keep the namespace clean. However, the GET_VALUE_STRING is undefined instead of GET_VALUE_STR. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- Pushed as trivial. src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b14b1bc..238d2b1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -662,7 +662,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, } #undef GET_VALUE_BOOL #undef GET_VALUE_LONG -#undef GET_VALUE_STRING +#undef GET_VALUE_STR virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver) { -- 1.8.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: fix error message in bhyveStateInitialize
Dmitry Guryanov wrote: If we failed to create BHYVE_STATE_DIR, we should show this path, not BHYVE_LOG_DIR. --- src/bhyve/bhyve_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 135cb24..eb8f9af 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1191,7 +1191,7 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED, if (virFileMakePath(BHYVE_STATE_DIR) 0) { virReportSystemError(errno, _(Failed to mkdir %s), - BHYVE_LOG_DIR); + BHYVE_STATE_DIR); goto cleanup; } ACK, will push today. Roman Bogorodskiy pgpImFQ2l_eTt.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH V5 01/12] src/xenxs: Export code for reuse
On 08/11/2014 11:20 PM, Jim Fehlig wrote: Kiarie Kahurani wrote: wrap code tagged for resuse into one function and export it Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com --- src/xenxs/xen_xm.c | 73 +++--- src/xenxs/xen_xm.h | 2 ++ This patch got me thinking about the 'xenxs' directory and its contents. IMO, the directory should be named 'xenconfig' since it contains parsing/formating functions for the various xen config formats. Its contents should be xen_sxpr.[ch] for sxpr format, xen_xm.[ch] for xm format, and xen_xl.[ch] for xl format. xen_common.[ch] would contain parsing/formating functions common to xm and xl. Any opinions on this layout? I can work on a patch if others think this is reasonable. Sounds fine to me. And 'git mv' makes it rather easy to do; just make sure you have 'git config diff.renames true' before sending the patch, so that the patch is compressed to just the tweaks accounting for the new names rather than wholesale delete/add actions. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] daemon: Limit default log level to journald to VIR_LOG_INFO
On 08/12/2014 08:34 AM, Peter Krempa wrote: Libvirt is really chatty when the DEBUG log level is enabled. When a host uses journald we'd enable debug logging to journald when only specifying the debug log level. As journald may employ rate throttling this would lock up the daemon until it's able to flush all debug messages. This patch changes the default log level to VIR_LOG_INFO when using the default (unconfigured) log output to journald. To still allow debug logging to journad the user now has to explicitly s/journad/journald/ +/* By default we don't want to log too much stuff into journald as + * it may employ rate limiting and thus blocking libvirt execution. s/blocking/block/ +++ b/daemon/libvirtd.conf @@ -309,6 +309,10 @@ # Logging level: 4 errors, 3 warnings, 2 information, 1 debug # basically 1 will log everything possible +# Note: Journald may employ rate limiting of the messages logged +# and thus lock up the libvirt daemon. To use the debug level with +# journald you have to specify it explicitly in 'log_outputs' otherwise s/ otherwise/, otherwise/ -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor
On 08/12/2014 07:44 AM, Peter Krempa wrote: s/exitting/exiting/ in the title In qemuMigrationToFile we enter the monitor multiple times and don't check if the VM is still alive after returning form the monitor. Add the checks to skip pieces of code in case the VM crashes while saving it's s/it's/its/ (it's is only correct if you can replace it with it is) state. Oh well, I see this was already pushed; so we'll live with the typos :) -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] maint: improve syntax check for space around =
On 08/11/2014 07:05 PM, Eric Blake wrote: Laine Stump noted on IRC that syntax check wasn't flagging his typo of 'i= 0'. This fixes it. Yes, it does. ACK and thanks! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] maint: improve syntax check for space around =
On 08/12/2014 10:54 AM, Laine Stump wrote: On 08/11/2014 07:05 PM, Eric Blake wrote: Laine Stump noted on IRC that syntax check wasn't flagging his typo of 'i= 0'. This fixes it. Yes, it does. ACK and thanks! Pushed. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] daemon: Limit default log level to journald to VIR_LOG_INFO
On Tue, Aug 12, 2014 at 04:34:37PM +0200, Peter Krempa wrote: Libvirt is really chatty when the DEBUG log level is enabled. When a host uses journald we'd enable debug logging to journald when only specifying the debug log level. As journald may employ rate throttling this would lock up the daemon until it's able to flush all debug messages. This patch changes the default log level to VIR_LOG_INFO when using the default (unconfigured) log output to journald. To still allow debug logging to journad the user now has to explicitly specify journald as a log output with priority 1 in the log_outputs configuration option. This patch also changes the config file template to be explicit about this change and notify the user about the possible consequence of debug logging into journald. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1121955 --- daemon/libvirtd.c| 10 +- daemon/libvirtd.conf | 4 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 946081a..2783c97 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -678,7 +678,15 @@ daemonSetupLogging(struct daemonConfig *config, (godaemon || !isatty(STDIN_FILENO))) { char *tmp; if (access(/run/systemd/journal/socket, W_OK) = 0) { -if (virAsprintf(tmp, %d:journald, virLogGetDefaultPriority()) 0) +virLogPriority priority = virLogGetDefaultPriority(); + +/* By default we don't want to log too much stuff into journald as + * it may employ rate limiting and thus blocking libvirt execution. + */ +if (priority == VIR_LOG_DEBUG) +priority = VIR_LOG_INFO; + +if (virAsprintf(tmp, %d:journald, priority) 0) goto error; virLogParseOutputs(tmp); VIR_FREE(tmp); ACK, matches what I suggested we do previously. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/2] LXC: add support for persistent config in lxcDomainSetMemoryFlags
On 07/30/2014 11:41 PM, Chen Hanxiao wrote: Currently, setmaxmem return success on an active domain, but nothing happened. Not quite true... Prior to these changes... # virsh -c lxc:/// start vm1 # virsh -c lxc:/// dominfo vm1 | grep memory Max memory: 50 KiB Used memory:776 KiB # virsh -c lxc:/// dumpxml vm1 | grep mem memory unit='KiB'50/memory # cat /sys/fs/cgroup/memory/machine.slice/*/memory.limit_in_bytes 51200 # virsh -c lxc:/// setmaxmem vm1 525000 # virsh -c lxc:/// dominfo vm1 | grep memory Max memory: 525000 KiB Used memory:776 KiB # virsh -c lxc:/// dumpxml vm1 | grep mem memory unit='KiB'525000/memory # cat /sys/fs/cgroup/memory/machine.slice/*/memory.limit_in_bytes 51200 # virsh -c lxc:/// console vm1 Connected to domain vm1 Escape character is ^] sh-4.2# grep Mem /proc/meminfo MemTotal: 50 kB MemFree: 499076 kB MemAvailable:3629632 kB # Now I'll agree that technically what one expected to happen didn't since it's not supported, but something did happen :-)... And of course after a destroy the maxmem went back to 50. This patch will disable this behaviour, also add support persistent config. And it will be used in a later patch. FWIW: I agree with Peter's observation from your v1 - the two patches should be one as it is clearer that way what you are doing and leaves no doubt why the flag is used I do see that other drivers like qemu libxl use the MEM_MAXIMUM flag. So perhaps said differently - This patch changes the LXC driver setmaxmem function to support the '--live', '--config', and '--current' flags by revectoring the code through the setmem function using the VIR_DOMAIN_MEM_MAXIMUM flag. The setmem code is refactored to handle both cases depending on the flag. The changed maxmem code for the MEM_MAXIMUM path will not allow modification to the memory values of an active guest unless the --config switch is used. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- v2: disable changing max memory on an active domain drop useless as_assert src/lxc/lxc_driver.c | 64 +--- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 9e12ecc..d99ab3b 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -721,10 +721,10 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, virLXCDomainObjPrivatePtr priv; virLXCDriverPtr driver = dom-conn-privateData; virLXCDriverConfigPtr cfg = NULL; -unsigned long oldmax = 0; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_AFFECT_CONFIG, -1); + VIR_DOMAIN_AFFECT_CONFIG | + VIR_DOMAIN_MEM_MAXIMUM, -1); if (!(vm = lxcDomObjFromDomain(dom))) goto cleanup; @@ -743,32 +743,50 @@ static int lxcDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, persistentDef) 0) goto cleanup; I see the next set of changes is essentially cut-n-pasted from qemu, although the changes after the else are the same as the former setmem function - it's just the git diff that obfuscates that. The changes do work as I'd expect, so ACK from that point of view. I can merge the two patches for you and commit, but I'll give it a bit to make sure no one else has concerns John -if (flags VIR_DOMAIN_AFFECT_LIVE) -oldmax = vm-def-mem.max_balloon; -if (flags VIR_DOMAIN_AFFECT_CONFIG) { -if (!oldmax || oldmax persistentDef-mem.max_balloon) -oldmax = persistentDef-mem.max_balloon; -} +if (flags VIR_DOMAIN_MEM_MAXIMUM) { +if (flags VIR_DOMAIN_AFFECT_LIVE) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(Cannot resize the max memory + on an active domain)); +goto cleanup; +} -if (newmem oldmax) { -virReportError(VIR_ERR_INVALID_ARG, - %s, _(Cannot set memory higher than max memory)); -goto cleanup; -} +if (flags VIR_DOMAIN_AFFECT_CONFIG) { +persistentDef-mem.max_balloon = newmem; +if (persistentDef-mem.cur_balloon newmem) +persistentDef-mem.cur_balloon = newmem; +if (virDomainSaveConfig(cfg-configDir, persistentDef) 0) +goto cleanup; +} +} else { +unsigned long oldmax = 0; -if (flags VIR_DOMAIN_AFFECT_LIVE) { -if (virCgroupSetMemory(priv-cgroup, newmem) 0) { -virReportError(VIR_ERR_OPERATION_FAILED, - %s, _(Failed to set memory for domain)); -goto cleanup; +if (flags VIR_DOMAIN_AFFECT_LIVE) +oldmax = vm-def-mem.max_balloon; +if (flags
[libvirt] Pass additional environmental variables
We're using sasl+gssapi+kerberos to do authentication for libvirt, including from hypervisor to hypervisor. However, the environmental variable filtering implemented in libvirt prevents this from working, so we're forced to run a locally patched version. Thoughts on the following patch to pass the location of the local credential cache as well? --- a/src/util/vircommand.c2014-01-07 14:14:11.388934108 + +++ b/src/util/vircommand.c2014-01-07 14:18:14.725082505 + @@ -1314,6 +1314,7 @@ virCommandAddEnvPair(cmd, LC_ALL, C); +virCommandAddEnvPassBlockSUID(cmd, KRB5CCNAME, NULL); virCommandAddEnvPassBlockSUID(cmd, LD_PRELOAD, NULL); virCommandAddEnvPassBlockSUID(cmd, LD_LIBRARY_PATH, NULL); virCommandAddEnvPassBlockSUID(cmd, PATH, /bin:/usr/bin); -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Initializing qemu driver
Hi there, I get this errors trying to intialialize libvirtd $libvirtd -vvv 2014-08-12 21:57:47.887+: 6449: info : libvirt version: 1.2.8 2014-08-12 21:57:47.887+: 6449: warning : virGetHostname:665 : getaddrinfo failed for 'linux-xzc4': Name or service not known 2014-08-12 21:57:48.034+: 6461: info : libvirt version: 1.2.8 2014-08-12 21:57:48.034+: 6461: error : virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo 2014-08-12 21:57:48.034+: 6461: error : virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo 2014-08-12 21:57:48.034+: 6461: error : daemonRunStateInit:922 : Driver state initialization failed Is someone else experiencing the same thing? -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Initializing qemu driver
Ooh got something on the list, I build without qemu as I only care about Xen. On Wed, Aug 13, 2014 at 1:00 AM, David kiarie davidkiar...@gmail.com wrote: Hi there, I get this errors trying to intialialize libvirtd $libvirtd -vvv 2014-08-12 21:57:47.887+: 6449: info : libvirt version: 1.2.8 2014-08-12 21:57:47.887+: 6449: warning : virGetHostname:665 : getaddrinfo failed for 'linux-xzc4': Name or service not known 2014-08-12 21:57:48.034+: 6461: info : libvirt version: 1.2.8 2014-08-12 21:57:48.034+: 6461: error : virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo 2014-08-12 21:57:48.034+: 6461: error : virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo 2014-08-12 21:57:48.034+: 6461: error : daemonRunStateInit:922 : Driver state initialization failed Is someone else experiencing the same thing? -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Fwd: [PATCH] selinux: Avoid label reservations for type = none during restart
Hi, Could someone please help me with review for this patch? Thanks and Regards, Shiva -- Forwarded message -- From: Shivaprasad G Bhat shivaprasadb...@gmail.com Date: Tue, Jun 10, 2014 at 5:12 PM Subject: [libvirt] [PATCH] selinux: Avoid label reservations for type = none during restart To: libvir-list@redhat.com The problem is libvirt kills the guests during libvirt restart if more than guest has security type as none. This is because, libvirt as part of guest- reconnect tries to reserve the security labels. In case of type=none, the range of security context happen to be same for several guests. During reservation, the second attempt to reserve the same range fails and the Guests would be killed. The fix is to avoid reserving labels for type = none during libvirt restart. Signed-off-by: Shivaprasad G Bhat sb...@linux.vnet.ibm.com --- src/security/security_selinux.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 008c58c..2f8a7f2 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -739,7 +739,8 @@ virSecuritySELinuxReserveSecurityLabel(virSecurityManagerPtr mgr, virSecurityLabelDefPtr seclabel; seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); -if (!seclabel || seclabel-type == VIR_DOMAIN_SECLABEL_STATIC) +if (!seclabel || seclabel-type == VIR_DOMAIN_SECLABEL_STATIC || +seclabel-type == VIR_DOMAIN_SECLABEL_NONE) return 0; if (getpidcon_raw(pid, pctx) == -1) { -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list