← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1534644] Re: 'Nova restore <server>' accepts only ID of server, not its name

 

Bug skimming
------------
The REST API of Nova only accepts IDs. The translation from instance 
name to instance ID happens in the "python-novaclient" CLI. 
The translation seems to have an issue with soft deleted instances.

** Also affects: python-novaclient
   Importance: Undecided
       Status: New

** Changed in: nova
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1534644

Title:
  'Nova restore <server>' accepts only ID of server, not its name

Status in OpenStack Compute (nova):
  Invalid
Status in python-novaclient:
  New

Bug description:
  For softly-deleted instance 'nova restore <server>' command returns:
  root@node-7:~# nova restore vm1
  ERROR (CommandError): No server with a name or ID of 'vm1' exists.

  Steps to reproduce:

  1. On every controller and compute add the
  reclaim_instance_interval=86400 line to [DEFAULT] section of
  /etc/nova/nova.conf

  2. Restart nova-api service on controllers and nova-compute service on
  computes

  3. Create net01: net01__subnet, 192.168.1.0/24:
  neutron net-create net01
  neutron subnet-create net01 192.168.1.0/24 --enable-dhcp --name net01__subnet

  4. Boot instance vm1 in net01:
  NET_ID=$(neutron net-list | grep 'net01' | awk '{print $2}')
  nova boot --flavor m1.micro --image TestVM --nic net-id=$NET_ID  --security-groups default vm1

  5. Create a volume and attach it to an instance vm1:
  cinder create 10 --display-name test-volume --availability-zone nova
  VM_ID=$(nova show vm1 | grep '| id ' | awk  '{print $4}')
  VOL_ID=$(cinder list | grep 'test-volume'| awk '{print $2}')
  nova volume-attach $VM_ID $VOL_ID /dev/vdb

  6. Delete instance vm1:
  nova delete vm1

  7. Check that instance vm1 is really in SOFT-DELETE state:
  root@node-7:~# curl -s -H "X-Auth-Token: $TOKEN" $NOVA_ENDPOINT/servers/395ae0d7-59d9-4475-876d-3da1d0acc430
  {"server": {"status": "SOFT_DELETED", "updated": "2016-01-15T14:57:10Z", "hostId": "4ab2af2839510dd4a32c0c0225646b8ce4d865161930fd9d0d075c68", "OS-EXT-SRV-ATTR:host": "node-9.test.domain.local", "addresses": {"net01": [{"OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:b6:98:bc", "version": 4, "addr": "192.168.1.43", "OS-EXT-IPS:type": "fixed"}]}, "links": [{"href": "http://10.109.13.3:8774/v2/65d0c9e644ac4c518e76bc9922ef47ee/servers/395ae0d7-59d9-4475-876d-3da1d0acc430";, "rel": "self"}, {"href": "http://10.109.13.3:8774/65d0c9e644ac4c518e76bc9922ef47ee/servers/395ae0d7-59d9-4475-876d-3da1d0acc430";, "rel": "bookmark"}], "key_name": null, "image": {"id": "06c7e85d-5023-43ef-a738-8f9aef71fd7a", "links": [{"href": "http://10.109.13.3:8774/65d0c9e644ac4c518e76bc9922ef47ee/images/06c7e85d-5023-43ef-a738-8f9aef71fd7a";, "rel": "bookmark"}]}, "OS-EXT-STS:task_state": null, "OS-EXT-STS:vm_state": "soft-delete", "OS-EXT-SRV-ATTR:instance_name": "instance-0000004b", "OS-SRV-USG:launched_at": "2016-01-15T14:53:52.000000", "OS-EXT-SRV-ATTR:hypervisor_hostname": "node-9.test.domain.local", "flavor": {"id": "11ecb4f1-144a-4bb9-96ff-89bedcd5acde", "links": [{"href": "http://10.109.13.3:8774/65d0c9e644ac4c518e76bc9922ef47ee/flavors/11ecb4f1-144a-4bb9-96ff-89bedcd5acde";, "rel": "bookmark"}]}, "id": "395ae0d7-59d9-4475-876d-3da1d0acc430", "security_groups": [{"name": "default"}], "OS-SRV-USG:terminated_at": null, "OS-EXT-AZ:availability_zone": "nova", "user_id": "7f0fce3a7e3f479b9933eff3df35649d", "name": "vm1", "created": "2016-01-15T14:53:17Z", "tenant_id": "65d0c9e644ac4c518e76bc9922ef47ee", "OS-DCF:diskConfig": "MANUAL", "os-extended-volumes:volumes_attached": [{"id": "ebcbb2f9-5125-4ef7-a507-3b7dfaa997bd"}], "accessIPv4": "", "accessIPv6": "", "OS-EXT-STS:power_state": 4, "config_drive": "", "metadata": {}}}root@node-7:~# nova restore 395ae0d7-59d9-4475-876d-3da1d0acc430

  8. Try to restore the previously-deleted instance with its name as an argument:
  nova restore vm1
  The result is:
  ERROR (CommandError): No server with a name or ID of 'vm1' exists

  9. Try to restore the previously-deleted instance again with its  ID as an argument:
  nova restore 395ae0d7-59d9-4475-876d-3da1d0acc430
  The result is:
  root@node-7:~# nova list | grep vm1
  | 395ae0d7-59d9-4475-876d-3da1d0acc430 | vm1  | ACTIVE | -          | Running     | net01=192.168.1.43 |

  In total,
  Expected result: both name and ID of server are accepted and processed correctly by 'nova restore' command
  Actual result: only ID of server is accepted, not its name

  Nova version - http://paste.openstack.org/show/483603/

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1534644/+subscriptions


References