WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Re: multiple disk images, how to?

To: Molle Bestefich <molle.bestefich@xxxxxxxxx>
Subject: Re: [Xen-users] Re: multiple disk images, how to?
From: Charles Duffy <cduffy@xxxxxxxxxxx>
Date: Tue, 17 Jan 2006 09:51:43 -0600
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 17 Jan 2006 15:57:34 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <62b0912f0601170723xbd0437bt7ef84ea0470d4105@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <62b0912f0601090911n5565ceebsbb02dc4d5901d340@xxxxxxxxxxxxxx> <43C299D6.8060806@xxxxxxxxx> <62b0912f0601090926t60480591l5d350d351b581d3b@xxxxxxxxxxxxxx> <dqgcgr$vrh$2@xxxxxxxxxxxxx> <62b0912f0601170723xbd0437bt7ef84ea0470d4105@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051025 Thunderbird/1.5 Mnenhy/0.7.3.0
Molle Bestefich wrote:
> I don't know Python.
> Is it easy to do something like this (bash code):
>
> disk_entries=`grep -E ^disk < $config_file | wc -l`
> if [ $disk_entries -gt 1 ]; then
>   echo Uh-oh...
> fi
>   
Not really, no. See, the config file could look like this:

if 'foo' in locals():
    disk = ['/dev/foo/bar%(foo)s' % foo]
else:
    disk = ['/dev/foo/baz']

...in which case you'd have two disk entries, but only one of them would
ever be executed. Or you could have some fancy dynamic code that looks
at hotplugged USB devices, or who-knows-what, all inside your config
file. Trying to parse the config file any way *other* than with the
Python interpreter would thus be brittle when folks try to take
advantage of the power of having their configuration language be a real
scripting language.


Think of it as if you were sourcing a file to get your config settings
in bash. Someone could have logic like this:

if [ -n "$foo" ] ; then
    DISK="/dev/foo/bar${foo}"
else
    DISK="/dev/foo/baz"
fi

...and that would be valid, so you wouldn't want to call the config file
invalid if it had more than one line matching ^[[:space:]]*DISK=

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users