[Pkg-libvirt-maintainers] Bug#862288: Bug#862288: libvirt: Automatically set Xen URI for local user

Guido Günther agx at sigxcpu.org
Wed May 10 18:12:56 UTC 2017


On Wed, May 10, 2017 at 06:09:39PM +0200, Stefan Bader wrote:
> Source: libvirt
> Version: 3.1.0-1~1.gbp9a8156
> Severity: wishlist
> Tags: patch
> 
> The automatic detection of running on a Xen host does not work because the ( not
> accelerated) qemu driver is available, too. The profile script will
> automatically set the environment variable for a locally logged in user.

Is see no reason to deviate from upstream here.
 -- Guido

> 
> -Stefan

> From 98a480480b6e729378030deabe076bc02637e405 Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader at canonical.com>
> Date: Wed, 14 Dec 2016 16:21:30 +0100
> Subject: [PATCH] Add helper script to automatically set local Xen URI
> 
> When a user runs virsh on a system that runs as a Xen host,
> the default URI will still be the qemu one. To make life a
> little simple, this profile script will set the LIBVIRT_URI
> environment variable correctly when detecting a Xen host.
> 
> Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
> ---
>  debian/libvirt-clients.install |  1 +
>  debian/libvirt-uri.sh          | 27 +++++++++++++++++++++++++++
>  debian/rules                   |  4 ++++
>  3 files changed, 32 insertions(+)
>  create mode 100644 debian/libvirt-uri.sh
> 
> diff --git a/debian/libvirt-clients.install b/debian/libvirt-clients.install
> index 84fab60..b775cec 100644
> --- a/debian/libvirt-clients.install
> +++ b/debian/libvirt-clients.install
> @@ -1,3 +1,4 @@
>  usr/bin/*
>  usr/share/man/man1/*
>  etc/libvirt/libvirt.conf
> +etc/profile.d/libvirt-uri.sh
> diff --git a/debian/libvirt-uri.sh b/debian/libvirt-uri.sh
> new file mode 100644
> index 0000000..f9bdc6d
> --- /dev/null
> +++ b/debian/libvirt-uri.sh
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +#    libvirt-uri.sh - Automatically switch default libvirt URI for user
> +#    Copyright (C) 2015 Canonical Ltd.
> +#
> +#    Authors: Stefan Bader <stefan.bader at canonical.com>
> +#
> +#    This program is free software: you can redistribute it and/or modify
> +#    it under the terms of the GNU General Public License as published by
> +#    the Free Software Foundation, version 3 of the License.
> +#
> +#    This program is distributed in the hope that it will be useful,
> +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +#    GNU General Public License for more details.
> +#
> +#    You should have received a copy of the GNU General Public License
> +#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +
> +LIBVIRT_DEFAULT_URI="qemu:///system"
> +if [ -f /proc/xen/capabilities ]; then
> +	if [ "$(cat /proc/xen/capabilities)" = "control_d" ]; then
> +		LIBVIRT_DEFAULT_URI="xen:///"
> +	fi
> +fi
> +
> +export LIBVIRT_DEFAULT_URI
> +
> diff --git a/debian/rules b/debian/rules
> index 36ba507..048427a 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -159,6 +159,10 @@ override_dh_auto_test:
>  	fi
>  
>  override_dh_install-arch:
> +	# Add profile script to automatically set default URI
> +	mkdir -p debian/tmp/etc/profile.d
> +	cp -f debian/libvirt-uri.sh debian/tmp/etc/profile.d/
> +
>  	dh_install
>  
>  	# Copy upstream files to debian/ so dh_* can find them
> -- 
> 2.7.4
> 

> _______________________________________________
> Pkg-libvirt-maintainers mailing list
> Pkg-libvirt-maintainers at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-libvirt-maintainers



More information about the Pkg-libvirt-maintainers mailing list