Comment 7 for bug 1212179

Revision history for this message
Russell Bryant (russellb) wrote : Re: nova should check the is_public of flavor when creating an instance

At first I thought I couldn't reproduce this, but I was only trying with novaclient. With novaclient, it looks like it doesn't work. It actually fails on trying to get flavor details and doesn't make it far enough to try to boot the server. So, it does appear there is a problem here.

$ . openrc admin

$ nova flavor-create test2 8 512 4 2 --is-public False
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| 8 | test2 | 512 | 4 | 0 | | 2 | 1.0 | False |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+

$ nova flavor-list --all
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 8 | test2 | 512 | 4 | 0 | | 2 | 1.0 | False |
| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+

$ . openrc demo

$ nova flavor-list --all
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+

$ nova boot --flavor 8 --image 899f3f21-e3eb-41b2-b9b9-e805e1ec1e02 test
ERROR: No flavor with a name or ID of '8' exists.

$ curl -i http://162.209.53.10:8774/v2/c7708d0551034f97b1c5fceb848cfcf1/servers -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:..." -d '{"server": {"min_count": 1, "flavorRef": "8", "name": "test2", "imageRef": "899f3f21-e3eb-41b2-b9b9-e805e1ec1e02", "max_count": 1}}'
HTTP/1.1 202 Accepted
Location: http://162.209.53.10:8774/v2/c7708d0551034f97b1c5fceb848cfcf1/servers/9fb1fcdf-e7a7-40cb-af58-94111c5316bd
Content-Type: application/json
Content-Length: 442
X-Compute-Request-Id: req-5d8e375f-1b05-4bc9-abaf-692ff73077d6
Date: Tue, 20 Aug 2013 13:31:56 GMT

{"server": {"security_groups": [{"name": "default"}], "OS-DCF:diskConfig": "MANUAL", "id": "9fb1fcdf-e7a7-40cb-af58-94111c5316bd", "links": [{"href": "http://162.209.53.10:8774/v2/c7708d0551034f97b1c5fceb848cfcf1/servers/9fb1fcdf-e7a7-40cb-af58-94111c5316bd", "rel": "self"}, {"href": "http://162.209.53.10:8774/c7708d0551034f97b1c5fceb848cfcf1/servers/9fb1fcdf-e7a7-40cb-af58-94111c5316bd", "rel": "bookmark"}], "adminPass": "fgWiM7FXrac4"}}