← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1238344] Re: not validate a metadata type when creating a vm instance

 

** Changed in: nova
       Status: Fix Committed => Fix Released

-- 
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/1238344

Title:
  not validate a metadata type when creating a vm instance

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  If specifying non-dict data(string, etc.) as metadata, "create a vm"
  API returns a HTTP500(Internal Server Error) response:

  $ curl -i http://192.168.0.30:8774/v2/248fcd6585b245dfa48d4dee51673f28/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: MII[..]" -d '{"server": {"min_count": 1, "flavorRef": "42", "name": "vm02", "imageRef": "0483c08f-d4e7-414f-8847-f5855ad816df", "m
  ax_count": 1, "metadata": "string"}}'
  HTTP/1.1 500 Internal Server Error
  Content-Length: 128
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-4148aefb-34d0-433a-aea4-b4268c8776ce
  Date: Thu, 10 Oct 2013 09:30:24 GMT

  {"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}
  $

  The reason is that the API does not validate its metadata type.

  
  The nova-api log is the following:
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     action_result = self.dispatch(meth, request, action_args)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1057, in dispatch
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     return method(req=request, **action_args)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 923, in create
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     legacy_bdm=legacy_bdm)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/hooks.py", line 105, in inner
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     rv = f(*args, **kwargs)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/compute/api.py", line 1220, in create
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     legacy_bdm=legacy_bdm)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/compute/api.py", line 861, in _create_instance
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     block_device_mapping, auto_disk_config, reservation_id)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/compute/api.py", line 672, in _validate_and_build_base_options
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     instance_type, metadata, injected_files)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/compute/api.py", line 626, in _checks_for_create_and_rebuild
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     self._check_metadata_properties_quota(context, metadata)
  2013-10-10 18:30:24.226 TRACE nova.api.openstack   File "/opt/stack/nova/nova/compute/api.py", line 406, in _check_metadata_properties_quota
  2013-10-10 18:30:24.226 TRACE nova.api.openstack     for k, v in metadata.iteritems():
  2013-10-10 18:30:24.226 TRACE nova.api.openstack AttributeError: 'unicode' object has no attribute 'iteritems'
  2013-10-10 18:30:24.226 TRACE nova.api.openstack

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