Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Nova REST API: --user-data equivalent

This is probably going to turn out to be a silly question, but I've been unable to figure it out myself. I can create a new server and have a script run at create time from the command line like this:

nova boot --user-data ./run.sh --image Ubuntu-Basic --flavor m1.small myinstance

And I can create a new server from the REST API by encoding the script in Base64 and sending this:

{
   "server": {
      "flavorRef": "http://192.168.1.200:8774/65b1d52d220c4599a1211d13b46c9b8e/flavors/2",
      "imageRef": "http://192.168.1.200:8774/v2/65b1d52d220c4599a1211d13b46c9b8e/images/a3253101-3421-48b4-9d4d-78ae45bec1c9",
      "name": "test-2",
      "personality": [
         {
            "contents":"<Base64 encoded script>",
            "path":"/tmp/run.sh"
         }
       ]
    }
}

When I do it from the command line, the script gets run at create time. However, when I do it from the REST API, it just gets copied into the provided path and never seems to get run. Is there a way to mimic the --user-data behavior from the REST API? Or is there a better/different way of getting scripts into the server to run at create time?