EGI-FCTF/glancepush

Allow for adding custom properties on image creation

Opened this issue · 2 comments

Currently, there is no way to automatically inject custom properties when creating the image in glance. gppublish is already putting comment and version properties, so I'd assume it would be very easy to add other properties as well. Maybe this requires crafting the command line or adding a free form part into the image-create command line.

This feature would be required to add properties that influence the virtualized environment, most notably by adding properties for:

  • hw_disk_bus
  • hw_vif_model

I can have a look at this, too.

I am gonna look at that. Probably using a hash named "properties" in the "meta" file would be best.

Hi Mattieu,

I have started somthing like this last week, but the master branch seems way different from what you once released and didn't work for me. You can use this if you like or write your solution with a hash map, which seems a bit better IMO.

There's also no tag for the 0.1 version you once created.

bjoernh@glancepush-vmcatcher:/devel/glancepush$ git diff HEAD1

diff --git a/SOURCES/usr/bin/gppublish b/SOURCES/usr/bin/gppublish
index c968ef9..0e061b6 100755
--- a/SOURCES/usr/bin/gppublish
+++ b/SOURCES/usr/bin/gppublish
@@ -62,6 +62,11 @@ then
     _debug "remove existing queued images <${name}.q>"
     purge_image "${name}.q"

+    extra_custom_properties_env=$(set | grep vmc_property| sed 's/vmc_property_//')
+    _log "extra_custom_properties_env: $extra_custom_properties_env"
+    extra_custom_properties=$(for prop in ${extra_custom_properties_env}; do echo -n "--property $prop "; done)
+    _log "extra_custom_properties: ${extra_custom_properties}"
+
     _log "uploading image <$name> to glance (quarantine) on cloud <$cloud>, version=$version"
     uuid=$(
         (
@@ -80,6 +85,7 @@ then
             --is-public ${is_public:-true} \
             --property comment="$comment" \
             --property version=$version \
+           ${extra_custom_properties} \
             --container-format ${container_format:-bare} \
             | awk '/ id /{print $4}'
     )

Cheers,
Björn