[libvirt] [PATCH] maint: document use of zanata for translations
by Eric Blake
Based on recent list questions on how to contribute a translation fix.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Should be safe for freeze, but as I have never contributed a
translation fix, I'll wait for review.
HACKING | 19 ++++++++++++-------
docs/hacking.html.in | 7 +++++++
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/HACKING b/HACKING
index fbe838b..e308568 100644
--- a/HACKING
+++ b/HACKING
@@ -18,7 +18,12 @@ listen to feedback.
and is browsable along with other libvirt-related repositories (e.g.
libvirt-python) online <http://libvirt.org/git/>.
-(3) Post patches in unified diff format, with git rename detection enabled. You
+(3) Patches to translations are maintained via the zanata project
+<https://fedora.zanata.org/>. If you want to fix a translation in a .po file,
+join the appropriate language team. The libvirt release process automatically
+pulls the latest version of each translation file from zanata.
+
+(4) Post patches in unified diff format, with git rename detection enabled. You
need a one-time setup of:
git config diff.renames true
@@ -70,7 +75,7 @@ the correct version if needed though).
-(4) In your commit message, make the summary line reasonably short (60 characters
+(5) In your commit message, make the summary line reasonably short (60 characters
is typical), followed by a blank line, followed by any longer description of
why your patch makes sense. If the patch fixes a regression, and you know what
commit introduced the problem, mentioning that is useful. If the patch
@@ -82,7 +87,7 @@ is up to you if you want to include or omit them in the commit message.
-(5) Split large changes into a series of smaller patches, self-contained if
+(6) Split large changes into a series of smaller patches, self-contained if
possible, with an explanation of each patch and an explanation of how the
sequence of patches fits together. Moreover, please keep in mind that it's
required to be able to compile cleanly (*including* "make check" and "make
@@ -93,10 +98,10 @@ things).
-(6) Make sure your patches apply against libvirt GIT. Developers only follow GIT
+(7) Make sure your patches apply against libvirt GIT. Developers only follow GIT
and don't care much about released versions.
-(7) Run the automated tests on your code before submitting any changes. In
+(8) Run the automated tests on your code before submitting any changes. In
particular, configure with compile warnings set to -Werror. This is done
automatically for a git checkout; from a tarball, use:
@@ -149,7 +154,7 @@ various tests under gdb or Valgrind.
-(8) The Valgrind test should produce similar output to "make check". If the output
+(9) The Valgrind test should produce similar output to "make check". If the output
has traces within libvirt API's, then investigation is required in order to
determine the cause of the issue. Output such as the following indicates some
sort of leak:
@@ -225,7 +230,7 @@ to "tests/.valgrind.supp" in order to suppress the warning:
-(9) Update tests and/or documentation, particularly if you are adding a new
+(10) Update tests and/or documentation, particularly if you are adding a new
feature or changing the output of a program.
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 408ea50..5cd23a2 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -16,6 +16,13 @@
along with other libvirt-related repositories
(e.g. libvirt-python) <a href="http://libvirt.org/git/">online</a>.</li>
+ <li>Patches to translations are maintained via
+ the <a href="https://fedora.zanata.org/">zanata project</a>.
+ If you want to fix a translation in a .po file, join the
+ appropriate language team. The libvirt release process
+ automatically pulls the latest version of each translation
+ file from zanata.</li>
+
<li><p>Post patches in unified diff format, with git rename
detection enabled. You need a one-time setup of:</p>
<pre>
--
2.1.0
9 years, 5 months
[libvirt] [PATCH v1] update snapshot api
by Vasiliy Tolstov
* add constants from libvirt to snapshots api
* add flags to snapshot functions
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/libvirt-php.c | 87 ++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 61 insertions(+), 26 deletions(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index 0adc4be..e9b9657 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1228,34 +1228,58 @@ PHP_MINIT_FUNCTION(libvirt)
REGISTER_LONG_CONSTANT("VIR_DOMAIN_CRASHED", 6, CONST_CS | CONST_PERSISTENT);
/* Volume constants */
- REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_ALLOCATE", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_DELTA", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_SHRINK", 4, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_ALLOCATE", 1, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_DELTA", 2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_STORAGE_VOL_RESIZE_SHRINK", 4, CONST_CS | CONST_PERSISTENT);
/* Domain vCPU flags */
REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_CONFIG", VIR_DOMAIN_VCPU_CONFIG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_CURRENT", VIR_DOMAIN_VCPU_CURRENT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_LIVE", VIR_DOMAIN_VCPU_LIVE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_MAXIMUM", VIR_DOMAIN_VCPU_MAXIMUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_GUEST", VIR_DOMAIN_VCPU_GUEST, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_DOMAIN_VCPU_GUEST", VIR_DOMAIN_VCPU_GUEST, CONST_CS | CONST_PERSISTENT);
#if LIBVIR_VERSION_NUMBER>=8000
/* Domain snapshot constants */
REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_CHILDREN", VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_METADATA_ONLY", VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_DELETE_CHILDREN_ONLY", VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_REDEFINE", VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_CURRENT", VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_NO_METADATA", VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_HALT", VIR_DOMAIN_SNAPSHOT_CREATE_HALT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_DISK_ONLY", VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_REUSE_EXT", VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_QUIESCE", VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_ATOMIC", VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_CREATE_LIVE", VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_DESCENDANTS", VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_ROOTS", VIR_DOMAIN_SNAPSHOT_LIST_ROOTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_METADATA", VIR_DOMAIN_SNAPSHOT_LIST_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_LEAVES", VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_NO_LEAVES", VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_NO_METADATA", VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_INACTIVE", VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_ACTIVE", VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_DISK_ONLY", VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_INTERNAL", VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_LIST_EXTERNAL", VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_RUNNING", VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_PAUSED", VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_SNAPSHOT_REVERT_FORCE", VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, CONST_CS | CONST_PERSISTENT);
#endif
/* Memory constants */
REGISTER_LONG_CONSTANT("VIR_MEMORY_VIRTUAL", 1, CONST_CS | CONST_PERSISTENT);
/* Version checking constants */
- REGISTER_LONG_CONSTANT("VIR_VERSION_BINDING", VIR_VERSION_BINDING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_VERSION_LIBVIRT", VIR_VERSION_LIBVIRT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_VERSION_BINDING", VIR_VERSION_BINDING, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_VERSION_LIBVIRT", VIR_VERSION_LIBVIRT, CONST_CS | CONST_PERSISTENT);
/* Network constants */
REGISTER_LONG_CONSTANT("VIR_NETWORKS_ACTIVE", VIR_NETWORKS_ACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_NETWORKS_INACTIVE", VIR_NETWORKS_INACTIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VIR_NETWORKS_ALL", VIR_NETWORKS_ACTIVE |
- VIR_NETWORKS_INACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_NETWORKS_INACTIVE", VIR_NETWORKS_INACTIVE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("VIR_NETWORKS_ALL", VIR_NETWORKS_ACTIVE | VIR_NETWORKS_INACTIVE, CONST_CS | CONST_PERSISTENT);
/* Credential constants */
REGISTER_LONG_CONSTANT("VIR_CRED_USERNAME", 1, CONST_CS | CONST_PERSISTENT);
@@ -6394,17 +6418,19 @@ PHP_FUNCTION(libvirt_domain_get_job_info)
Since version: 0.4.1(-2)
Description: Function is used to get the information whether domain has the current snapshot
Arguments: @res [resource]: libvirt domain resource
+ @flags [int]
Returns: TRUE is domain has the current snapshot, otherwise FALSE (you may need to check for error using libvirt_get_last_error())
*/
PHP_FUNCTION(libvirt_domain_has_current_snapshot)
{
php_libvirt_domain *domain=NULL;
zval *zdomain;
+ long flags = 0;
int retval;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- retval=virDomainHasCurrentSnapshot(domain->domain, 0);
+ retval=virDomainHasCurrentSnapshot(domain->domain, flags);
if (retval <= 0) RETURN_FALSE;
RETURN_TRUE;
}
@@ -6415,6 +6441,7 @@ PHP_FUNCTION(libvirt_domain_has_current_snapshot)
Description: This functions is used to lookup for the snapshot by it's name
Arguments: @res [resource]: libvirt domain resource
@name [string]: name of the snapshot to get the resource
+ @flags [int]
Returns: domain snapshot resource
*/
PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
@@ -6423,13 +6450,14 @@ PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
zval *zdomain;
int name_len;
char *name=NULL;
+ long flags = 0;
php_libvirt_snapshot *res_snapshot;
virDomainSnapshotPtr snapshot = NULL;
- GET_DOMAIN_FROM_ARGS("rs",&zdomain,&name,&name_len);
+ GET_DOMAIN_FROM_ARGS("rs|l",&zdomain,&name,&name_len, &flags);
if ( (name == NULL) || (name_len<1)) RETURN_FALSE;
- snapshot=virDomainSnapshotLookupByName(domain->domain, name, 0);
+ snapshot=virDomainSnapshotLookupByName(domain->domain, name, flags);
if (snapshot==NULL) RETURN_FALSE;
res_snapshot = (php_libvirt_snapshot *)emalloc(sizeof(php_libvirt_snapshot));
@@ -6446,6 +6474,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name)
Since version: 0.4.1(-2)
Description: This function creates the domain snapshot for the domain identified by it's resource
Arguments: @res [resource]: libvirt domain resource
+ @flags [int]
Returns: domain snapshot resource
*/
PHP_FUNCTION(libvirt_domain_snapshot_create)
@@ -6453,11 +6482,12 @@ PHP_FUNCTION(libvirt_domain_snapshot_create)
php_libvirt_domain *domain=NULL;
php_libvirt_snapshot *res_snapshot;
zval *zdomain;
+ long flags = 0;
virDomainSnapshotPtr snapshot = NULL;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- snapshot=virDomainSnapshotCreateXML(domain->domain, "<domainsnapshot/>", 0);
+ snapshot=virDomainSnapshotCreateXML(domain->domain, "<domainsnapshot/>", flags);
DPRINTF("%s: virDomainSnapshotCreateXML(%p, <xml>) returned %p\n", PHPFUNC, domain->domain, snapshot);
if (snapshot == NULL) RETURN_FALSE;
@@ -6475,6 +6505,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_create)
Since version: 0.4.1(-2)
Description: Function is used to get the XML description of the snapshot identified by it's resource
Arguments: @res [resource]: libvirt snapshot resource
+ @flags [int]
Returns: XML description string for the snapshot
*/
PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
@@ -6482,11 +6513,12 @@ PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
char *xml;
char *xml_out;
zval *zsnapshot;
+ long flags = 0;
php_libvirt_snapshot *snapshot;
- GET_SNAPSHOT_FROM_ARGS("r",&zsnapshot);
+ GET_SNAPSHOT_FROM_ARGS("r|l",&zsnapshot, &flags);
- xml = virDomainSnapshotGetXMLDesc(snapshot->snapshot, 0);
+ xml = virDomainSnapshotGetXMLDesc(snapshot->snapshot, flags);
if (xml==NULL) RETURN_FALSE;
RECREATE_STRING_WITH_E(xml_out,xml);
@@ -6499,19 +6531,21 @@ PHP_FUNCTION(libvirt_domain_snapshot_get_xml)
Since version: 0.4.1(-2)
Description: Function is used to revert the domain state to the state identified by the snapshot
Arguments: @res [resource]: libvirt snapshot resource
+ @flags [int]
Returns: TRUE on success, FALSE on error
*/
PHP_FUNCTION(libvirt_domain_snapshot_revert)
{
zval *zsnapshot;
php_libvirt_snapshot *snapshot;
- int ret;
+ long flags = 0;
+ int retval;
- GET_SNAPSHOT_FROM_ARGS("r",&zsnapshot);
+ GET_SNAPSHOT_FROM_ARGS("r|l",&zsnapshot, &flags);
- ret = virDomainRevertToSnapshot(snapshot->snapshot, 0);
- DPRINTF("%s: virDomainRevertToSnapshot(%p, 0) returned %d\n", PHPFUNC, snapshot->snapshot, ret);
- if (ret == -1) RETURN_FALSE;
+ retval = virDomainRevertToSnapshot(snapshot->snapshot, flags);
+ DPRINTF("%s: virDomainRevertToSnapshot(%p, 0) returned %d\n", PHPFUNC, snapshot->snapshot, retval);
+ if (retval == -1) RETURN_FALSE;
RETURN_TRUE;
}
@@ -6543,6 +6577,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_delete)
Since version: 0.4.1(-2)
Description: Function is used to list domain snapshots for the domain specified by it's resource
Arguments: @res [resource]: libvirt domain resource
+ @flags [int]
Returns: libvirt domain snapshot names array
*/
PHP_FUNCTION(libvirt_list_domain_snapshots)
@@ -6551,17 +6586,18 @@ PHP_FUNCTION(libvirt_list_domain_snapshots)
zval *zdomain;
int count=-1;
int expectedcount=-1;
+ long flags = 0;
char **names;
int i;
- GET_DOMAIN_FROM_ARGS("r",&zdomain);
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &flags);
- expectedcount=virDomainSnapshotNum(domain->domain, 0);
+ expectedcount=virDomainSnapshotNum(domain->domain, flags);
DPRINTF("%s: virDomainSnapshotNum(%p, 0) returned %d\n", PHPFUNC, domain->domain, expectedcount);
if (expectedcount != -1 ) {
names=(char **)emalloc( expectedcount * sizeof(char *) );
- count=virDomainSnapshotListNames(domain->domain, names, expectedcount, 0);
+ count=virDomainSnapshotListNames(domain->domain, names, expectedcount, flags);
}
if ((count != expectedcount) || (count<0)) {
@@ -8863,4 +8899,3 @@ PHP_FUNCTION(libvirt_logfile_set)
RETURN_TRUE;
}
#endif
-
--
2.3.3
9 years, 5 months
Re: [libvirt] [libvirt-php] [PATCH v1] update snapshot api
by Vasiliy Tolstov
2015-05-07 17:21 GMT+03:00 Vasiliy Tolstov <v.tolstov(a)selfip.ru>:
> * add constants from libvirt to snapshots api
> * add flags to snapshot functions
This is for php libvirt binding
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
jabber: vase(a)selfip.ru
9 years, 5 months
[libvirt] [PATCH 0/3] qemu: Allow arm 32-on-64 KVM
by Cole Robinson
qemu 2.3.0 added support for enabling armv7l VMs to run on aarch64 hosts
with KVM. First patch handles the special command line bit, last two
patches are about advertising things in virsh capabilities.
After these patches, 'virt-install --arch armv7l ...' on an aarch64
host with new enough qemu will automatically use KVM and generate a
working config.
Cole Robinson (3):
qemu: command: Support arm 32-on-64 KVM with -cpu aarch64=off
qemu: caps: qemu-system-aarch64 supports armv7l
qemu: caps: Advertise arm 32-on-64 KVM option
src/qemu/qemu_capabilities.c | 57 ++++++++++++++--------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 13 +++++
.../qemuxml2argv-aarch64-kvm-32-on-64.args | 10 ++++
.../qemuxml2argv-aarch64-kvm-32-on-64.xml | 35 +++++++++++++
tests/qemuxml2argvtest.c | 9 ++++
6 files changed, 105 insertions(+), 20 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-kvm-32-on-64.xml
--
2.4.1
9 years, 5 months
[libvirt] the error is bug?
by cloudbuglist
Hi dear!
Today I came across a problem, the following is a log and software versions.
soft version:
os:centos 6.5
libvirt:0.10.29
qemu:0.12.415
2015-05-28 03:28:58.001+0000: 20919: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:30:37.000+0000: 20918: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:30:37.000+0000: 20918: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:31:01.000+0000: 20919: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:31:01.000+0000: 20919: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:32:40.000+0000: 20921: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:32:40.000+0000: 20921: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:33:06.000+0000: 20918: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:33:06.000+0000: 20918: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:33:42.009+0000: 20916: error : virNetSocketReadWire:1194 : End of file while reading data: Input/output error
2015-05-28 03:34:02.000+0000: 20921: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:34:02.000+0000: 20921: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:34:19.001+0000: 20920: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:34:19.001+0000: 20920: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:34:43.384+0000: 20916: error : virNetSocketReadWire:1194 : End of file while reading data: Input/output error
2015-05-28 03:34:47.000+0000: 20918: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:34:47.000+0000: 20918: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:34:52.000+0000: 20920: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:34:52.000+0000: 20920: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
2015-05-28 03:35:09.001+0000: 20921: warning : qemuDomainObjBeginJobInternal:839 : Cannot start job (query, none) for domain i-2-437-VM; current job is (query, none) owned by (20917, 0)
2015-05-28 03:35:09.001+0000: 20921: error : qemuDomainObjBeginJobInternal:843 : Timed out during operation: cannot acquire state change lock
9 years, 5 months
[libvirt] [PATCH v5 0/9] qemu: Add quorum support to libvirt
by Matthias Gatto
The purpose of these patches is to introduce quorum for libvirt
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
This feature ask for 6 task:
1) Allow a _virStorageSource to contain more than one backing store.
Because all the actual libvirt code use the backingStore field
as a pointer and we needs want to change that, I've decide to encapsulate
the backingStore field to simplifie the array manipulation.
2) Add the missing field a quorum need in _virStorageSource and
the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
their respectives enums.
3) Parse and format the xml
Because a quorum allows to have more than one backing store at the same level
we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
in a loop.
virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
call themself recursively in a loop because a quorum can contain another
quorum
4) Add nodename
We need to add nodename support in _virStorageSource because qemu
use them for their child.
5) Build qemu string
As for the xml, we have to call the function which create quorum recursively.
But this task have the problem explained here:
http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
The _virStorageSource missing some informations that can be passed to
a child, and therefore this version of quorum is incomplet.
6) Allow to hotplug/change a disk in a quorum
This part is not present in these patches because for this task
we have to use blockdev-add, and currently libvirt use
device_add for hotpluging that doesn't allow to hotplug quorum childs.
There is 3 way to handle this problem:
1) create a virDomainBlockDevAdd function in libvirt witch call
blockdev-add.
2) use blockdev-add instead of device_add in qemuMonitorJSONAddDevice
3) write a hack which uses blockdev-add when only attaching quorum
(but i'm pretty sure this solution is not the good one)
V2:
-Rebase on master
-Add Documentation
V3:
-Transforme the backingStore field in virStorageSource into
an array of pointer instead of a pointer
-Modify virStorageSourceSetBackingStore to allow it to expand
the backingStore size.
V4:
-Rebase on master
V5:
-Rebase on master
-patch 1-4/9: use patchs from John Ferlan
-patch 4/9: check return of virStorageSourceSetBackingStore
-patch 5/9: report type of error on virStorageSourceSetBackingStore
Matthias Gatto (9):
virstoragefile: Add virStorageSourceGetBackingStore
virstoragefile: Always use virStorageSourceGetBackingStore to get
backing store
virstoragefile: Add virStorageSourceSetBackingStore
virstoragefile: Always use virStorageSourceSetBackingStore to set
backing store
virstoragefile: change backingStore to backingStores.
virstoragefile: Add quorum in virstoragefile
domain_conf: Read and Write quorum config
qemu: Add quorum support in qemuBuildDriveDevStr
virstoragefile: Add node-name
docs/formatdomain.html.in | 30 +++++-
docs/schemas/domaincommon.rng | 26 ++++-
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 195 ++++++++++++++++++++++++++--------
src/conf/storage_conf.c | 23 ++--
src/libvirt_private.syms | 2 +
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 114 ++++++++++++++++++++
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 39 ++++---
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_monitor_json.c | 4 +-
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.c | 22 ++--
src/storage/storage_backend_fs.c | 38 ++++---
src/storage/storage_backend_gluster.c | 11 +-
src/storage/storage_backend_logical.c | 15 ++-
src/storage/storage_driver.c | 3 +-
src/util/virstoragefile.c | 122 ++++++++++++++++++---
src/util/virstoragefile.h | 13 ++-
tests/virstoragetest.c | 18 ++--
24 files changed, 551 insertions(+), 141 deletions(-)
--
2.3.5
9 years, 5 months
[libvirt] [PATCH 00/35] vCPU pinning and related refactors - Part 1
by Peter Krempa
These are preliminary refactors that will simplify the code base. The ultimate
goal of this refactoring is to aggregate all vCPU information
(pinning, scheduler,...) into a separate structure rather than storing them in
multiple places. This will then in turn help in making a saner implementation
of the still-planned specific vCPU API.
Peter Krempa (35):
qemu: Fix possible crash in qemuProcessSetVcpuAffinities
conf: Refactor emulatorpin handling
conf: Move pinning information definition closer to the usage place
util: bitmap: Add virBitmapToDataBuf that does not allocate the buffer
qemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo
qemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo
qemu: Refactor qemuDomainHelperGetVcpus by reusing virBitmapToDataBuf
libxl: Reuse virBitmapToData in libxlDomainSetVcpuAffinities
libxl: Unbreak vcpu pinning
libxl: Refactor libxlDomainGetVcpuPinInfo
util: Add macro to overflow check integer assignments
monitor: Move documentation for qemuMonitorGetBalloonInfo
qemu: monitor: Make qemuMonitorSetBalloon operate on unsinged long
long
qemu: process: Refactor setup of memory ballooning
qemu: process: Update current balloon state to maximum on vm startup
qemu: Add helper to update domain balloon size and refactor usage
places
qemu: Refactor qemuDomainGetInfo
conf: Store cpu count as unsigned int
lib: virDomainPinIOThread: Remove spurious overflow check
qemu: libxl: vcpupin: Don't reset pinning when pinning to all pcpus
Revert "cputune: Support cputune for xend driver"
libxl: Don't remove vcpu pin definition in libxlDomainCleanup
conf: Add new helpers to resolve virDomainModificationImpact to domain
defs
qemu: Refactor qemuDomainSetMemoryFlags by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainSetMemoryStatsPeriod by reusing
virDomainObjGetDefs
qemu: Refactor qemuDomainGetVcpusFlags by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainGetIOThreadInfo by reusing
virDomainObjGetDefs
qemu: Refactor qemuDomainPinIOThread by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainChgIOThread by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainSetBlkioParameters by reusing
virDomainObjGetDefs
qemu: Refactor qemuDomainPinVcpuFlags by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainPinEmulator by reusing virDomainObjGetDefs
qemu: Refactor qemuDomainGetEmulatorPinInfo by reusing
virDomainObjGetDefs
qemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs
src/conf/domain_conf.c | 229 ++++++++---------
src/conf/domain_conf.h | 78 +++---
src/libvirt-domain.c | 19 --
src/libvirt_private.syms | 5 +-
src/libxl/libxl_domain.c | 44 +---
src/libxl/libxl_driver.c | 57 ++---
src/qemu/qemu_cgroup.c | 2 +-
src/qemu/qemu_domain.c | 64 +++++
src/qemu/qemu_domain.h | 3 +
src/qemu/qemu_driver.c | 593 ++++++++++++-------------------------------
src/qemu/qemu_monitor.c | 12 +-
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 21 +-
src/qemu/qemu_monitor_json.h | 2 +-
src/qemu/qemu_monitor_text.c | 21 +-
src/qemu/qemu_monitor_text.h | 2 +-
src/qemu/qemu_process.c | 47 ++--
src/util/virbitmap.c | 33 ++-
src/util/virbitmap.h | 3 +
src/util/virutil.h | 11 +
src/xen/xend_internal.c | 34 +--
tests/utiltest.c | 30 +++
tools/virsh.pod | 3 +-
23 files changed, 553 insertions(+), 762 deletions(-)
--
2.4.1
9 years, 5 months
[libvirt] [PATCH] parallels: add block device statistics to driver
by Nikolay Shirokovskiy
Statistics provided through PCS SDK. As we have only async interface in SDK we
need to be subscribed to statistics in order to get it. Trivial solution on
every stat request to subscribe, wait event and then unsubscribe will lead to
significant delays in case of a number of successive requests, as the event
will be delivered on next PCS server notify cycle. On the other hand we don't
want to keep unnesessary subscribtion. So we take an hibrid solution to
subcsribe on first request and then keep a subscription while requests are
active. We populate cache of statistics on subscribtion events and use this
cache to serve libvirts requests.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)parallels.com>
---
src/parallels/parallels_driver.c | 106 +++++++++++++++++++++
src/parallels/parallels_sdk.c | 193 ++++++++++++++++++++++++++++++++------
src/parallels/parallels_sdk.h | 2 +
src/parallels/parallels_utils.h | 15 +++
4 files changed, 285 insertions(+), 31 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 4b87213..ce59e00 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -51,6 +51,7 @@
#include "nodeinfo.h"
#include "virstring.h"
#include "cpu/cpu.h"
+#include "virtypedparam.h"
#include "parallels_driver.h"
#include "parallels_utils.h"
@@ -1179,6 +1180,109 @@ parallelsDomainGetMaxMemory(virDomainPtr domain)
return ret;
}
+static int
+parallelsDomainBlockStats(virDomainPtr domain, const char *path,
+ virDomainBlockStatsPtr stats)
+{
+ virDomainObjPtr dom = NULL;
+ int ret = -1;
+ size_t i;
+ int idx;
+
+ if (!(dom = parallelsDomObjFromDomain(domain)))
+ return -1;
+
+ if (*path) {
+ if ((idx = virDomainDiskIndexByName(dom->def, path, false)) < 0) {
+ virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path);
+ goto cleanup;
+ }
+ if (prlsdkGetBlockStats(dom, dom->def->disks[idx], stats) < 0)
+ goto cleanup;
+ } else {
+ virDomainBlockStatsStruct s;
+
+#define PARALLELS_ZERO_STATS(VAR, TYPE, NAME) \
+ stats->VAR = 0;
+
+ PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_ZERO_STATS)
+
+#undef PARALLELS_ZERO_STATS
+
+ for (i = 0; i < dom->def->ndisks; i++) {
+ if (prlsdkGetBlockStats(dom, dom->def->disks[i], &s) < 0)
+ goto cleanup;
+
+#define PARALLELS_SUM_STATS(VAR, TYPE, NAME) \
+ if (s.VAR != -1) \
+ stats->VAR += s.VAR;
+
+ PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_SUM_STATS)
+
+#undef PARALLELS_SUM_STATS
+ }
+ }
+ stats->errs = -1;
+ ret = 0;
+
+ cleanup:
+ if (dom)
+ virObjectUnlock(dom);
+
+ return ret;
+}
+
+static int
+parallelsDomainBlockStatsFlags(virDomainPtr domain,
+ const char *path,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
+{
+ virDomainBlockStatsStruct stats;
+ int ret = -1;
+ size_t i;
+
+ virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
+ /* We don't return strings, and thus trivially support this flag. */
+ flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
+
+ if (parallelsDomainBlockStats(domain, path, &stats) < 0)
+ goto cleanup;
+
+ if (*nparams == 0) {
+#define PARALLELS_COUNT_STATS(VAR, TYPE, NAME) \
+ if ((stats.VAR) != -1) \
+ ++*nparams;
+
+ PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_COUNT_STATS)
+
+#undef PARALLELS_COUNT_STATS
+ ret = 0;
+ goto cleanup;
+ }
+
+ i = 0;
+#define PARALLELS_BLOCK_STATS_ASSIGN_PARAM(VAR, TYPE, NAME) \
+ if (i < *nparams && (stats.VAR) != -1) { \
+ if (virTypedParameterAssign(params + i, TYPE, \
+ VIR_TYPED_PARAM_LLONG, (stats.VAR)) < 0) \
+ goto cleanup; \
+ i++; \
+ }
+
+ PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_BLOCK_STATS_ASSIGN_PARAM)
+
+#undef PARALLELS_BLOCK_STATS_ASSIGN_PARAM
+
+ *nparams = i;
+ ret = 0;
+
+ cleanup:
+ return ret;
+}
+
+
static virHypervisorDriver parallelsDriver = {
.name = "Parallels",
.connectOpen = parallelsConnectOpen, /* 0.10.0 */
@@ -1228,6 +1332,8 @@ static virHypervisorDriver parallelsDriver = {
.domainManagedSave = parallelsDomainManagedSave, /* 1.2.14 */
.domainManagedSaveRemove = parallelsDomainManagedSaveRemove, /* 1.2.14 */
.domainGetMaxMemory = parallelsDomainGetMaxMemory, /* 1.2.15 */
+ .domainBlockStats = parallelsDomainBlockStats, /* 1.2.16 */
+ .domainBlockStatsFlags = parallelsDomainBlockStatsFlags, /* 1.2.16 */
};
static virConnectDriver parallelsConnectDriver = {
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 88ad59b..eb8d965 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -21,6 +21,7 @@
*/
#include <config.h>
+#include <stdarg.h>
#include "virerror.h"
#include "viralloc.h"
@@ -407,6 +408,8 @@ prlsdkDomObjFreePrivate(void *p)
return;
PrlHandle_Free(pdom->sdkdom);
+ PrlHandle_Free(pdom->cache.stats);
+ virCondDestroy(&pdom->cache.cond);
VIR_FREE(pdom->uuid);
VIR_FREE(pdom->home);
VIR_FREE(p);
@@ -1260,6 +1263,13 @@ prlsdkLoadDomain(parallelsConnPtr privconn,
* to NULL temporarily */
pdom->uuid = NULL;
+ pdom->cache.stats = PRL_INVALID_HANDLE;
+ pdom->cache.count = 0;
+ if (virCondInit(&pdom->cache.cond) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize condition"));
+ goto error;
+ }
+
if (prlsdkGetDomainIds(sdkdom, &def->name, def->uuid) < 0)
goto error;
@@ -1636,43 +1646,39 @@ prlsdkHandleVmRemovedEvent(parallelsConnPtr privconn,
}
static PRL_RESULT
-prlsdkHandleVmEvent(parallelsConnPtr privconn, PRL_HANDLE prlEvent)
+prlsdkHandlePerfEvent(parallelsConnPtr privconn,
+ PRL_HANDLE event,
+ unsigned char *uuid)
{
- PRL_RESULT pret;
- char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
- unsigned char uuid[VIR_UUID_BUFLEN];
- PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
- PRL_EVENT_TYPE prlEventType;
+ virDomainObjPtr dom = NULL;
+ parallelsDomObjPtr privdom = NULL;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
- pret = PrlEvent_GetType(prlEvent, &prlEventType);
- prlsdkCheckRetGoto(pret, error);
+ dom = virDomainObjListFindByUUID(privconn->domains, uuid);
+ if (dom == NULL)
+ goto cleanup;
- pret = PrlEvent_GetIssuerId(prlEvent, uuidstr, &bufsize);
- prlsdkCheckRetGoto(pret, error);
+ privdom = dom->privateData;
- if (prlsdkUUIDParse(uuidstr, uuid) < 0)
- return PRL_ERR_FAILURE;
+ PrlHandle_Free(privdom->cache.stats);
+ privdom->cache.stats = event;
+ virCondSignal(&privdom->cache.cond);
- switch (prlEventType) {
- case PET_DSP_EVT_VM_STATE_CHANGED:
- return prlsdkHandleVmStateEvent(privconn, prlEvent, uuid);
- case PET_DSP_EVT_VM_CONFIG_CHANGED:
- return prlsdkHandleVmConfigEvent(privconn, uuid);
- case PET_DSP_EVT_VM_CREATED:
- case PET_DSP_EVT_VM_ADDED:
- return prlsdkHandleVmAddedEvent(privconn, uuid);
- case PET_DSP_EVT_VM_DELETED:
- case PET_DSP_EVT_VM_UNREGISTERED:
- return prlsdkHandleVmRemovedEvent(privconn, uuid);
- break;
- default:
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Can't handle event of type %d"), prlEventType);
- return PRL_ERR_FAILURE;
+ ++privdom->cache.count;
+
+ if (privdom->cache.count > 3) {
+ job = PrlVm_UnsubscribeFromPerfStats(privdom->sdkdom);
+ if (PRL_FAILED(waitJob(job)))
+ goto cleanup;
+ privdom->cache.count = 0;
+ privdom->cache.stats = PRL_INVALID_HANDLE;
}
- error:
- return PRL_ERR_FAILURE;
+ cleanup:
+ if (dom)
+ virObjectUnlock(dom);
+
+ return PRL_ERR_SUCCESS;
}
static PRL_RESULT
@@ -1682,6 +1688,9 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
PRL_RESULT pret = PRL_ERR_UNINITIALIZED;
PRL_HANDLE_TYPE handleType;
PRL_EVENT_TYPE prlEventType;
+ char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
+ unsigned char uuid[VIR_UUID_BUFLEN];
+ PRL_UINT32 bufsize = ARRAY_CARDINALITY(uuidstr);
pret = PrlHandle_GetType(prlEvent, &handleType);
prlsdkCheckRetGoto(pret, cleanup);
@@ -1700,14 +1709,31 @@ prlsdkEventsHandler(PRL_HANDLE prlEvent, PRL_VOID_PTR opaque)
PrlEvent_GetType(prlEvent, &prlEventType);
prlsdkCheckRetGoto(pret, cleanup);
+ pret = PrlEvent_GetIssuerId(prlEvent, uuidstr, &bufsize);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ if (prlsdkUUIDParse(uuidstr, uuid) < 0)
+ goto cleanup;
+
switch (prlEventType) {
case PET_DSP_EVT_VM_STATE_CHANGED:
+ prlsdkHandleVmStateEvent(privconn, prlEvent, uuid);
+ break;
case PET_DSP_EVT_VM_CONFIG_CHANGED:
+ prlsdkHandleVmConfigEvent(privconn, uuid);
+ break;
case PET_DSP_EVT_VM_CREATED:
case PET_DSP_EVT_VM_ADDED:
+ prlsdkHandleVmAddedEvent(privconn, uuid);
+ break;
case PET_DSP_EVT_VM_DELETED:
case PET_DSP_EVT_VM_UNREGISTERED:
- pret = prlsdkHandleVmEvent(privconn, prlEvent);
+ prlsdkHandleVmRemovedEvent(privconn, uuid);
+ break;
+ case PET_DSP_EVT_VM_PERFSTATS:
+ prlsdkHandlePerfEvent(privconn, prlEvent, uuid);
+ // above function takes own of event
+ prlEvent = PRL_INVALID_HANDLE;
break;
default:
VIR_DEBUG("Skipping event of type %d", prlEventType);
@@ -3455,3 +3481,108 @@ prlsdkDomainManagedSaveRemove(virDomainObjPtr dom)
return 0;
}
+
+static int
+prlsdkExtractStatsParam(PRL_HANDLE sdkstats, const char *name, long long *val)
+{
+ PRL_HANDLE param = PRL_INVALID_HANDLE;
+ PRL_RESULT pret;
+ PRL_INT64 pval = 0;
+ int ret = -1;
+
+ pret = PrlEvent_GetParamByName(sdkstats, name, ¶m);
+ if (pret == PRL_ERR_NO_DATA) {
+ *val = -1;
+ ret = 0;
+ goto cleanup;
+ } else if (PRL_FAILED(pret)) {
+ logPrlError(pret);
+ goto cleanup;
+ }
+ pret = PrlEvtPrm_ToInt64(param, &pval);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ *val = pval;
+ ret = 0;
+
+ cleanup:
+ PrlHandle_Free(param);
+ return ret;
+}
+
+static int
+prlsdkGetStatsParam(virDomainObjPtr dom, const char *name, long long *val)
+{
+ parallelsDomObjPtr privdom = dom->privateData;
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+ if (privdom->cache.stats != PRL_INVALID_HANDLE) {
+ privdom->cache.count = 0;
+ return prlsdkExtractStatsParam(privdom->cache.stats, name, val);
+ }
+
+ job = PrlVm_SubscribeToPerfStats(privdom->sdkdom, NULL);
+ if (PRL_FAILED(waitJob(job)))
+ goto error;
+
+ while (privdom->cache.stats == PRL_INVALID_HANDLE) {
+ if (virCondWait(&privdom->cache.cond, &dom->parent.lock) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to wait on monitor condition"));
+ goto error;
+ }
+ }
+
+ return prlsdkExtractStatsParam(privdom->cache.stats, name, val);
+ error:
+ return -1;
+}
+
+int
+prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats)
+{
+ virDomainDeviceDriveAddressPtr address;
+ int idx;
+ const char *prefix;
+ int ret = -1;
+ char *name = NULL;
+
+ address = &disk->info.addr.drive;
+ switch (disk->bus) {
+ case VIR_DOMAIN_DISK_BUS_IDE:
+ prefix = "ide";
+ idx = address->bus * 2 + address->unit;
+ break;
+ case VIR_DOMAIN_DISK_BUS_SATA:
+ prefix = "sata";
+ idx = address->unit;
+ break;
+ case VIR_DOMAIN_DISK_BUS_SCSI:
+ prefix = "scsi";
+ idx = address->unit;
+ break;
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown disk bus: %X"), disk->bus);
+ goto cleanup;
+ }
+
+
+#define PRLSDK_GET_STAT_PARAM(VAL, TYPE, NAME) \
+ if (virAsprintf(&name, "devices.%s%d.%s", prefix, idx, NAME) < 0) \
+ goto cleanup; \
+ if (prlsdkGetStatsParam(dom, name, &stats->VAL) < 0) \
+ goto cleanup; \
+ VIR_FREE(name);
+
+ PARALLELS_BLOCK_STATS_FOREACH(PRLSDK_GET_STAT_PARAM)
+
+#undef PRLSDK_GET_STAT_PARAM
+
+ ret = 0;
+
+ cleanup:
+
+ VIR_FREE(name);
+ return ret;
+}
diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h
index 3f17fc8..afa6745 100644
--- a/src/parallels/parallels_sdk.h
+++ b/src/parallels/parallels_sdk.h
@@ -64,3 +64,5 @@ int
prlsdkAttachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
int
prlsdkDetachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk);
+int
+prlsdkGetBlockStats(virDomainObjPtr dom, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
diff --git a/src/parallels/parallels_utils.h b/src/parallels/parallels_utils.h
index 2d1d405..e424405 100644
--- a/src/parallels/parallels_utils.h
+++ b/src/parallels/parallels_utils.h
@@ -73,11 +73,20 @@ struct _parallelsConn {
typedef struct _parallelsConn parallelsConn;
typedef struct _parallelsConn *parallelsConnPtr;
+struct _parallelsContersCache {
+ PRL_HANDLE stats;
+ virCond cond;
+ int count;
+};
+
+typedef struct _parallelsContersCache parallelsContersCache;
+
struct parallelsDomObj {
int id;
char *uuid;
char *home;
PRL_HANDLE sdkdom;
+ parallelsContersCache cache;
};
typedef struct parallelsDomObj *parallelsDomObjPtr;
@@ -106,4 +115,10 @@ virStorageVolPtr parallelsStorageVolLookupByPathLocked(virConnectPtr conn,
int parallelsStorageVolDefRemove(virStoragePoolObjPtr privpool,
virStorageVolDefPtr privvol);
+#define PARALLELS_BLOCK_STATS_FOREACH(OP) \
+ OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \
+ OP(rd_bytes, VIR_DOMAIN_BLOCK_STATS_READ_BYTES, "read_total") \
+ OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \
+ OP(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES, "write_total")
+
#endif
--
1.7.1
9 years, 5 months
[libvirt] [PATCH] qemu: Check for qemu capability when calling virDomainGetBlockIoTune()
by Martin Kletzander
When getting block device I/O tuning data there is no check for whether
QEMU supports such options and the call fails on
qemuMonitorGetBlockIoThrottle() when getting the particular throttle
data. So try reporting a better error when blkdeviotune is not
supported.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1224053
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
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 d1b00a2014ba..8f8ad8ba5bf5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18065,6 +18065,12 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
* because we need vm->privateData which need
* virDomainLiveConfigHelperMethod to do so. */
priv = vm->privateData;
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("block I/O throttling not supported with this "
+ "QEMU binary"));
+ goto endjob;
+ }
supportMaxOptions = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
}
--
2.4.2
9 years, 5 months
[libvirt] [PATCH v2] check if console/channel PTY is null before attempting to open
by Shivaprasad G Bhat
Console/channel devices have their pty devices assigned when the emulator is
actually started. If time is spent in guest preparation, someone attempts
to open the console/channel, the libvirt crashes in virChrdevLockFilePath().
The patch attempts to fix the crash by adding a check before attempting to
open.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/conf/virchrdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
index 5f28f29..701b326 100644
--- a/src/conf/virchrdev.c
+++ b/src/conf/virchrdev.c
@@ -350,6 +350,11 @@ int virChrdevOpen(virChrdevsPtr devs,
switch (source->type) {
case VIR_DOMAIN_CHR_TYPE_PTY:
path = source->data.file.path;
+ if (!path) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("PTY device is not yet assigned"));
+ return -1;
+ }
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
path = source->data.nix.path;
9 years, 5 months