Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Allow for adding custom properties on image creation #2

Open
bhagemeier opened this issue Nov 18, 2013 · 2 comments
Open

Allow for adding custom properties on image creation #2

bhagemeier opened this issue Nov 18, 2013 · 2 comments
Assignees

Comments

@bhagemeier
Copy link
Contributor

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.

@ghost ghost assigned bhagemeier Nov 18, 2013
@mpuel
Copy link

mpuel commented Nov 24, 2013

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

@bhagemeier
Copy link
Contributor Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants