Richard,
Just when you thought you had enough mail from me already it seems I missed one...
On Thu, Apr 16, 2009 at 6:05 PM, Richard Davies <richard.davies@elastichosts.com> wrote:
Sam Johnston wrote:Great stuff - I think this is a big step forward to be able to express
> Here's a first pass at flattening the Atom into INI file format
> (basically what you had but with "=" for human & computer readability):
everything as a simple list of objects, each specified by simple key-value
pairs. Hopefully we can also similarly add a JSON version using the same
simple data structures, e.g.:
{"category":"server", "title":"Debian...", "mc.state":"running", ... }
I've got two specific comments on the example you give:
1) I'm not sure INI format is actually the best text format for key-value.
I'd prefer something easier to parse from Unix shell, which is where I
imagine most simple scripts will be written. ElasticHosts went with
"key" (without spaces), <space>, "value" (any characters including spaces)
since this can be parsed with
cat file | while read key value ; do ... ; done
#!/bin/sh
[ -z "$1" ] || [ -z "$2" ] && exit 1
sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
-e 's/;.*$//' \
-e 's/[[:space:]]*$//' \
-e 's/^[[:space:]]*//' \
-e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \
< $1 \
| sed -n -e "/^\[$2\]/,/^\s*\[/{/^[^;].*\=.*/p;}"
For python you have ConfigParser, PHP has parse_ini_file, Perl (as per usual) has a dozen or so options then there's libini and its ilk.2) Going through the keys and values in detail:
I like UUIDs and ElasticHosts also uses them, but I might loosen the
> [decca5a5-8952-4004-9793-cdbbf05c3c63]
requirement to any unique string of hex and dashes (since other vendors may
prefer to number sequentially, etc.)
> category = serverDo we need both a title ('name' with ElasticHosts at present) and a summary
> title = Debian GNU/Linux 5.0 Virtual Appliance
> summary = Base installation of Debian GNU/Linux 5.0
or can we just have one of these?
> content.cpu = 2We need to agree units here! Presumably memory would be specified in 'GB' or
> content.memory = 4Gb
alternatively 'MB', 'kB' or nothing. Is CPU the speed quota or the number of
virtual cores? I recommend cores=<integer> and an additional key for speed
quota (ElasticHosts uses cpu=<total MHz to divide across all cores>)
Can we cut the namespace and just write:
cores = 2
cpu = 4000MHz
mem = 4GB
> link.disk[0].id = 4696b561-a253-42b4-bd27-7aa4950e0a60This is good - a mapping between hardware devices and uuids of the storage
> link.disk[0].dev = sda
> link.network[0].id = 45a73b80-c957-4ae1-97c6-b70652eba1d1
> link.network[0].dev = eth0
or network objects.
We don't need the [0] indices, since the 'dev' specifiers are already fully
unique. Taking those out and cutting the namespace gives something like:
disk.sda = 4696b561-a253-42b4-bd27-7aa4950e0a60
network.eth0 = 45a73b80-c957-4ae1-97c6-b70652eba1d1
> mc.state = RUNNINGAll look reasonable, but again I would cut the namespaces:
> br.meter.rate = 0.10
> br.meter.currency = USD
> br.meter.unit = hours
> br.meter.total = 35.27
> pm.monitor.cpu = 75.2
> pm.monitor.mem = 1059374258
state = RUNNING
br.rate = 0.10
br.currency = SD
br.unit = hours
br.total = 35.27
pm.cpu = 75.2
pm.mem = 1059374258
> mc.ops.start = http://example.com/decca5a5-8952-4004-9793-cdbbf05c3c63/ops/startDo we need these at all? Surely these will always be the operations which
> mc.ops.stop = http://example.com/decca5a5-8952-4004-9793-cdbbf05c3c63/ops/stop
> mc.ops.restart = http://example.com/decca5a5-8952-4004-9793-cdbbf05c3c63/ops/restart
> mc.ops.suspend = http://example.com/decca5a5-8952-4004-9793-cdbbf05c3c63/ops/suspend
are possible on a RUNNING server, and so can always be constructed based on
the UUID.
Also, why have 'ops' in the URLs? Why not just
http://example.com/decca5a5-8952-4004-9793-cdbbf05c3c63/start
> [4696b561-a253-42b4-bd27-7aa4950e0a60]
I guess storage needs a 'title' (or 'name') too?
> category = storageWhy not just 'size'?
> content.size = 148251374
> link.self = virtual-disk.vmdkNot sure what this is?
> [45a73b80-c957-4ae1-97c6-b70652eba1d1]
Again, maybe a 'name'?
> category = networkOnce again, I'd take the 'content' prefix off all of these.
> content.vlan = 4095
> content.dhcp = true
> content.subnet = 192.168.0.0
> content.netmask = 255.255.0.0
> content.gateway = 192.168.0.1
The keys you list here work when the network interface is on a private VLAN,
but are the wrong set when it is on the public internet.
On the public internet, the cloud vendor, not the user, defines most of
these parameters and need to be able to control the customer VM from
"stealing" IPs from other customers.
The customer has access to a defined set of static IPs which they have
purchased or alternatively a free dynamic IP assigned at boot, and all they
should be able to specify is which of these they want on this particular
interface, and whether they want to receive a DHCP for it.
For instance, ElasticHosts currently specifies as:
ip = <specified static IP address or 'auto' to assign dynamically at boot>
dhcp = <ip address to send by dhcp or 'auto'; no dhcp if not present>
Given that the customer will have a set of static IPs which they have
purchased (common concept across Amazon, ElasticHosts, GoGrid, etc.), the
API also needs an ability for them to list what these are!