[libvirt] [libvirt-glib] gconfig: Add gvir_config_domain_video_get_model()
by Zeeshan Ali (Khattak)
Add a getter for model of domain video device.
---
libvirt-gconfig/libvirt-gconfig-domain-video.c | 12 ++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-video.h | 1 +
libvirt-gconfig/libvirt-gconfig.sym | 1 +
3 files changed, 14 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.c b/libvirt-gconfig/libvirt-gconfig-domain-video.c
index 64353bd..e38af6f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-video.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-video.c
@@ -68,6 +68,18 @@ GVirConfigDomainVideo *gvir_config_domain_video_new_from_xml(const gchar *xml,
return GVIR_CONFIG_DOMAIN_VIDEO(object);
}
+GVirConfigDomainVideoModel gvir_config_domain_video_get_model(GVirConfigDomainVideo *video)
+{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_VIDEO(video), GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VGA);
+
+ return gvir_config_object_get_attribute_genum
+ (GVIR_CONFIG_OBJECT(video),
+ "model",
+ "type",
+ GVIR_CONFIG_TYPE_DOMAIN_VIDEO_MODEL,
+ GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VGA);
+}
+
void gvir_config_domain_video_set_model(GVirConfigDomainVideo *video,
GVirConfigDomainVideoModel model)
{
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.h b/libvirt-gconfig/libvirt-gconfig-domain-video.h
index 9fb8e4d..973ba72 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-video.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-video.h
@@ -71,6 +71,7 @@ GType gvir_config_domain_video_get_type(void);
GVirConfigDomainVideo *gvir_config_domain_video_new(void);
GVirConfigDomainVideo *gvir_config_domain_video_new_from_xml(const gchar *xml,
GError **error);
+GVirConfigDomainVideoModel gvir_config_domain_video_get_model(GVirConfigDomainVideo *video);
void gvir_config_domain_video_set_model(GVirConfigDomainVideo *video,
GVirConfigDomainVideoModel model);
void gvir_config_domain_video_set_vram(GVirConfigDomainVideo *video,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index f11f97a..df6dd3a 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -735,6 +735,7 @@ global:
LIBVIRT_GCONFIG_0.2.4 {
gvir_config_domain_graphics_spice_set_gl;
+ gvir_config_domain_video_get_model;
gvir_config_domain_video_set_accel3d;
} LIBVIRT_GCONFIG_0.2.2;
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] config: Add listen setter
by Visarion Alexandru
Learn to set the listen attribute on spice.
---
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 10 ++++++++++
libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h | 3 +++
libvirt-gconfig/libvirt-gconfig.sym | 4 ++++
3 files changed, 17 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 079ea27..1aba9a7 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -165,3 +165,13 @@ void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *gra
gvir_config_object_replace_child_with_attribute_enum
(GVIR_CONFIG_OBJECT(graphics), "gl", "enable", G_TYPE_BOOLEAN, gl);
}
+
+void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
+ const char *address)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics));
+
+ gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics),
+ "listen", G_TYPE_STRING, address,
+ NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index 25c132e..9d995b8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -95,6 +95,9 @@ gvir_config_domain_graphics_spice_get_image_compression
void gvir_config_domain_graphics_spice_set_gl(GVirConfigDomainGraphicsSpice *graphics,
gboolean gl);
+void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
+ const char *address);
+
G_END_DECLS
#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_SPICE_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index f11f97a..4d28c86 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -738,4 +738,8 @@ LIBVIRT_GCONFIG_0.2.4 {
gvir_config_domain_video_set_accel3d;
} LIBVIRT_GCONFIG_0.2.2;
+LIBVIRT_GCONFIG_0.2.5 {
+ gvir_config_domain_graphics_spice_set_listen;
+} LIBVIRT_GCONFIG_0.2.4;
+
# .... define new API here using predicted next version number ....
--
2.5.5
8 years, 4 months
[libvirt] [PATCH sandbox 00/24] Add support for docker v2 registry
by Daniel P. Berrange
I was on the verge of doing a release of libvirt-sandbox to
include the docker/virt-builder support when I discovered
it didn't work with many new images since docker is only
exposing them over its v2 registry API. Hence this series
to add support for the v2 API. It also includes a tonne of
fixes for bugs encountered during debugging, and adds a
new 'list' command for virt-sandbox-image so you can actally
see what you have downloaded :-)
Daniel P. Berrange (24):
Remove transfer annotations on scalar parameters
Improve error message for unsupported URIs
init: search $PATH for user specified binary
image: rename python source impl modules
image: remove execute permission from cli.py
image: add support for --debug arg
image: don't assume ValueError has a multi-line message
image: check for errors running mkfs / virt-sandbox
virt-builder: check exit status of commands run
virt-builder: disable setup of network for virt-builder
docker: check exit status of qemu-img command
docker: rename destdir to templatedir
docker: Remove duplicated call to download_template
docker: add missing hashlib import statement
docker: fix download progress target value
docker: remove unused variables & code in download method
docker: introduce a DockerImage class
docker: fix setting of Accept header
docker: refactor authentication method handling
docker: introduce a DockerRegistry class
docker: refactor download method exception handling
docker: implement support for oauth
docker: add support for v2 registry server
image: add 'list' command for viewing local templates
libvirt-sandbox/image/cli.py | 76 ++-
libvirt-sandbox/image/sources/DockerSource.py | 407 ------------
libvirt-sandbox/image/sources/Makefile.am | 6 +-
.../image/sources/{Source.py => base.py} | 14 +-
libvirt-sandbox/image/sources/docker.py | 683 +++++++++++++++++++++
.../{VirtBuilderSource.py => virtbuilder.py} | 34 +-
libvirt-sandbox/image/template.py | 32 +-
.../libvirt-sandbox-config-interactive.c | 4 +-
.../libvirt-sandbox-config-network-route.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config.c | 16 +-
.../libvirt-sandbox-context-interactive.c | 6 +-
libvirt-sandbox/libvirt-sandbox-init-common.c | 2 +-
12 files changed, 818 insertions(+), 464 deletions(-)
mode change 100755 => 100644 libvirt-sandbox/image/cli.py
delete mode 100644 libvirt-sandbox/image/sources/DockerSource.py
rename libvirt-sandbox/image/sources/{Source.py => base.py} (93%)
create mode 100644 libvirt-sandbox/image/sources/docker.py
rename libvirt-sandbox/image/sources/{VirtBuilderSource.py => virtbuilder.py} (76%)
--
2.7.4
8 years, 4 months
[libvirt] [PATCH 1/1] perf: add more perf events support
by Qiaowei Ren
With current perf framework, this patch adds support to more perf
events, including cache missing, cache peference, cpu cycles,
instrction, etc..
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
docs/formatdomain.html.in | 24 +++++++++++
docs/schemas/domaincommon.rng | 4 ++
include/libvirt/libvirt-domain.h | 39 +++++++++++++++++
src/libvirt-domain.c | 8 ++++
src/qemu/qemu_driver.c | 23 +++++-----
src/util/virperf.c | 65 ++++++++++++++++++++++++++++-
src/util/virperf.h | 4 ++
tests/genericxml2xmlindata/generic-perf.xml | 4 ++
8 files changed, 158 insertions(+), 13 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f660aa6..7999e43 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1839,6 +1839,10 @@
<event name='cmt' enabled='yes'/>
<event name='mbmt' enabled='no'/>
<event name='mbml' enabled='yes'/>
+ <event name='cache_misses' enabled='no'/>
+ <event name='cache_peferences' enabled='no'/>
+ <event name='instructions' enabled='no'/>
+ <event name='cpu_cycles' enabled='no'/>
</perf>
...
</pre>
@@ -1864,6 +1868,26 @@
<td>bandwidth of memory traffic for a memory controller</td>
<td><code>perf.mbml</code></td>
</tr>
+ <tr>
+ <td><code>cache_misses</code></td>
+ <td>the amount of cache missing by applications running on the platform</td>
+ <td><code>perf.cache_misses</code></td>
+ </tr>
+ <tr>
+ <td><code>cache_peferences</code></td>
+ <td>the amount of cache hit by applications running on the platform</td>
+ <td><code>perf.cache_peferences</code></td>
+ </tr>
+ <tr>
+ <td><code>instructions</code></td>
+ <td>the amount of instructions by applications running on the platform</td>
+ <td><code>perf.instructions</code></td>
+ </tr>
+ <tr>
+ <td><code>cpu_cycles</code></td>
+ <td>the amount of cycles one instruction needs</td>
+ <td><code>perf.cpu_cycles</code></td>
+ </tr>
</table>
<h3><a name="elementsDevices">Devices</a></h3>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 563cb3c..e41dc3a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -414,6 +414,10 @@
<value>cmt</value>
<value>mbmt</value>
<value>mbml</value>
+ <value>cache_misses</value>
+ <value>cache_peferences</value>
+ <value>instructions</value>
+ <value>cpu_cycles</value>
</choice>
</attribute>
<attribute name="enabled">
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ea93aa..b79cdb0 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1947,6 +1947,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
*/
# define VIR_PERF_PARAM_MBML "mbml"
+/**
+ * VIR_PERF_PARAM_CACHE_MISSES:
+ *
+ * Macro for typed parameter name that represents cache_misses perf
+ * event which can be used to measure the amount of cache missing by
+ * applications running on the platform. It corresponds to the
+ * "perf.cache_misses" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CACHE_MISSES "cache_misses"
+
+/**
+ * VIR_PERF_PARAM_CACHE_REFERENCES:
+ *
+ * Macro for typed parameter name that represents cache_peferences
+ * perf event which can be used to measure the amount of cache hit
+ * by applications running on the platform. It corresponds to the
+ * "perf.cache_peferences" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CACHE_REFERENCES "cache_peferences"
+
+/**
+ * VIR_PERF_PARAM_INSTRUCTIONS:
+ *
+ * Macro for typed parameter name that represents instructions perf
+ * event which can be used to measure the amount of instructions
+ * by applications running on the platform. It corresponds to the
+ * "perf.instructions" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_INSTRUCTIONS "instructions"
+
+/**
+ * VIR_PERF_PARAM_CPU_CYCLES:
+ *
+ * Macro for typed parameter name that represents cpu_cycles perf event
+ * which can be used to measure how many cycles one instruction needs.
+ * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles"
+
int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params,
int *nparams,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 4e71a94..b817e4b 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11452,6 +11452,14 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
* "perf.mbml" - the amount of data (bytes/s) sent through the memory controller
* on the socket as unsigned long long. It is produced by mbml
* perf event.
+ * "perf.cache_misses" - the amount of cache missing as unsigned long long.
+ * It is produced by cache_misses perf event.
+ * "perf.cache_peferences" - the amount of cache hit as unsigned long long.
+ * It is produced by cache_peferences perf event.
+ * "perf.instructions" - the amount of instructions as unsigned long long.
+ * It is produced by instructions perf event.
+ * "perf.cpu_cycles" - the amount of cycles one instruction needs as unsigned
+ * long long. It is produced by cpu_cycles perf event.
*
* Note that entire stats groups or individual stat fields may be missing from
* the output in case they are not supported by the given hypervisor, are not
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d184b..bea753f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9613,6 +9613,10 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
VIR_PERF_PARAM_CMT, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_MBMT, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_MBML, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CACHE_MISSES, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CACHE_REFERENCES, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_INSTRUCTIONS, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN,
NULL) < 0)
return -1;
@@ -18941,10 +18945,10 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
#undef QEMU_ADD_COUNT_PARAM
static int
-qemuDomainGetStatsPerfRdt(virPerfPtr perf,
- virPerfEventType type,
- virDomainStatsRecordPtr record,
- int *maxparams)
+qemuDomainGetStatsPerfOneEvent(virPerfPtr perf,
+ virPerfEventType type,
+ virDomainStatsRecordPtr record,
+ int *maxparams)
{
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
uint64_t value = 0;
@@ -18980,14 +18984,9 @@ qemuDomainGetStatsPerf(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
if (!virPerfEventIsEnabled(priv->perf, i))
continue;
- switch (i) {
- case VIR_PERF_EVENT_CMT:
- case VIR_PERF_EVENT_MBMT:
- case VIR_PERF_EVENT_MBML:
- if (qemuDomainGetStatsPerfRdt(priv->perf, i, record, maxparams) < 0)
- goto cleanup;
- break;
- }
+ if (qemuDomainGetStatsPerfOneEvent(priv->perf, i,
+ record, maxparams) < 0)
+ goto cleanup;
}
ret = 0;
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 4661ba3..a3d2bc6 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -38,7 +38,9 @@ VIR_LOG_INIT("util.perf");
#define VIR_FROM_THIS VIR_FROM_PERF
VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
- "cmt", "mbmt", "mbml");
+ "cmt", "mbmt", "mbml",
+ "cache_misses", "cache_peferences",
+ "instructions", "cpu_cycles");
struct virPerfEvent {
int type;
@@ -189,6 +191,60 @@ virPerfRdtEnable(virPerfEventPtr event,
return -1;
}
+static int
+virPerfGeneralEnable(virPerfEventPtr event,
+ pid_t pid)
+{
+ struct perf_event_attr attr;
+
+ memset(&attr, 0, sizeof(attr));
+ attr.size = sizeof(attr);
+ attr.inherit = 1;
+ attr.disabled = 1;
+ attr.enable_on_exec = 0;
+
+ switch (event->type) {
+ case VIR_PERF_EVENT_CACHE_MISSES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CACHE_MISSES;
+ break;
+ case VIR_PERF_EVENT_CACHE_REFERENCES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CACHE_REFERENCES;
+ break;
+ case VIR_PERF_EVENT_INSTRUCTIONS:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_INSTRUCTIONS;
+ break;
+ case VIR_PERF_EVENT_CPU_CYCLES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CPU_CYCLES;
+ break;
+ }
+
+ event->fd = syscall(__NR_perf_event_open, &attr, pid, -1, -1, 0);
+ if (event->fd < 0) {
+ virReportSystemError(errno,
+ _("Unable to open perf event for %s"),
+ virPerfEventTypeToString(event->type));
+ goto error;
+ }
+
+ if (ioctl(event->fd, PERF_EVENT_IOC_ENABLE) < 0) {
+ virReportSystemError(errno,
+ _("Unable to enable perf event for %s"),
+ virPerfEventTypeToString(event->type));
+ goto error;
+ }
+
+ event->enabled = true;
+ return 0;
+
+ error:
+ VIR_FORCE_CLOSE(event->fd);
+ return -1;
+}
+
int
virPerfEventEnable(virPerfPtr perf,
virPerfEventType type,
@@ -205,6 +261,13 @@ virPerfEventEnable(virPerfPtr perf,
if (virPerfRdtEnable(event, pid) < 0)
return -1;
break;
+ case VIR_PERF_EVENT_CACHE_MISSES:
+ case VIR_PERF_EVENT_CACHE_REFERENCES:
+ case VIR_PERF_EVENT_INSTRUCTIONS:
+ case VIR_PERF_EVENT_CPU_CYCLES:
+ if (virPerfGeneralEnable(event, pid) < 0)
+ return -1;
+ break;
case VIR_PERF_EVENT_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected perf event type=%d"), type);
diff --git a/src/util/virperf.h b/src/util/virperf.h
index 7163410..7129370 100644
--- a/src/util/virperf.h
+++ b/src/util/virperf.h
@@ -28,6 +28,10 @@ typedef enum {
VIR_PERF_EVENT_CMT,
VIR_PERF_EVENT_MBMT,
VIR_PERF_EVENT_MBML,
+ VIR_PERF_EVENT_CACHE_MISSES,
+ VIR_PERF_EVENT_CACHE_REFERENCES,
+ VIR_PERF_EVENT_INSTRUCTIONS,
+ VIR_PERF_EVENT_CPU_CYCLES,
VIR_PERF_EVENT_LAST
} virPerfEventType;
diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml
index 394d2a6..6428ebd 100644
--- a/tests/genericxml2xmlindata/generic-perf.xml
+++ b/tests/genericxml2xmlindata/generic-perf.xml
@@ -16,6 +16,10 @@
<event name='cmt' enabled='yes'/>
<event name='mbmt' enabled='no'/>
<event name='mbml' enabled='yes'/>
+ <event name='cache_misses' enabled='no'/>
+ <event name='cache_peferences' enabled='no'/>
+ <event name='instructions' enabled='no'/>
+ <event name='cpu_cycles' enabled='no'/>
</perf>
<devices>
</devices>
--
1.9.1
8 years, 4 months
[libvirt] [PATCH] qemu: fix domain id after domainCreate(), domainCreateWithFlags()
by Sascha Silbe
Ever since a041de15 [Update to comply with internal driver API]
changed the code to use virDomain.id instead of _virDomainObj.id
(qemud_vm.id back then) directly, the domain ID retrieved with
virDomainGetID() is incorrect after virDomainCreate() or
virDomainCreateWithFlags() was called. The API consumer has to look up
the domain anew to retrieve the correct ID.
Copy over the ID in qemuDomainCreateWithFlags() so it's correct for
the existing domain instance, too.
Fixes: a041de15 ("Update to comply with internal driver API")
Reported-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
Signed-off-by: Sascha Silbe <silbe(a)linux.vnet.ibm.com>
Tested-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cda85f6..6929b23 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7100,6 +7100,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
QEMU_ASYNC_JOB_START) < 0)
goto endjob;
+ dom->id = vm->def->id;
ret = 0;
endjob:
--
1.9.1
8 years, 4 months
[libvirt] [PATCH 0/4] Speed up hvsupport.pl
by Ján Tomko
This reduces the script execution time from 14.7s to 60 ms.
Since this was by far the longest taking target from the docs/ directory
and make does not parallelize across Makefiles, the savings are similar
for a complete build from a fresh git checkout.
The second patch shaves off 8.2s, the third 6.4s and the last one shaves
off half of the remaining time.
Ján Tomko (4):
hvsupport: Introduce parseSymsFile
hvsupport: drop XML::XPath
hvsupport: construct regex up front
hvsupport: skip non-matching lines early
bootstrap.conf | 1 -
docs/hvsupport.pl | 218 +++++++++++++++++++++---------------------------------
2 files changed, 85 insertions(+), 134 deletions(-)
--
2.7.3
8 years, 4 months
[libvirt] [PATCH 0/2] Error out on unsupported formats for vol-wipe
by Martin Kletzander
Historically, vol-wipe was created to rewrite volume with either zeros
or some algorithm. However for non-raw file-based images rewriting or
erasing and recreating them destroys their format. The solution
seemed easy -- just delete and rebuild the volume. However we don't
store the flags used during creation so we can't safely ensure that
the new volume will be the same as the original one. Moreover since
commit eec91958b4b0abdbb7ab769f540bcfa72a107c9b we document that it's
probably not what users are trying to do. Instead of screwing up the
format, let's just disable all the formats that are not supported now.
Martin Kletzander (2):
storage: Don't delete Ploop volumes twice
storage: Forbid wiping formatted volume types that are not supported
src/storage/storage_backend.c | 59 +++++++++++++++++++++++++++----------------
1 file changed, 37 insertions(+), 22 deletions(-)
--
2.9.0
8 years, 4 months
[libvirt] [libvirt-perl PATCH] Revert "Add support for VIR_SECRET_USAGE_TYPE_PASSPHRASE"
by John Ferlan
This reverts commit c74c7608fc1fdb2dc96ca12fcf601ac12990b0ba.
The libvirt changes that caused this were reverted via libvirt.git
commit id 'dae3b965'
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Virt.xs | 1 -
lib/Sys/Virt/Secret.pm | 5 -----
2 files changed, 6 deletions(-)
diff --git a/Virt.xs b/Virt.xs
index 4c9f86b..cf4e5bc 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8534,7 +8534,6 @@ BOOT:
REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_VOLUME, USAGE_TYPE_VOLUME);
REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_CEPH, USAGE_TYPE_CEPH);
REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_ISCSI, USAGE_TYPE_ISCSI);
- REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_PASSPHRASE, USAGE_TYPE_PASSPHRASE);
REGISTER_CONSTANT(VIR_CONNECT_LIST_SECRETS_EPHEMERAL, LIST_EPHEMERAL);
diff --git a/lib/Sys/Virt/Secret.pm b/lib/Sys/Virt/Secret.pm
index beab68b..b871190 100644
--- a/lib/Sys/Virt/Secret.pm
+++ b/lib/Sys/Virt/Secret.pm
@@ -149,11 +149,6 @@ The constant for secrets which are to be used for authenticating
to iSCSI storage volumes. The usage ID for secrets will refer to
the server name.
-=item Sys::Virt::Secret::USAGE_TYPE_PASSPHRASE
-
-The constant for general purpose secret to be used by various libvirt
-objects to provide a single passphrase.
-
=back
=head2 LIST FILTERING
--
2.5.5
8 years, 4 months
[libvirt] [PATCH] virconf: clarify type range checks for integers
by Daniel P. Berrange
When virConf 'l' field is a 'signed long long', so whenever
the 'type' field is VIR_CONF_ULONG, we should explicitly cast
'l' to a 'unsigned long long' before doing range checks.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virconf.c | 81 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 32 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 5085768..f82d114 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1208,21 +1208,28 @@ int virConfGetValueSizeT(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < 0 || cval->l > SIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%zu"),
+ conf->filename, setting, SIZE_MAX);
+ return -1;
+ }
+ } else if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > SIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%zu"),
+ conf->filename, setting, SIZE_MAX);
+ return -1;
+ }
+ } else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected an unsigned integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->l > SIZE_MAX || cval->l < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range 0:%zu"),
- conf->filename, setting, SIZE_MAX);
- return -1;
- }
-
- *value = cval->l;
+ *value = (size_t)cval->l;
return 1;
}
@@ -1256,22 +1263,28 @@ int virConfGetValueSSizeT(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > SSIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range %zd:%zd"),
+ conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
+ return -1;
+ }
+ } else if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range %zd:%zd"),
+ conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
+ return -1;
+ }
+ } else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected a signed integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->l > SSIZE_MAX || cval->l < (-SSIZE_MAX - 1)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range %zd:%zd"),
- conf->filename, setting, -SSIZE_MAX - 1, SSIZE_MAX);
- return -1;
- }
-
- *value = cval->l;
+ *value = (ssize_t)cval->l;
return 1;
}
@@ -1305,22 +1318,20 @@ int virConfGetValueLLong(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_ULONG) {
+ if (((unsigned long long)cval->l) > LLONG_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%lld"),
+ conf->filename, setting, LLONG_MAX);
+ return -1;
+ }
+ } else if (cval->type != VIR_CONF_LONG) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected a signed integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- if (cval->type == VIR_CONF_ULONG &&
- cval->l > LLONG_MAX) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: value for '%s' parameter must be in range 0:%lld"),
- conf->filename, setting, LLONG_MAX);
- return -1;
- }
-
*value = cval->l;
return 1;
@@ -1354,15 +1365,21 @@ int virConfGetValueULLong(virConfPtr conf,
if (!cval)
return 0;
- if (cval->type != VIR_CONF_LONG &&
- cval->type != VIR_CONF_ULONG) {
+ if (cval->type == VIR_CONF_LONG) {
+ if (cval->l < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s: value for '%s' parameter must be in range 0:%llu"),
+ conf->filename, setting, ULLONG_MAX);
+ return -1;
+ }
+ } else if (cval->type != VIR_CONF_ULONG) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: expected an unsigned integer for '%s' parameter"),
conf->filename, setting);
return -1;
}
- *value = cval->l;
+ *value = (unsigned long long)cval->l;
return 1;
}
--
2.7.4
8 years, 4 months