Cannot assign v4-fixed-ip static ip
Hi,
I am trying to assign a static IP address to a cirros instance. Here is what I am doing:
[root@mgmt-el7-001 ~]# nova list
+--------------------------------------+----------+--------+------------+-------------+------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------+--------+------------+-------------+------------------------+
| 0139e985-ab99-49c2-b340-2b452f703b0c | red-002 | ACTIVE | - | Running | public-59=10.29.103.16 |
| 0826db90-4e28-434b-9e28-56cdeba1fa93 | red-003 | ACTIVE | - | Running | public-59=10.29.103.18 |
| ceacca6d-9c56-4c59-ab16-4ec29a989334 | red-004 | ERROR | - | NOSTATE | |
| 39c2df45-68e3-456f-89f3-7d90a0eb95ab | red-009 | ACTIVE | - | Running | public-59=10.29.103.19 |
| 5f3573d7-01ab-42b4-9275-30eeef2f0a1e | sp-test6 | ACTIVE | - | NOSTATE | public-59=10.29.103.13 |
+--------------------------------------+----------+--------+------------+-------------+------------------------+
So I am thinking, "Ok I can try to assign 10.29.103.19 to red-004." First I have to delete red-004 and red-009. So I do this:
[root@mgmt-el7-001 ~]# nova delete red-004
Request to delete server red-004 has been accepted.
[root@mgmt-el7-001 ~]# nova delete red-009
Request to delete server red-009 has been accepted.
Now I execute my little shell script that uses v4-fixed-ip=10.29.103.19
[root@mgmt-el7-001 ~]# ./boot_static_ip.sh red-004 10.29.103.19
Executing: nova boot --nic net-id=ac7aeb58-d502-4eac-ac74-3e1f0fb3a44f,v4-fixed-ip=10.29.103.19 --image 36499d30-7138-41d5-bc63-29272d6904e2 --flavor 2 red-004
+--------------------------------------+------------------------------------------------------------+
| Property | Value |
+--------------------------------------+------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | red-004 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | - |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | J6Knxgmxng8C |
| config_drive | |
| created | 2015-04-27T16:01:33Z |
| flavor | m1.small (2) |
| hostId | |
| id | 6b18723a-4084-468b-a177-b43bc5252546 |
| image | cirros-0.3.3-x86_64 (36499d30-7138-41d5-bc63-29272d6904e2) |
| key_name | - |
| metadata | {} |
| name | red-004 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | default |
| status | BUILD |
| tenant_id | 8969f3f90b114ab1bc5c966fecde4fbe |
| updated | 2015-04-27T16:01:33Z |
| user_id | 7303322f1af3459fa73fce5fab8d3fc4 |
+--------------------------------------+------------------------------------------------------------+
[root@mgmt-el7-001 ~]# nova show red-004
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | nova-el7-001 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | nova-el7-001.example.com |
| OS-EXT-SRV-ATTR:instance_name | red-004 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | error |
| OS-SRV-USG:launched_at | - |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2015-04-27T16:01:33Z |
| fault | {"message": "No valid host was found. Exceeded max scheduling attempts 3 for instance 6b18723a-4084-468b-a177-b43bc5252546. Last exception: ['Traceback (most recent call last):\ |
| | ', ' File \"/usr/lib/python2.7/site-packages/nova/compute/manager.py\", line 2039, in _do_b", "code": 500, "details": " File \"/usr/lib/python2.7/site-packages/nova/conductor/manager.py\", line 614, in build_instances |
| | instances[0].uuid) |
| | File \"/usr/lib/python2.7/site-packages/nova/scheduler/utils.py\", line 161, in populate_retry |
| | raise exception.NoValidHost(reason=msg) |
| | ", "created": "2015-04-27T16:01:47Z"} |
| flavor | m1.small (2) |
| hostId | 07a13affd72681613b3cfcf23a8f7fab859a78bd4b62936ca6f6427b |
| id | 6b18723a-4084-468b-a177-b43bc5252546 |
| image | cirros-0.3.3-x86_64 (36499d30-7138-41d5-bc63-29272d6904e2) |
| key_name | - |
| metadata | {} |
| name | red-004 |
| os-extended-volumes:volumes_attached | [] |
| status | ERROR |
| tenant_id | 8969f3f90b114ab1bc5c966fecde4fbe |
| updated | 2015-04-27T16:01:47Z |
| user_id | 7303322f1af3459fa73fce5fab8d3fc4 |
+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
So why can't I assign the IP address 10.29.103.19 statically?
Perhaps the IP address you are trying to assign to it is not part of the pool of IPs your subnet has available or it is already taken. Do a neutron subnet-list and and get the subnet ID of the subnet in question. Then do a neutron subnet-show to find the specific allocation pool and check if it fits