[libvirt] [PATCH RFC] virhook: adding virHookCheck() inside virHookCall().
by Julio Faracco
This commit introduces the virHookCheck() before running the command (hook).
The virHookCheck() before virCommandRun() will avoid errors with changes
(removal and other permissions changes) in the hook file, while the libvirt
daemon is running.
Now, when you remove the hook file while libvirtd is running you get the
following error:
virsh # start WINDOWS_7
error: Failed to start domain WINDOWS_7
error: Hook script execution failed: internal error: Child process (LC_ALL=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME=/home/julio USER=root LOGNAME=root /etc/libvirt/hooks/qemu WINDOWS_7
prepare begin -) unexpected exit status 127: libvirt: error : cannot execute
binary /etc/libvirt/hooks/qemu: No such file or directory
Cc: Carlos Castilho <ccast(a)br.ibm.com>
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/util/virhook.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/util/virhook.c b/src/util/virhook.c
index d37d6da..f741b30 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -294,7 +294,12 @@ virHookCall(int driver,
if (output)
virCommandSetOutputBuffer(cmd, output);
- ret = virCommandRun(cmd, NULL);
+ ret = virHookCheck(driver, virHookDriverTypeToString(driver));
+
+ if (ret > 0) {
+ ret = virCommandRun(cmd, NULL);
+ }
+
if (ret < 0) {
/* Convert INTERNAL_ERROR into known error. */
virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s",
--
1.9.1
8 years, 4 months
[libvirt] [gconfig] gconfig: VIRTIO -> VIRTIO_GPU
by Zeeshan Ali (Khattak)
Rename GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VIRTIO to
GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VIRTIO_GPU to get the naming the same as
used by libosinfo. Consistency is good anyway in general but this would
also mean that Boxes can start using virgl without any changes.
---
examples/config-demo.py | 2 +-
libvirt-gconfig/libvirt-gconfig-domain-video.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/config-demo.py b/examples/config-demo.py
index e92aa43..e52996c 100644
--- a/examples/config-demo.py
+++ b/examples/config-demo.py
@@ -62,7 +62,7 @@ graphics.set_gl(True)
domain.add_device(graphics)
video = LibvirtGConfig.DomainVideo.new()
-video.set_model(LibvirtGConfig.DomainVideoModel.VIRTIO)
+video.set_model(LibvirtGConfig.DomainVideoModel.VIRTIO_GPU)
video.set_accel3d(True)
domain.add_device(video)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.h b/libvirt-gconfig/libvirt-gconfig-domain-video.h
index 9fb8e4d..dda3088 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-video.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-video.h
@@ -63,7 +63,7 @@ typedef enum {
GVIR_CONFIG_DOMAIN_VIDEO_MODEL_XEN,
GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VBOX,
GVIR_CONFIG_DOMAIN_VIDEO_MODEL_QXL,
- GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VIRTIO
+ GVIR_CONFIG_DOMAIN_VIDEO_MODEL_VIRTIO_GPU
} GVirConfigDomainVideoModel;
GType gvir_config_domain_video_get_type(void);
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] spec: Fix indentation
by Andrea Bolognani
Commit ffc49e579c14 broke syntax-check:
cppi: libvirt.spec.in: line 622: not properly indented
cppi: libvirt.spec.in: line 624: not properly indented
cppi: libvirt.spec.in: line 640: not properly indented
cppi: libvirt.spec.in: line 642: not properly indented
maint.mk: incorrect preprocessor indentation
cfg.mk:697: recipe for target 'sc_spec_indentation' failed
Indent the new conditionals properly.
---
Pushed as build breaker.
libvirt.spec.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 3afb155..cc5d722 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -619,9 +619,9 @@ Requires: gzip
Requires: bzip2
Requires: lzop
Requires: xz
-%if 0%{?fedora} >= 24
+ %if 0%{?fedora} >= 24
Requires: systemd-container
-%endif
+ %endif
%description daemon-driver-qemu
The qemu driver plugin for the libvirtd daemon, providing
@@ -637,9 +637,9 @@ Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release}
# There really is a hard cross-driver dependency here
Requires: libvirt-daemon-driver-network = %{version}-%{release}
-%if 0%{?fedora} >= 24
+ %if 0%{?fedora} >= 24
Requires: systemd-container
-%endif
+ %endif
%description daemon-driver-lxc
The LXC driver plugin for the libvirtd daemon, providing
--
2.7.4
8 years, 4 months
[libvirt] [PATCH sandbox] docker: rename destdir to templatedir
by Daniel P. Berrange
Use the more common naming for the variable pointing to
the template directory
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-sandbox/image/sources/DockerSource.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libvirt-sandbox/image/sources/DockerSource.py b/libvirt-sandbox/image/sources/DockerSource.py
index 8f33cb3..c30fe72 100644
--- a/libvirt-sandbox/image/sources/DockerSource.py
+++ b/libvirt-sandbox/image/sources/DockerSource.py
@@ -298,17 +298,17 @@ class DockerSource(Source):
connect)
parentImage = templateImage
- def _get_image_list(self, template, destdir):
+ def _get_image_list(self, template, templatedir):
imageparent = {}
imagenames = {}
- imagedirs = os.listdir(destdir)
+ imagedirs = os.listdir(templatedir)
for imagetagid in imagedirs:
- indexfile = destdir + "/" + imagetagid + "/index.json"
+ indexfile = templatedir + "/" + imagetagid + "/index.json"
if os.path.exists(indexfile):
with open(indexfile,"r") as f:
index = json.load(f)
imagenames[index["name"]] = imagetagid
- jsonfile = destdir + "/" + imagetagid + "/template.json"
+ jsonfile = templatedir + "/" + imagetagid + "/template.json"
if os.path.exists(jsonfile):
with open(jsonfile,"r") as f:
data = json.load(f)
--
2.7.4
8 years, 4 months
[libvirt] [PATCH sandbox] Improve error message for unsupported URIs
by Daniel P. Berrange
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-sandbox/libvirt-sandbox-context-interactive.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libvirt-sandbox/libvirt-sandbox-context-interactive.c b/libvirt-sandbox/libvirt-sandbox-context-interactive.c
index 3ab63ec..5ecaf09 100644
--- a/libvirt-sandbox/libvirt-sandbox-context-interactive.c
+++ b/libvirt-sandbox/libvirt-sandbox-context-interactive.c
@@ -229,13 +229,15 @@ static gboolean gvir_sandbox_context_interactive_start(GVirSandboxContext *ctxt,
if (!g_str_equal(uri, "lxc:///") &&
!g_str_equal(uri, "qemu:///system")) {
g_set_error(error, GVIR_SANDBOX_CONTEXT_INTERACTIVE_ERROR, 0,
- _("Only 'lxc:///' or 'qemu:///system' URIs supported when running as root"));
+ _("URI '%s' unsupported as root, try 'lxc:///' or 'qemu:///system'"),
+ uri);
goto cleanup;
}
} else {
if (!g_str_equal(uri, "qemu:///session")) {
g_set_error(error, GVIR_SANDBOX_CONTEXT_INTERACTIVE_ERROR, 0,
- _("Only 'qemu:///session' URIs supported when running as non-root"));
+ _("URI '%s' unsupported as non-root, try 'qemu:///session'"),
+ uri);
goto cleanup;
}
}
--
2.7.4
8 years, 4 months
[libvirt] [PATCH sandbox] Remove transfer annotations on scalar parameters
by Daniel P. Berrange
The (transfer) annotation is only valid on parameters which
are non-scalar in nature. Latest gobject will warn about
this mistake.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-sandbox/libvirt-sandbox-config-interactive.c | 4 ++--
libvirt-sandbox/libvirt-sandbox-config-network-route.c | 2 +-
libvirt-sandbox/libvirt-sandbox-config.c | 16 ++++++++--------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libvirt-sandbox/libvirt-sandbox-config-interactive.c b/libvirt-sandbox/libvirt-sandbox-config-interactive.c
index 27b4c16..88bc015 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-interactive.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-interactive.c
@@ -246,7 +246,7 @@ GVirSandboxConfigInteractive *gvir_sandbox_config_interactive_new(const gchar *n
/**
* gvir_sandbox_config_interactive_set_tty:
* @config: (transfer none): the sandbox config
- * @tty: (transfer none): true if the container should have a tty
+ * @tty: true if the container should have a tty
*
* Set whether the container console should have a interactive tty.
*/
@@ -263,7 +263,7 @@ void gvir_sandbox_config_interactive_set_tty(GVirSandboxConfigInteractive *confi
*
* Retrieves the sandbox tty flag
*
- * Returns: (transfer none): the tty flag
+ * Returns: the tty flag
*/
gboolean gvir_sandbox_config_interactive_get_tty(GVirSandboxConfigInteractive *config)
{
diff --git a/libvirt-sandbox/libvirt-sandbox-config-network-route.c b/libvirt-sandbox/libvirt-sandbox-config-network-route.c
index 1664d18..c6bf6f3 100644
--- a/libvirt-sandbox/libvirt-sandbox-config-network-route.c
+++ b/libvirt-sandbox/libvirt-sandbox-config-network-route.c
@@ -234,7 +234,7 @@ void gvir_sandbox_config_network_route_set_prefix(GVirSandboxConfigNetworkRoute
*
* Retrieves the prefix length of the route
*
- * Returns: (transfer none): the prefix length
+ * Returns: the prefix length
*/
guint gvir_sandbox_config_network_route_get_prefix(GVirSandboxConfigNetworkRoute *config)
{
diff --git a/libvirt-sandbox/libvirt-sandbox-config.c b/libvirt-sandbox/libvirt-sandbox-config.c
index 0ade178..8709736 100644
--- a/libvirt-sandbox/libvirt-sandbox-config.c
+++ b/libvirt-sandbox/libvirt-sandbox-config.c
@@ -699,7 +699,7 @@ const gchar *gvir_sandbox_config_get_kmodpath(GVirSandboxConfig *config)
/**
* gvir_sandbox_config_set_shell:
* @config: (transfer none): the sandbox config
- * @shell: (transfer none): true if the container should have a shell
+ * @shell: true if the container should have a shell
*
* Set whether the container console should have a interactive shell.
*/
@@ -716,7 +716,7 @@ void gvir_sandbox_config_set_shell(GVirSandboxConfig *config, gboolean shell)
*
* Retrieves the sandbox shell flag
*
- * Returns: (transfer none): the shell flag
+ * Returns: the shell flag
*/
gboolean gvir_sandbox_config_get_shell(GVirSandboxConfig *config)
{
@@ -728,7 +728,7 @@ gboolean gvir_sandbox_config_get_shell(GVirSandboxConfig *config)
/**
* gvir_sandbox_config_set_userid:
* @config: (transfer none): the sandbox config
- * @uid: (transfer none): the sandbox user ID
+ * @uid: the sandbox user ID
*
* Set the user ID to invoke the sandbox application under.
* Defaults to the user ID of the current program.
@@ -746,7 +746,7 @@ void gvir_sandbox_config_set_userid(GVirSandboxConfig *config, guint uid)
*
* Get the user ID to invoke the sandbox application under.
*
- * Returns: (transfer none): the user ID
+ * Returns: the user ID
*/
guint gvir_sandbox_config_get_userid(GVirSandboxConfig *config)
{
@@ -758,7 +758,7 @@ guint gvir_sandbox_config_get_userid(GVirSandboxConfig *config)
/**
* gvir_sandbox_config_set_groupid:
* @config: (transfer none): the sandbox config
- * @gid: (transfer none): the sandbox group ID
+ * @gid: the sandbox group ID
*
* Set the group ID to invoke the sandbox application under.
* Defaults to the group ID of the current program.
@@ -776,7 +776,7 @@ void gvir_sandbox_config_set_groupid(GVirSandboxConfig *config, guint gid)
*
* Get the group ID to invoke the sandbox application under.
*
- * Returns: (transfer none): the group ID
+ * Returns: the group ID
*/
guint gvir_sandbox_config_get_groupid(GVirSandboxConfig *config)
{
@@ -1849,7 +1849,7 @@ const gchar *gvir_sandbox_config_get_security_label(GVirSandboxConfig *config)
/**
* gvir_sandbox_config_set_security_dynamic:
* @config: (transfer none): the sandbox config
- * @dynamic: (transfer none): the security mode
+ * @dynamic: the security mode
*
* Set the SELinux security dynamic for the sandbox. The default
* dynamic is "svirt_sandbox_t"
@@ -1866,7 +1866,7 @@ void gvir_sandbox_config_set_security_dynamic(GVirSandboxConfig *config, gboolea
*
* Retrieve the sandbox security mode
*
- * Returns: (transfer none): the security mode
+ * Returns: the security mode
*/
gboolean gvir_sandbox_config_get_security_dynamic(GVirSandboxConfig *config)
{
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] conf: Make really sure we don't access non-existing vCPUs again
by Daniel P. Berrange
From: Martin Kletzander <mkletzan(a)redhat.com>
MinGW complained that we might be dereferencing a NULL pointer. While
that can't be true, the logic certainly allows for that.
../../src/conf/domain_conf.c: In function 'virDomainDefPostParse':
../../src/conf/domain_conf.c:4224:18: error: potential null pointer dereference [-Werror=null-dereference]
if (!vcpu->online && vcpu->cpumask) {
~~~~^~~~~~~~
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as build fix
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index db1a0ff..1fd826d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4221,7 +4221,7 @@ virDomainDefRemoveOfflineVcpuPin(virDomainDefPtr def)
for (i = 0; i < virDomainDefGetVcpusMax(def); i++) {
vcpu = virDomainDefGetVcpu(def, i);
- if (!vcpu->online && vcpu->cpumask) {
+ if (vcpu && !vcpu->online && vcpu->cpumask) {
virBitmapFree(vcpu->cpumask);
vcpu->cpumask = NULL;
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] libvirt.spec.in: require systemd-container on >= f24
by Daniel P. Berrange
The systemd-machined tools libvirt uses were split into a
systemd-container RPM. Without depending on this, libvirt
may silently fallback to the non-systemd cgroup impl which
is not desirable.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt.spec.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 2b98836..8ebfea5 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -619,6 +619,9 @@ Requires: gzip
Requires: bzip2
Requires: lzop
Requires: xz
+%if 0%{?fedora} > 23
+Requires: systemd-container
+%endif
%description daemon-driver-qemu
The qemu driver plugin for the libvirtd daemon, providing
@@ -634,6 +637,9 @@ Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release}
# There really is a hard cross-driver dependency here
Requires: libvirt-daemon-driver-network = %{version}-%{release}
+%if 0%{?fedora} > 23
+Requires: systemd-container
+%endif
%description daemon-driver-lxc
The LXC driver plugin for the libvirtd daemon, providing
--
2.7.4
8 years, 4 months
[libvirt] [PATCH] qemu: command: Fix awkward formatting
by Andrea Bolognani
---
Pushed as trivial.
src/qemu/qemu_command.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2ca6d26..fe4bb88 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5158,9 +5158,7 @@ qemuBuildVirtioSerialPortDevStr(const virDomainDef *def,
dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
/* Check it's a virtio-serial address */
- if (dev->info.type !=
- VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL)
- {
+ if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("virtio serial device has invalid address type"));
goto error;
--
2.7.4
8 years, 4 months
[libvirt] linux guest time synchronization
by John L. Magee
We have recently updated some servers to CentOS 7 qemu kvm hosts and have been replacing older CentOS 5 and 6 guests with new CentOS 7 guests. Somehow, I thought we no longer had to run NTP/Chrony on the guests if we had the proper timer configuration. It turns out that the guest hwclock stays up to date with the host, where we are running Chrony, but the guest system time is drifting significantly. Is there no way to keep guest system time synchronized to the hwclock? It seems like a waste of resources to run Chrony on all the guests.
Please redirect me to the correct group if this is not the right one. Thanks in advance.
John L Magee jlmagee(a)mageenet.net<mailto:jlmagee@mageenet.net>
8 years, 4 months