[libvirt] [PATCH python] Post-release version bump to 4.3.0
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as trivial change.
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index c40908b..eff9d54 100755
--- a/setup.py
+++ b/setup.py
@@ -334,7 +334,7 @@ class my_clean(clean):
_c_modules, _py_modules = get_module_lists()
setup(name = 'libvirt-python',
- version = '4.2.0',
+ version = '4.3.0',
url = 'http://www.libvirt.org',
maintainer = 'Libvirt Maintainers',
maintainer_email = 'libvir-list(a)redhat.com',
--
2.14.3
6 years, 6 months
[libvirt] [PATCH] rpm: add deps on rpcgen/libtirpc-devel
by Daniel P. Berrangé
Since RPC support moved out of glibc we need to have explicit deps on
the new packages providing this functionality
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
libvirt.spec.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index b55a947ec9..97143c68ae 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -464,6 +464,11 @@ BuildRequires: wireshark-devel >= 2.1.0
BuildRequires: libssh-devel >= 0.7.0
%endif
+%if 0%{?fedora} > 27 || 0%{?rhel} > 7
+BuildRequires: rpcgen
+BuildRequires: libtirpc-devel
+%endif
+
Provides: bundled(gnulib)
%description
--
2.14.3
6 years, 6 months
[libvirt] [PATCH 0/2] libxl: drop support for Xen 4.4 and 4.5
by Jim Fehlig
Bla bla bla...
Jim Fehlig (2):
libxl: drop support for Xen < 4.6
news: announce dropping support for Xen 4.4 and 4.5
docs/drvxen.html.in | 11 +++++------
docs/news.xml | 9 +++++++++
m4/virt-driver-libxl.m4 | 23 ++---------------------
3 files changed, 16 insertions(+), 27 deletions(-)
--
2.16.2
6 years, 6 months
[libvirt] [PATCH] util: json: Remove yajl bits from virJSONValueToStr
by Peter Krempa
Rather than depending on yajl bits for creating the JSON structure
replace it by few virBuffer bits. This will make the JSON formatter
libary agnostic.
Additionally remove the debug statement from the worker function since
it was not very useful.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virjson.c | 188 ++++++++++++++++++++++++++++-------------------------
1 file changed, 101 insertions(+), 87 deletions(-)
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 6a02ddf0cc..772a205e9e 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1834,144 +1834,158 @@ virJSONValueFromString(const char *jsonstring)
return ret;
}
+#else
+virJSONValuePtr
+virJSONValueFromString(const char *jsonstring ATTRIBUTE_UNUSED)
+{
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("No JSON parser implementation is available"));
+ return NULL;
+}
+#endif
+
+
+static void
+virJSONValueToStringAddString(virBufferPtr buf,
+ virJSONValuePtr string)
+{
+ const char *t;
+
+ virBufferAddLit(buf, "\"");
+
+ for (t = string->data.string; *t; t++) {
+ switch (*t) {
+ case '"':
+ virBufferAddLit(buf, "\\\"");
+ break;
+ case '\\':
+ virBufferAddLit(buf, "\\\\");
+ break;
+ case '\n':
+ virBufferAddLit(buf, "\\n");
+ break;
+ case '\t':
+ virBufferAddLit(buf, "\\t");
+ break;
+ default:
+ virBufferAdd(buf, t, 1);
+ break;
+ }
+ }
+
+ virBufferAddLit(buf, "\"");
+}
+
+
+#define VIR_JSON_PRETTY_NEWLINE \
+ if (pretty) \
+ virBufferAddLit(buf, "\n")
static int
virJSONValueToStringOne(virJSONValuePtr object,
- yajl_gen g)
+ virBufferPtr buf,
+ bool pretty)
{
size_t i;
- VIR_DEBUG("object=%p type=%d gen=%p", object, object->type, g);
-
- switch (object->type) {
+ switch ((virJSONType) object->type) {
case VIR_JSON_TYPE_OBJECT:
- if (yajl_gen_map_open(g) != yajl_gen_status_ok)
- return -1;
+ virBufferAddLit(buf, "{");
+ VIR_JSON_PRETTY_NEWLINE;
+ virBufferAdjustIndent(buf, 2);
+
for (i = 0; i < object->data.object.npairs; i++) {
- if (yajl_gen_string(g,
- (unsigned char *)object->data.object.pairs[i].key,
- strlen(object->data.object.pairs[i].key))
- != yajl_gen_status_ok)
- return -1;
- if (virJSONValueToStringOne(object->data.object.pairs[i].value, g) < 0)
+ virBufferStrcat(buf, "\"", object->data.object.pairs[i].key, "\":", NULL);
+
+ if (pretty)
+ virBufferAddLit(buf, " ");
+
+ if (virJSONValueToStringOne(object->data.object.pairs[i].value,
+ buf, pretty) < 0)
return -1;
+
+ if (i != object->data.object.npairs - 1) {
+ virBufferAddLit(buf, ",");
+ VIR_JSON_PRETTY_NEWLINE;
+ }
}
- if (yajl_gen_map_close(g) != yajl_gen_status_ok)
- return -1;
+
+ virBufferAdjustIndent(buf, -2);
+ VIR_JSON_PRETTY_NEWLINE;
+ virBufferAddLit(buf, "}");
break;
+
case VIR_JSON_TYPE_ARRAY:
- if (yajl_gen_array_open(g) != yajl_gen_status_ok)
- return -1;
+ virBufferAddLit(buf, "[");
+ VIR_JSON_PRETTY_NEWLINE;
+ virBufferAdjustIndent(buf, 2);
+
for (i = 0; i < object->data.array.nvalues; i++) {
- if (virJSONValueToStringOne(object->data.array.values[i], g) < 0)
+ if (virJSONValueToStringOne(object->data.array.values[i], buf, pretty) < 0)
return -1;
+
+ if (i != object->data.array.nvalues - 1) {
+ virBufferAddLit(buf, ",");
+ VIR_JSON_PRETTY_NEWLINE;
+ }
}
- if (yajl_gen_array_close(g) != yajl_gen_status_ok)
- return -1;
+
+ virBufferAdjustIndent(buf, -2);
+ VIR_JSON_PRETTY_NEWLINE;
+ virBufferAddLit(buf, "]");
break;
case VIR_JSON_TYPE_STRING:
- if (yajl_gen_string(g, (unsigned char *)object->data.string,
- strlen(object->data.string)) != yajl_gen_status_ok)
- return -1;
+ virJSONValueToStringAddString(buf, object);
break;
case VIR_JSON_TYPE_NUMBER:
- if (yajl_gen_number(g, object->data.number,
- strlen(object->data.number)) != yajl_gen_status_ok)
- return -1;
+ virBufferAdd(buf, object->data.number, -1);
break;
case VIR_JSON_TYPE_BOOLEAN:
- if (yajl_gen_bool(g, object->data.boolean) != yajl_gen_status_ok)
- return -1;
+ if (object->data.boolean)
+ virBufferAddLit(buf, "true");
+ else
+ virBufferAddLit(buf, "false");
break;
case VIR_JSON_TYPE_NULL:
- if (yajl_gen_null(g) != yajl_gen_status_ok)
- return -1;
+ virBufferAddLit(buf, "null");
break;
default:
+ virReportEnumRangeError(virJSONType, object->type);
return -1;
}
return 0;
}
+#undef VIR_JSON_PRETTY_NEWLINE
+
char *
virJSONValueToString(virJSONValuePtr object,
bool pretty)
{
- yajl_gen g;
- const unsigned char *str;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
char *ret = NULL;
- yajl_size_t len;
-# ifndef WITH_YAJL2
- yajl_gen_config conf = { pretty ? 1 : 0, pretty ? " " : " "};
-# endif
VIR_DEBUG("object=%p", object);
-# ifdef WITH_YAJL2
- g = yajl_gen_alloc(NULL);
- if (g) {
- yajl_gen_config(g, yajl_gen_beautify, pretty ? 1 : 0);
- yajl_gen_config(g, yajl_gen_indent_string, pretty ? " " : " ");
- yajl_gen_config(g, yajl_gen_validate_utf8, 1);
- }
-# else
- g = yajl_gen_alloc(&conf, NULL);
-# endif
- if (!g) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to create JSON formatter"));
- goto cleanup;
- }
-
- if (virJSONValueToStringOne(object, g) < 0) {
- virReportOOMError();
- goto cleanup;
- }
-
- if (yajl_gen_get_buf(g, &str, &len) != yajl_gen_status_ok) {
- virReportOOMError();
- goto cleanup;
+ if (virJSONValueToStringOne(object, &buf, pretty) < 0 ||
+ virBufferCheckError(&buf) < 0) {
+ virBufferFreeAndReset(&buf);
+ return NULL;
}
- ignore_value(VIR_STRDUP(ret, (const char *)str));
-
- cleanup:
- yajl_gen_free(g);
-
- VIR_DEBUG("result=%s", NULLSTR(ret));
-
+ ret = virBufferContentAndReset(&buf);
+ VIR_DEBUG("result=%s", ret);
return ret;
}
-#else
-virJSONValuePtr
-virJSONValueFromString(const char *jsonstring ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No JSON parser implementation is available"));
- return NULL;
-}
-
-
-char *
-virJSONValueToString(virJSONValuePtr object ATTRIBUTE_UNUSED,
- bool pretty ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("No JSON parser implementation is available"));
- return NULL;
-}
-#endif
-
-
/**
* virJSONStringReformat:
* @jsonstr: string to reformat
--
2.14.3
6 years, 6 months
[libvirt] [PATCH 0/9] json: Fix leak/double-free, clean up code and privatize virJSONValue
by Peter Krempa
Coverity was not wrong about the usage of 'a'/'A' modifiers for
virJSONValueObjectAddVArgs as noted in [1]. Fix the possible
leak/double-free, and add test to make sure it works as expected.
This series also cleans up direct access to attributes of virJSONValue
and in the end privatizes the implementation so that all users are
forced to use accessors.
Peter Krempa (9):
util: json: Fix freeing of objects appended to virJSONValue
tests: json: Validate that attribute values are properly stolen
qemu: monitor: Use virJSONValueObjectKeysNumber in
qemuMonitorJSONGetCPUModelExpansion
qemu: agent: Avoid unnecessary JSON object type check
json: Replace access to virJSONValue->type by virJSONValueGetType
util: json: Add accessor for geting a VIR_JSON_TYPE_NUMBER as string
util: qemu: Don't access virJSONValue members directly in
virQEMUBuildCommandLineJSONRecurse
qemu: monitor: Don't resist stealing 'actions' in
qemuMonitorJSONTransaction
util: json: Privatize struct _virJSONValue and sub-structs
src/libvirt_private.syms | 1 +
src/qemu/qemu_agent.c | 21 +++++-----------
src/qemu/qemu_block.c | 22 +++++------------
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 4 +--
src/qemu/qemu_monitor.c | 4 +--
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 59 ++++++++++++++------------------------------
src/qemu/qemu_monitor_json.h | 2 +-
src/util/virjson.c | 59 +++++++++++++++++++++++++++++++++++++++++---
src/util/virjson.h | 39 +----------------------------
src/util/virqemu.c | 13 ++++++----
tests/qemublocktest.c | 4 +--
tests/virjsontest.c | 47 +++++++++++++++++++++++++++++++++++
14 files changed, 152 insertions(+), 127 deletions(-)
--
2.16.2
6 years, 6 months
[libvirt] [PATCH] lxc_container: Set source file description
by Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyanov1(a)gmail.com>
---
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_container.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 14928e8ec..532fd0be0 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -3,7 +3,7 @@
* Copyright (C) 2008 IBM Corp.
* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
*
- * lxc_container.c: file description
+ * lxc_container.c: Performs container setup tasks
*
* Authors:
* David L. Leskovec <dlesko at linux.vnet.ibm.com>
diff --git a/src/lxc/lxc_container.h b/src/lxc/lxc_container.h
index e0f508d4a..641e2d460 100644
--- a/src/lxc/lxc_container.h
+++ b/src/lxc/lxc_container.h
@@ -1,7 +1,7 @@
/*
* Copyright IBM Corp. 2008
*
- * lxc_container.h: header file for fcns run inside container
+ * lxc_container.h: Performs container setup tasks
*
* Authors:
* David L. Leskovec <dlesko at linux.vnet.ibm.com>
--
2.14.3
6 years, 6 months
[libvirt] [dbus PATCH v4 0/5] New APIs and Domain Lifecycle signal change
by Katerina Koukiou
* Implemented Suspend and Resume APIs.
* Reused virsh functions for taking the Event Strings names from ENUM.
* Merged all Domain Lifecycle events signals into one signal.
Changes from v3:
* s/arg2/arg1/ since Event Type is the second argument of the signal.
Katerina Koukiou (5):
Implement Suspend method for Domain interface.
Implement Resume method for Domain interface.
utils: Introduce functions and macros for translating ENUMs to strings
events: Introduce virtDBusEventsDomainEventToString function
Merge all Domain lifecycle signals into one signal called Domain.
data/org.libvirt.Connect.xml | 54 +++-------------------------------------
data/org.libvirt.Domain.xml | 8 ++++++
src/domain.c | 42 +++++++++++++++++++++++++++++++
src/events.c | 59 +++++++++++++++++---------------------------
src/util.c | 27 ++++++++++++++++++++
src/util.h | 28 +++++++++++++++++++++
test/test_connect.py | 10 +++-----
test/test_domain.py | 40 +++++++++++++++++++++++++-----
8 files changed, 168 insertions(+), 100 deletions(-)
--
2.15.0
6 years, 6 months
[libvirt] RFC: Extending UEFI XML specification
by Prerna
Hi Michal,
The <loader>,<nvram> tags of os element in domain XML (
https://libvirt.org/formatdomain.html#elementsOSBIOS) currently expects
absolute path of the local file which would be used to back the the pflash
disk representing the non-volatile RAM:
<loader readonly='yes' secure='no'
type='rom'>/usr/lib/xen/boot/hvmloader</loader>
<nvram
template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
However, given that for virtualized environments, it is possible that the
VM could be started on different hosts at various points in time, and so we
need to expose the firmware/nvram tuple over a network device so as to be
accessible from various hosts.
I propose extending of the existing config by adding a new element,
"backing". This could be one of :
- 'file': for local filesystem paths
- 'network': for network-attached storage.
As an example:
<loader readonly='yes' secure='no' type='rom' backing =
'file'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram backing='file'
template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
For network-attached storage:
<loader readonly='yes' secure='no' type='rom' backing =
'network'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram backing='network'>
<source protocol='XXX' name='YYY'>
<host name='x.x.x.x' port=xxxx/>
</source>
</nvram>
Note that 'template' attribute in NVRAM should be explicitly disallowed for
backing type "network". This is because libvirtd may not be able to access
the backing store to copy the contents of the template.
I would like to capture thoughts from the community to extend the current
firmware spec.
Regards,
Prerna
6 years, 6 months
[libvirt] [dbus PATCH v3 0/5] New APIs and Domain Lifecycle signal change
by Katerina Koukiou
* Implemented Suspend and Resume APIs.
* Reused virsh functions for taking the Event Strings names from ENUM.
* Merged all Domain Lifecycle events signals into one signal.
Changed from v2:
* Coding style issues.
* Removed the Domain prefix for domain event type only in last patch.
Katerina Koukiou (5):
Implement Suspend method for Domain interface.
Implement Resume method for Domain interface.
utils: Introduce functions and macros for translating ENUMs to strings
events: Introduce virtDBusEventsDomainEventToString function
Merge all Domain lifecycle signals into one signal called Domain.
data/org.libvirt.Connect.xml | 54 +++-------------------------------------
data/org.libvirt.Domain.xml | 8 ++++++
src/domain.c | 42 +++++++++++++++++++++++++++++++
src/events.c | 59 +++++++++++++++++---------------------------
src/util.c | 27 ++++++++++++++++++++
src/util.h | 28 +++++++++++++++++++++
test/test_connect.py | 10 +++-----
test/test_domain.py | 40 +++++++++++++++++++++++++-----
8 files changed, 168 insertions(+), 100 deletions(-)
--
2.15.0
6 years, 6 months
[libvirt] [PATCH] lxc: Use virDomainObjEndAPI after FindByName
by John Ferlan
For consistency, rather than open coding the Unref and Unlock,
just use the virDomainObjEndAPI API.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed as trivial
src/lxc/lxc_process.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index bc321e360d..85c7bcc321 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -420,8 +420,7 @@ static int virLXCProcessSetupNamespaceName(virConnectPtr conn, int ns_type, cons
cleanup:
VIR_FREE(path);
- virObjectUnlock(vm);
- virObjectUnref(vm);
+ virDomainObjEndAPI(&vm);
return fd;
}
--
2.13.6
6 years, 6 months