[libvirt] [PATCH] libvirt: add daemon itself as shutdown reason
by Nikolay Shirokovskiy
Let's introduce shutdown reason "daemon" which means we have to
kill running domain ourselves as the best action we can take at
that moment. Failure to pick up domain on daemon restart is
one example of such case. Using reason "crashed" is a bit misleading
as it is used when qemu is actually crashed or qemu destroyed on
guest panic as result of user choice that is the problem was
in qemu/guest itself. So I propose to use "crashed" only for
qemu side issues and introduce "daemon" when we have to kill the qemu
for good.
There is another example where "daemon" will be useful. If we can
not reboot domain we kill it and got "crashed" reason now. Looks
like good candidate for "daemon" reason.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.c | 3 ++-
src/qemu/qemu_process.c | 11 ++++-------
tools/virsh-domain-monitor.c | 3 ++-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index fdd2d6b..11fdab5 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -145,6 +145,7 @@ typedef enum {
VIR_DOMAIN_SHUTOFF_FAILED = 6, /* domain failed to start */
VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7, /* restored from a snapshot which was
* taken while domain was shutoff */
+ VIR_DOMAIN_SHUTOFF_DAEMON = 8, /* daemon have to kill domain */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_SHUTOFF_LAST
# endif
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9911d56..e441723 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -779,7 +779,8 @@ VIR_ENUM_IMPL(virDomainShutoffReason, VIR_DOMAIN_SHUTOFF_LAST,
"migrated",
"saved",
"failed",
- "from snapshot")
+ "from snapshot",
+ "daemon")
VIR_ENUM_IMPL(virDomainCrashedReason, VIR_DOMAIN_CRASHED_LAST,
"unknown",
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e9c7618..c4bc9ca 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7988,15 +7988,12 @@ qemuProcessReconnect(void *opaque)
/* We can't get the monitor back, so must kill the VM
* to remove danger of it ending up running twice if
* user tries to start it again later
- * If we couldn't get the monitor since QEMU supports
- * no-shutdown, we can safely say that the domain
- * crashed ... */
- state = VIR_DOMAIN_SHUTOFF_CRASHED;
- /* If BeginJob failed, we jumped here without a job, let's hope another
+ * If BeginJob failed, we jumped here without a job, let's hope another
* thread didn't have a chance to start playing with the domain yet
* (it's all we can do anyway).
*/
- qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags);
+ qemuProcessStop(driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON,
+ QEMU_ASYNC_JOB_NONE, stopFlags);
}
goto cleanup;
}
@@ -8035,7 +8032,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
* is no thread that could be doing anything else with the same domain
* object.
*/
- qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED,
+ qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_DAEMON,
QEMU_ASYNC_JOB_NONE, 0);
qemuDomainRemoveInactiveJobLocked(src->driver, obj);
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 3a26363..f0ad558 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -212,7 +212,8 @@ VIR_ENUM_IMPL(virshDomainShutoffReason,
N_("migrated"),
N_("saved"),
N_("failed"),
- N_("from snapshot"))
+ N_("from snapshot"),
+ N_("daemon"))
VIR_ENUM_DECL(virshDomainCrashedReason)
VIR_ENUM_IMPL(virshDomainCrashedReason,
--
1.8.3.1
6 years, 5 months
[libvirt] [ocaml PATCH] Cast virError* enums to int for comparisons with 0
by Pino Toscano
The actual type of an enum in C is implementation defined when there are
no negative values, and thus it can be int, or uint. This is the case
of the virError* enums in libvirt, as they do not have negative values.
Hence, to avoid hitting tautological comparison errors when checking
their rage, temporarly cast the enum values to int when checking they
are not negative. The check is there to ensure the value is within the
range of the OCaml type used to represent it.
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
libvirt/libvirt_c_epilogue.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libvirt/libvirt_c_epilogue.c b/libvirt/libvirt_c_epilogue.c
index 29656a4..4e75d2f 100644
--- a/libvirt/libvirt_c_epilogue.c
+++ b/libvirt/libvirt_c_epilogue.c
@@ -153,7 +153,7 @@ Val_err_number (virErrorNumber code)
CAMLparam0 ();
CAMLlocal1 (rv);
- if (0 <= code && code <= MAX_VIR_CODE)
+ if (0 <= (int) code && code <= MAX_VIR_CODE)
rv = Val_int (code);
else {
rv = caml_alloc (1, 0); /* VIR_ERR_UNKNOWN (code) */
@@ -169,7 +169,7 @@ Val_err_domain (virErrorDomain code)
CAMLparam0 ();
CAMLlocal1 (rv);
- if (0 <= code && code <= MAX_VIR_DOMAIN)
+ if (0 <= (int) code && code <= MAX_VIR_DOMAIN)
rv = Val_int (code);
else {
rv = caml_alloc (1, 0); /* VIR_FROM_UNKNOWN (code) */
@@ -185,7 +185,7 @@ Val_err_level (virErrorLevel code)
CAMLparam0 ();
CAMLlocal1 (rv);
- if (0 <= code && code <= MAX_VIR_LEVEL)
+ if (0 <= (int) code && code <= MAX_VIR_LEVEL)
rv = Val_int (code);
else {
rv = caml_alloc (1, 0); /* VIR_ERR_UNKNOWN_LEVEL (code) */
--
2.17.2
6 years, 5 months
[libvirt] [jenkins-ci PATCH v2] Don't run libvirt-dbus-syntax-check on FreeBSD
by Andrea Bolognani
flake8 3.5.0 doesn't work with pyflakes 2.0.0, and since those
are the versions available through ports there's currently no
way to successfully run flake8 on FreeBSD.
We will be able to revert this once flake8 3.6.0 is available
through ports.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/playbooks/build/projects/libvirt-dbus.yml | 7 +++----
projects/libvirt-dbus.yaml | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/guests/playbooks/build/projects/libvirt-dbus.yml b/guests/playbooks/build/projects/libvirt-dbus.yml
index 1d4ecbd..41e670c 100644
--- a/guests/playbooks/build/projects/libvirt-dbus.yml
+++ b/guests/playbooks/build/projects/libvirt-dbus.yml
@@ -21,16 +21,15 @@
- include: '{{ playbook_base }}/jobs/autotools-build-job.yml'
- include: '{{ playbook_base }}/jobs/autotools-syntax-check-job.yml'
vars:
- # CentOS 7 doesn't include Python 3 and the version of pyflakes
- # in FreeBSD CURRENT is too new to be used by flake8
+ # CentOS 7 doesn't include Python 3, while the versions of flake8
+ # and pyflakes currently available on FreeBSD (3.5.0 and 2.0.0
+ # respectively) are not compatible
machines:
- libvirt-debian-9
- libvirt-debian-sid
- libvirt-fedora-28
- libvirt-fedora-29
- libvirt-fedora-rawhide
- - libvirt-freebsd-10
- - libvirt-freebsd-11
- libvirt-ubuntu-16
- libvirt-ubuntu-18
- include: '{{ playbook_base }}/jobs/autotools-check-job.yml'
diff --git a/projects/libvirt-dbus.yaml b/projects/libvirt-dbus.yaml
index 48bbdaa..3d1ed9c 100644
--- a/projects/libvirt-dbus.yaml
+++ b/projects/libvirt-dbus.yaml
@@ -18,15 +18,14 @@
parent_jobs: 'libvirt-glib-build'
- autotools-syntax-check-job:
parent_jobs: 'libvirt-dbus-build'
- # CentOS 7 doesn't include Python 3 and the version of pyflakes
- # in FreeBSD CURRENT is too new to be used by flake8
+ # CentOS 7 doesn't include Python 3, while the versions of flake8
+ # and pyflakes currently available on FreeBSD (3.5.0 and 2.0.0
+ # respectively) are not compatible
machines:
- libvirt-debian-9
- libvirt-fedora-28
- libvirt-fedora-29
- libvirt-fedora-rawhide
- - libvirt-freebsd-10
- - libvirt-freebsd-11
- autotools-check-job:
parent_jobs: 'libvirt-dbus-syntax-check'
# CentOS 7 doesn't include Python 3 and the version in Ubuntu
--
2.19.1
6 years, 5 months
[libvirt] [jenkins-ci PATCH] Don't run libvirt-dbus-syntax-check on FreeBSD
by Andrea Bolognani
flake8 wants 'pyflakes<1.7.0,>=1.5.0', but all FreeBSD
releases ship pyflakes 2.0.0 these days.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/playbooks/build/projects/libvirt-dbus.yml | 4 +---
projects/libvirt-dbus.yaml | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/guests/playbooks/build/projects/libvirt-dbus.yml b/guests/playbooks/build/projects/libvirt-dbus.yml
index 1d4ecbd..61ece63 100644
--- a/guests/playbooks/build/projects/libvirt-dbus.yml
+++ b/guests/playbooks/build/projects/libvirt-dbus.yml
@@ -22,15 +22,13 @@
- include: '{{ playbook_base }}/jobs/autotools-syntax-check-job.yml'
vars:
# CentOS 7 doesn't include Python 3 and the version of pyflakes
- # in FreeBSD CURRENT is too new to be used by flake8
+ # in FreeBSD is too new to be used by flake8
machines:
- libvirt-debian-9
- libvirt-debian-sid
- libvirt-fedora-28
- libvirt-fedora-29
- libvirt-fedora-rawhide
- - libvirt-freebsd-10
- - libvirt-freebsd-11
- libvirt-ubuntu-16
- libvirt-ubuntu-18
- include: '{{ playbook_base }}/jobs/autotools-check-job.yml'
diff --git a/projects/libvirt-dbus.yaml b/projects/libvirt-dbus.yaml
index 48bbdaa..49f5366 100644
--- a/projects/libvirt-dbus.yaml
+++ b/projects/libvirt-dbus.yaml
@@ -19,14 +19,12 @@
- autotools-syntax-check-job:
parent_jobs: 'libvirt-dbus-build'
# CentOS 7 doesn't include Python 3 and the version of pyflakes
- # in FreeBSD CURRENT is too new to be used by flake8
+ # in FreeBSD is too new to be used by flake8
machines:
- libvirt-debian-9
- libvirt-fedora-28
- libvirt-fedora-29
- libvirt-fedora-rawhide
- - libvirt-freebsd-10
- - libvirt-freebsd-11
- autotools-check-job:
parent_jobs: 'libvirt-dbus-syntax-check'
# CentOS 7 doesn't include Python 3 and the version in Ubuntu
--
2.19.1
6 years, 5 months
[libvirt] [PATCH 0/2] conf: qemu: support new Hyper-V enlightenments in Qemu-3.1
by Vitaly Kuznetsov
The upcoming Qemu-3.1 release will bring us two new Hyper-V enlightenments:
hv_ipi and hv_evmcs. Support these in libvirt.
Vitaly Kuznetsov (2):
conf: qemu: add support for Hyper-V PV IPIs
conf: qemu: add support for Hyper-V Enlightened VMCS
docs/formatdomain.html.in | 14 ++++++++++++++
docs/schemas/domaincommon.rng | 10 ++++++++++
src/conf/domain_conf.c | 10 +++++++++-
src/conf/domain_conf.h | 2 ++
src/cpu/cpu_x86.c | 6 ++++++
src/cpu/cpu_x86_data.h | 2 ++
src/qemu/qemu_command.c | 2 ++
src/qemu/qemu_parse_command.c | 2 ++
src/qemu/qemu_process.c | 2 ++
tests/qemuxml2argvdata/hyperv-off.xml | 2 ++
tests/qemuxml2argvdata/hyperv.args | 2 +-
tests/qemuxml2argvdata/hyperv.xml | 2 ++
tests/qemuxml2xmloutdata/hyperv-off.xml | 2 ++
tests/qemuxml2xmloutdata/hyperv.xml | 2 ++
14 files changed, 58 insertions(+), 2 deletions(-)
--
2.17.2
6 years, 5 months
[libvirt] [PATCH v3 00/13] Implement alternative metadata locking
by Michal Privoznik
v3 of:
https://www.redhat.com/archives/libvir-list/2018-October/msg00667.html
diff to v2:
- Introduced two new patches (1/13 and 2/13) so that even non-Linux
platforms are covered
- In 4/13 I switched from indefinite wait for lock to a lock with
timeout (of 10 seconds). This is basically to prevent us stalling if
some app misbehaves and holds the file locked for eternity.
Michal Prívozník (13):
virprocess: Introduce virProcessRunInFork
virprocess: Make virProcessRunInMountNamespace use virProcessRunInFork
security: Always spawn process for transactions
security_manager: Rework metadata locking
Revert "security_manager: Load lock plugin on init"
Revert "qemu_conf: Introduce metadata_lock_manager"
Revert "lock_manager: Allow disabling configFile for
virLockManagerPluginNew"
Revert "lock_driver: Introduce VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK"
Revert "lock_driver: Introduce
VIR_LOCK_MANAGER_RESOURCE_TYPE_METADATA"
Revert "_virLockManagerLockDaemonPrivate: Move @hasRWDisks into dom
union"
Revert "lock_driver: Introduce new
VIR_LOCK_MANAGER_OBJECT_TYPE_DAEMON"
Revert "lock_driver_lockd: Introduce
VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_METADATA flag"
Revert "virlockspace: Allow caller to specify start and length offset
in virLockSpaceAcquireResource"
cfg.mk | 4 +-
src/libvirt_private.syms | 1 +
src/locking/lock_daemon_dispatch.c | 11 +-
src/locking/lock_driver.h | 12 -
src/locking/lock_driver_lockd.c | 421 ++++++++++-------------------
src/locking/lock_driver_lockd.h | 1 -
src/locking/lock_driver_sanlock.c | 44 +--
src/locking/lock_manager.c | 10 +-
src/lxc/lxc_controller.c | 3 +-
src/lxc/lxc_driver.c | 2 +-
src/qemu/qemu_conf.c | 1 -
src/qemu/qemu_conf.h | 1 -
src/qemu/qemu_driver.c | 3 -
src/security/security_dac.c | 12 +-
src/security/security_manager.c | 250 +++++++++--------
src/security/security_manager.h | 19 +-
src/security/security_selinux.c | 11 +-
src/util/virlockspace.c | 15 +-
src/util/virlockspace.h | 4 -
src/util/virprocess.c | 69 ++++-
src/util/virprocess.h | 16 ++
tests/seclabeltest.c | 2 +-
tests/securityselinuxlabeltest.c | 2 +-
tests/securityselinuxtest.c | 2 +-
tests/testutilsqemu.c | 2 +-
tests/virlockspacetest.c | 29 +-
26 files changed, 387 insertions(+), 560 deletions(-)
--
2.18.1
6 years, 5 months
[libvirt] [PATCH] examples: Add missing quotes
by Andrea Bolognani
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed as trivial.
examples/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 7069d74e74..8a9c118858 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -94,7 +94,7 @@ install-apparmor-local:
$(MKDIR_P) "$(APPARMOR_LOCAL_DIR)"
echo "# Site-specific additions and overrides for \
'usr.lib.libvirt.virt-aa-helper'" \
- >$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper
+ >"$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper"
INSTALL_DATA_LOCAL += install-apparmor-local
UNINSTALL_LOCAL += uninstall-apparmor-local
--
2.19.1
6 years, 5 months
[libvirt] [PATCH] build: Fix uninstall when WITH_APPARMOR_PROFILES is defined
by Jim Fehlig
When libvirt configuration includes '--with-apparmor-profiles', the
make uninstall target fails
make[1]: Entering directory '/home/jim/upstream/libvirt/examples'
( cd '/etc/apparmor.d//abstractions' && rm -f libvirt-qemu libvirt-lxc )
( cd '/etc/apparmor.d/' && rm -f usr.lib.libvirt.virt-aa-helper usr.sbin.libvirtd )
make[1]: *** No rule to make target 'uninstall-apparmor-local', needed by
'uninstall-local'. Stop.
Add missing 'uninstall-apparmor-local' target to the examples Makefile.am.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
examples/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 7069d74e74..27f8b0ef09 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -96,6 +96,10 @@ install-apparmor-local:
'usr.lib.libvirt.virt-aa-helper'" \
>$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper
+uninstall-apparmor-local:
+ rm -f "$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper"
+ rmdir $(APPARMOR_LOCAL_DIR) || :
+
INSTALL_DATA_LOCAL += install-apparmor-local
UNINSTALL_LOCAL += uninstall-apparmor-local
endif WITH_APPARMOR_PROFILES
--
2.18.0
6 years, 5 months
[libvirt] [PATCH] virSecuritySELinuxTransactionCommit: Don't mask error
by Michal Privoznik
In 4674fc6afd6 I've implemented transactions for selinux driver.
Well, now that I am working in this area I've notice a subtle
bug: @ret is initialized to 0 instead of -1. Facepalm.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
I wonder how this could survive this long (~2y) not being noticed.
src/security/security_selinux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 467d1e6bfe..c09404f6f8 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1091,7 +1091,7 @@ virSecuritySELinuxTransactionCommit(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
pid_t pid)
{
virSecuritySELinuxContextListPtr list;
- int ret = 0;
+ int ret = -1;
list = virThreadLocalGet(&contextList);
if (!list)
--
2.18.1
6 years, 5 months