From 5705db691386809e288758a0314dfa60d9b36da7 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 1 Feb 2014 20:06:42 -0500 Subject: [PATCH] Optionally enable file injection There is a patch up for nova right now that disables file injection by default. This is a corresponding devstack change that only sets file injection options if it is enabled in the devstack config. This is good to keep around so that we can easily turn it on for testing. The nova change is id Icff1304fc816acc843f8962727aef8bbbc7bbaa3. Change-Id: I5015f2c351b1d680c205d7f9a5204febca490b91 --- lib/nova | 6 ------ lib/nova_plugins/hypervisor-libvirt | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/nova b/lib/nova index eaaaa6210c..d90aea7108 100644 --- a/lib/nova +++ b/lib/nova @@ -513,12 +513,6 @@ function create_nova_conf() { iniset $NOVA_CONF DEFAULT ec2_dmz_host "$EC2_DMZ_HOST" iniset_rpc_backend nova $NOVA_CONF DEFAULT iniset $NOVA_CONF DEFAULT glance_api_servers "$GLANCE_HOSTPORT" - - if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then - # File injection is being disabled by default in the near future - - # disable it here for now to avoid surprises later. - iniset $NOVA_CONF libvirt inject_partition '-2' - fi } function init_nova_cells() { diff --git a/lib/nova_plugins/hypervisor-libvirt b/lib/nova_plugins/hypervisor-libvirt index 42d3af15cf..415244ffae 100644 --- a/lib/nova_plugins/hypervisor-libvirt +++ b/lib/nova_plugins/hypervisor-libvirt @@ -23,6 +23,9 @@ set +o xtrace # Defaults # -------- +# File injection is disabled by default in Nova. This will turn it back on. +ENABLE_FILE_INJECTION=${ENABLE_FILE_INJECTION:-False} + # Entry Points # ------------ @@ -116,6 +119,19 @@ EOF" if is_arch "ppc64"; then iniset $NOVA_CONF DEFAULT vnc_enabled "false" fi + + ENABLE_FILE_INJECTION=$(trueorfalse False $ENABLE_FILE_INJECTION) + if [[ "$ENABLE_FILE_INJECTION" = "True" ]] ; then + # When libguestfs is available for file injection, enable using + # libguestfs to inspect the image and figure out the proper + # partition to inject into. + iniset $NOVA_CONF libvirt inject_partition '-1' + iniset $NOVA_CONF libvirt inject_key 'true' + else + # File injection is being disabled by default in the near future - + # disable it here for now to avoid surprises later. + iniset $NOVA_CONF libvirt inject_partition '-2' + fi } # install_nova_hypervisor() - Install external components