nova boot vm with '--nic net-id=xxxx, v4-fixed-ip=xxx' failed

Bug #1408529 reported by shihanzhang on 2015-01-08
26
This bug affects 12 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
Zhiyuan Cai
Juno
Low
Artom Lifshitz
python-neutronclient
Low
Shraddha Pandhe

Bug Description

now nova boot vm with '--nic net-id=xxxx, v4-fixed-ip=xxx' will failed, the error in nova-compute log is bellow:

  File "/opt/stack/nova/nova/network/neutronv2/__init__.py", line 84
, in wrapper
    ret = obj(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/v2_0/cl
ient.py", line 1266, in serialize
    self.get_attr_metadata()).serialize(data, self.content_type())
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/common/
serializer.py", line 390, in serialize
    return self._get_serialize_handler(content_type).serialize(data)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/common/
serializer.py", line 54, in serialize
    return self.dispatch(data, action=action)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/common/
serializer.py", line 44, in dispatch
    return action_method(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/common/
serializer.py", line 66, in default
    return jsonutils.dumps(data, default=sanitizer)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/opensta
ck/common/jsonutils.py", line 168, in dumps
    return json.dumps(value, default=default, **kwargs)
  File "/usr/lib/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/common/
serializer.py", line 65, in sanitizer
    return six.text_type(obj, 'utf8')
TypeError: coercing to Unicode: need string or buffer, IPAddress fou
nd

Changed in nova:
assignee: nobody → shihanzhang (shihanzhang)
tags: added: python-neutronclient

Not really a bug, moreover a lack of feature, but it is documented: "Networking does not currently support the v4-fixed-ip parameter of the --nic option for the nova command" ( http://docs.openstack.org/admin-guide-cloud/content/advanced_vm_creation.html ).

If you want to specify an IP address you have to use:

$ neutron port-create --fixed-ip subnet_id=SUBNET_ID,ip_address=IP_ADDRESS NET_ID
$ nova boot --image IMAGE --flavor FLAVOR --nic port-id=PORT_ID VM_NAME

shihanzhang (shihanzhang) wrote :

As I know, now nova does not support just use '--nic v4-fixed-ip', but it can support '--nic net-id=xxxx, v4-fixed-ip=xxx', now the error happen in neutron-client, so I think this neutron-client bug!

summary: - nova boot vm with '--nic net-id=xxxx, v4-fixed-ip=xxx'
+ nova boot vm with '--nic net-id=xxxx, v4-fixed-ip=xxx' failed
Joe Gordon (jogo) on 2015-01-22
Changed in nova:
status: New → Invalid

Fix proposed to branch: master
Review: https://review.openstack.org/149905

Changed in nova:
assignee: shihanzhang (shihanzhang) → Zhiyuan Cai (luckyvega-g)
status: Invalid → In Progress

I will investigate if this is also a neutron client issue.. if not, Ill remove the tag

Changed in python-neutronclient:
assignee: nobody → Shraddha Pandhe (shraddha-pandhe)
Changed in nova:
importance: Undecided → Low

A comment in review 149905 suggests that this could be a duplicate of bug 1396854.

Reviewed: https://review.openstack.org/149905
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=aae858a246e20b1bf55004517b5d9ab28968190a
Submitter: Jenkins
Branch: master

commit aae858a246e20b1bf55004517b5d9ab28968190a
Author: zhiyuan_cai <email address hidden>
Date: Fri Jan 23 18:21:17 2015 +0800

    Transform IPAddress to string when creating port

    If ip address is provided when running nova boot, nova compute
    will invoke neutron client to create a port. However, the ip
    address parameter is an IPAddress object so neutron client will
    fail to send the request to neutron server. Transform IPAddress
    object to string to address this issue.

    Change-Id: I858cca475748795aa2532f32bfe0f1443b30966f
    Closes-Bug: #1408529

Changed in nova:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/145682
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=aed3faf074dbf631dcde55479cc76cb9aa795635
Submitter: Jenkins
Branch: master

commit aed3faf074dbf631dcde55479cc76cb9aa795635
Author: shihanzhang <email address hidden>
Date: Thu Jan 8 12:08:17 2015 +0800

    Fix TypeError for six.text_type

    Change-Id: Ib0d668a6ddadb0fec60c964dc5e1e1bd83b74be4
    Closes-Bug: #1408529

Changed in python-neutronclient:
status: New → Fix Committed
Thierry Carrez (ttx) on 2015-02-05
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Haifeng.Yan (yanheven) wrote :

@Pasquale Porreca ,there is a bug in the doc file http://docs.openstack.org/admin-guide-cloud/content/advanced_vm_creation.html, you can check this by typing "nova help boot". this doc bug has commited ,review herehttps://review.openstack.org/#/c/148498/

Bernd (bernd-vogt) wrote :

Affects also Juno. Need backport.

tags: added: juno-backport-potential
Matt Riedemann (mriedem) on 2015-02-24
tags: removed: juno-backport-potential
Akihiro Motoki (amotoki) on 2015-03-03
Changed in python-neutronclient:
milestone: none → 2.3.11
status: Fix Committed → Fix Released
importance: Undecided → Low

Reviewed: https://review.openstack.org/158435
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=86efb1dac224c94ff9888cd7c15e3c3d96519df8
Submitter: Jenkins
Branch: stable/juno

commit 86efb1dac224c94ff9888cd7c15e3c3d96519df8
Author: zhiyuan_cai <email address hidden>
Date: Fri Jan 23 18:21:17 2015 +0800

    Transform IPAddress to string when creating port

    If ip address is provided when running nova boot, nova compute
    will invoke neutron client to create a port. However, the ip
    address parameter is an IPAddress object so neutron client will
    fail to send the request to neutron server. Transform IPAddress
    object to string to address this issue.

    Conflicts:
     nova/tests/unit/network/test_neutronv2.py

    Change-Id: I858cca475748795aa2532f32bfe0f1443b30966f
    Closes-Bug: #1408529
    (cherry picked from commit aae858a246e20b1bf55004517b5d9ab28968190a)

tags: added: in-stable-juno
Boy Yuan (bo-y-yuan) wrote :

I test https://review.openstack.org/#/c/158435/ for JUNO 2014.2/2014.2.1, only change request.address to str(request.address) for all nova servers(include controll nodes and compute nodes), it work fine, VM can boot with v4-fixed-ip now!

Thierry Carrez (ttx) on 2015-04-30
Changed in nova:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers