[Ovirt-devel] [PATCH] Allow persistance of empty config files in ovirt_store_config

Ricardo Marin Matinata matinata at br.ibm.com
Thu Mar 25 16:49:56 UTC 2010


On Thu, 2010-03-25 at 14:28 +0100, Alan Pevec wrote:
> On Thu, Mar 25, 2010 at 1:41 PM, Darryl L. Pierce <dpierce at redhat.com> wrote:
> >>                  # skip if file does not exist or is empty
> if changing logic, comments...
> 
> >> -                if [ ! -s "${filename}" ]; then
> >> +                if [ ! -e "${filename}" ]; then
> >>                      printf " Skipping, file '${filename}' does not exist or is empty\n"
> ... and messages should be corrected
> 
> >>                      continue
> >>                  fi

Agree... Re-sending below just in case...

> 

This fix enables the persistence of empty configuration files during
firstboot, in ovirt_store_config, so configuration files like ssh/ssl
keys that are dynamically generated (i.e. content is not known until the
node has booted at least one time) to well known locations can be pre
set for persistence.

Signed-off-by: Ricardo Marin Matinata <matinata at br.ibm.com>
---
 scripts/ovirt-functions |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index 482441a..1c3336d 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -495,9 +495,9 @@ ovirt_store_config() {
             fi
 
             if $persist_it; then
-                # skip if file does not exist or is empty
-                if [ ! -s "${filename}" ]; then
-                    printf " Skipping, file '${filename}' does not
exist or is empty\n"
+                # skip if file does not exist
+                if [ ! -e "${filename}" ]; then
+                    printf " Skipping, file '${filename}' does not
exist\n"
                     continue
                 fi
                 # skip if already bind-mounted
-- 
1.6.6.1


> 
> > ACK - I'll push this upstream. Thank you. :)
> 
> please hold with the push, soft nack from me for the moment, 0 size
> check was explicitly  added in:
> 
> commit 9a0b8ceb94784402c4acf5a5c92dfa0397b76dd7
> Author: Alan Pevec <apevec at redhat.com>
> Date:   Sat Jan 31 00:12:47 2009 +0100
> 
>     do not persist empty files
> 
>     empty config files confuse applications which don't expect them
>     e.g. empty ifcfg-* or ssh_host_*key
> 
>     Empty configs show up after storage is reformatted, leaving placeholder
>     empty files in rootfs.
> 
> I need to check if that's still the case and find other solution.
> BTW, one important thing about stateless persistence: rc.sysinit will
> bind-mount only what's listed in /config/files AND if there's existing
> file in rootfs.
> mount_config, called in ovirt-early will also try to create target
> mount-points in rootfs (this works if parent dir is in rwtab,
> otherwise rootfs is read-only!)
> but this might be too late in some case e.g. additional persisted
> initscript won't be picked up since shell expansion
> /etc/rc$runlevel.d/S* in /etc/rc.d/rc was already done.
> 
> So if you really need that the file exists, it should be included in
> the RPM or at least created in kickstart.

Agree with all of that, however solely adding the files to an RPM (or
kickstart) would not solve the original problem this patch is all about:
We don't know what will be in the file, until the node has actually
booted once.

As a mater of fact, ssh_host_*key files are among the ones we've been
using this patch for...

Of course, I´ll be glad to help if any other suggestions on how to do
this ;)

> 
> Alan

-- 
Ricardo Marin Matinata
Linux Technology Center
IBM Brazil | Hortolandia | SP
matinata br ibm com




More information about the ovirt-devel mailing list