diff mbox

[v2] arch_init: Use stateless configuration for default target_${target}.conf

Message ID 1432638689-17159-1-git-send-email-michael.i.doherty@intel.com
State New
Headers show

Commit Message

Ikey Doherty May 26, 2015, 11:11 a.m. UTC
The goal of stateless, and thus this change, is to separate OS configuration
from system administrator configuration. With this change we will read the
default configuration data from /usr/share/defaults/qemu, in the absence of
an overriding site administrator configuration in /etc/qemu.

A key advantage of this change is enabling a sane and immutable default OS
configuration, that is resiliant to upgrades. Ultimate power is still left
to the system administrator, with the ability to override the defaults if
required. Lastly, given that the sane defaults are always available, the
administrator may simply remove their site-config files to reset the
configuration to the "factory defaults" (i.e. OS configuration).

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
---
 Makefile    | 8 ++++----
 arch_init.c | 1 +
 configure   | 2 ++
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini May 26, 2015, 11:23 a.m. UTC | #1
On 26/05/2015 13:11, Ikey Doherty wrote:
> The goal of stateless, and thus this change, is to separate OS configuration
> from system administrator configuration. With this change we will read the
> default configuration data from /usr/share/defaults/qemu, in the absence of
> an overriding site administrator configuration in /etc/qemu.
> 
> A key advantage of this change is enabling a sane and immutable default OS
> configuration, that is resiliant to upgrades. Ultimate power is still left
> to the system administrator, with the ability to override the defaults if
> required. Lastly, given that the sane defaults are always available, the
> administrator may simply remove their site-config files to reset the
> configuration to the "factory defaults" (i.e. OS configuration).

The patch does make sense, however the target-x86_64.conf file has now
been empty for three years and we probably should just stop honoring it.

In addition, there is another file in /etc/qemu, namely bridge.conf.
Stateless configuration would make a lot of sense for that file.  Can
you modify your patch to kill target-$TARGET_NAME.conf altogether, and
to use stateless configuration for bridge.conf?

Paolo

> Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
> ---
>  Makefile    | 8 ++++----
>  arch_init.c | 1 +
>  configure   | 2 ++
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d945804..52635da 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -390,12 +390,12 @@ endif
>  endif
>  
>  install-confdir:
> -	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
> +	$(INSTALL_DIR) "$(DESTDIR)$(qemu_defaultdir)"
>  
> -install-sysconfig: install-datadir install-confdir
> -	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
> +install-defaultconfig: install-datadir install-confdir
> +	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_defaultdir)"
>  
> -install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
> +install: all $(if $(BUILD_DOCS),install-doc) install-defaultconfig \
>  install-datadir install-localstatedir
>  ifneq ($(TOOLS),)
>  	$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
> diff --git a/arch_init.c b/arch_init.c
> index 23d3feb..f23fb1f 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -137,6 +137,7 @@ static struct defconfig_file {
>  } default_config_files[] = {
>      { CONFIG_QEMU_CONFDIR "/qemu.conf",                   true },
>      { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true },
> +    { CONFIG_QEMU_DEFAULTDIR "/target-" TARGET_NAME ".conf", true },
>      { NULL }, /* end of list */
>  };
>  
> diff --git a/configure b/configure
> index f758f32..a0b6477 100755
> --- a/configure
> +++ b/configure
> @@ -4303,6 +4303,7 @@ fi
>  qemu_confdir=$sysconfdir$confsuffix
>  qemu_moddir=$libdir$confsuffix
>  qemu_datadir=$datadir$confsuffix
> +qemu_defaultdir="$datadir/defaults$confsuffix"
>  qemu_localedir="$datadir/locale"
>  
>  tools=""
> @@ -4543,6 +4544,7 @@ echo "mandir=$mandir" >> $config_host_mak
>  echo "sysconfdir=$sysconfdir" >> $config_host_mak
>  echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
>  echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
> +echo "qemu_defaultdir=$qemu_defaultdir" >> $config_host_mak
>  echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
>  echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
>  if test "$mingw32" = "no" ; then
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d945804..52635da 100644
--- a/Makefile
+++ b/Makefile
@@ -390,12 +390,12 @@  endif
 endif
 
 install-confdir:
-	$(INSTALL_DIR) "$(DESTDIR)$(qemu_confdir)"
+	$(INSTALL_DIR) "$(DESTDIR)$(qemu_defaultdir)"
 
-install-sysconfig: install-datadir install-confdir
-	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_confdir)"
+install-defaultconfig: install-datadir install-confdir
+	$(INSTALL_DATA) $(SRC_PATH)/sysconfigs/target/target-x86_64.conf "$(DESTDIR)$(qemu_defaultdir)"
 
-install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig \
+install: all $(if $(BUILD_DOCS),install-doc) install-defaultconfig \
 install-datadir install-localstatedir
 ifneq ($(TOOLS),)
 	$(call install-prog,$(TOOLS),$(DESTDIR)$(bindir))
diff --git a/arch_init.c b/arch_init.c
index 23d3feb..f23fb1f 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -137,6 +137,7 @@  static struct defconfig_file {
 } default_config_files[] = {
     { CONFIG_QEMU_CONFDIR "/qemu.conf",                   true },
     { CONFIG_QEMU_CONFDIR "/target-" TARGET_NAME ".conf", true },
+    { CONFIG_QEMU_DEFAULTDIR "/target-" TARGET_NAME ".conf", true },
     { NULL }, /* end of list */
 };
 
diff --git a/configure b/configure
index f758f32..a0b6477 100755
--- a/configure
+++ b/configure
@@ -4303,6 +4303,7 @@  fi
 qemu_confdir=$sysconfdir$confsuffix
 qemu_moddir=$libdir$confsuffix
 qemu_datadir=$datadir$confsuffix
+qemu_defaultdir="$datadir/defaults$confsuffix"
 qemu_localedir="$datadir/locale"
 
 tools=""
@@ -4543,6 +4544,7 @@  echo "mandir=$mandir" >> $config_host_mak
 echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
+echo "qemu_defaultdir=$qemu_defaultdir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
 if test "$mingw32" = "no" ; then