----------------------------------------
Date: Wed, 8 May 2013 14:49:08 -0400
From: jferlan(a)redhat.com
To: libvirt-cim(a)redhat.com
Subject: Re: [Libvirt-cim] [PATCH V2 1/3] make force use qemu configurable
On 05/02/2013 03:10 AM, Xu Wang wrote:
> From: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
>
> Since in nested KVM, libvirt-cim doesn't handler it well now, so add this
> option to manually disable KVM and fall back to qemu. If there is something
> fail caused by nested KVM happend, please consider to set this option to be
> true for development and testing.
>
> Signed-off-by: Xu Wang <cngesaint(a)outlook.com>
> ---
> libvirt-cim.conf | 10 ++++++++++
> libxkutil/misc_util.c | 8 ++++++++
> libxkutil/misc_util.h | 1 +
> src/Virt_VirtualSystemManagementService.c | 7 +++++++
> 4 files changed, 26 insertions(+), 0 deletions(-)
>
The commit message is still a bit confusing, but I suppose not enough to
hold up adding the capability. Hopefully anyone forced to make changes
as a result of being able to develop/test further in the nested
environment will duly note where and what had to change...
There maybe something
unsuitable configuration in the xml files
led to the error under nested KVM. Such as qemu is OK under the same
condition.
> diff --git a/libvirt-cim.conf b/libvirt-cim.conf
> index 37d7b0f..f378e4c 100644
> --- a/libvirt-cim.conf
> +++ b/libvirt-cim.conf
> @@ -30,3 +30,13 @@
> # Default value: NULL, that is not set.
> #
> # migrate_ssh_temp_key = "/root/vm_migrate_tmp_id_rsa";
> +
> +# force_use_qemu (bool)
> +# Since in nested KVM, libvirt-cim doesn't handler it well now, so add this
> +# option to manually disable KVM and fall back to qemu. If there is something
> +# fail caused by nested KVM happend, please consider to set this option to be
> +# true for development and testing.
Consider the following explanation to replace the above 4 lines :
When executing in a nested KVM environment libvirt-cim may fail
unexpectedly with a TBS error. Setting "force_use_qemu" option to true
disables use of KVM and falls back to using QEMU directly.
NOTE: TBS should be replaced with the error or the clue that someone
would need in order to determine they should be using/setting this to
true. Remarking about development or testing is irrelevant.
Thank you very much for
the above words. I think they are much better than
old comment. So the new version patch will use them.
John
> +# Possible values: {true,false}
> +# Default value: false
> +#
> +# force_use_qemu = false;
> diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
> index 00eb4b1..4c0b0a1 100644
> --- a/libxkutil/misc_util.c
> +++ b/libxkutil/misc_util.c
> @@ -227,6 +227,14 @@ static int is_read_only(void)
> return prop.value_bool;
> }
>
> +bool get_force_use_qemu(void)
> +{
> + static LibvirtcimConfigProperty prop = {
> + "force_use_qemu", CONFIG_BOOL, {0}, 0};
> + libvirt_cim_config_get(&prop);
> + return prop.value_bool;
> +}
> +
> const char *get_mig_ssh_tmp_key(void)
> {
> static LibvirtcimConfigProperty prop = {
> diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h
> index 0f52290..9e6b419 100644
> --- a/libxkutil/misc_util.h
> +++ b/libxkutil/misc_util.h
> @@ -154,6 +154,7 @@ int virt_set_status(const CMPIBroker *broker,
>
> /* get libvirt-cim config */
> const char *get_mig_ssh_tmp_key(void);
> +bool get_force_use_qemu(void);
>
> /*
> * Local Variables:
> diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
> index cbb646d..81ec064 100644
> --- a/src/Virt_VirtualSystemManagementService.c
> +++ b/src/Virt_VirtualSystemManagementService.c
> @@ -394,6 +394,13 @@ static bool system_has_kvm(const char *pfx)
> virConnectPtr conn;
> char *caps = NULL;
> bool kvm = false;
> + bool force_use_qemu = get_force_use_qemu();
> +
> + /* sometimes disable KVM to avoid problem in nested KVM */
> + if (force_use_qemu) {
> + CU_DEBUG("Enter force use qemu mode!");
> + return false;
> + }
>
> conn = connect_by_classname(_BROKER, pfx, &s);
> if ((conn == NULL) || (s.rc != CMPI_RC_OK)) {
>
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim