cidr for share-network is set only if neutron subnet provided via creation

Bug #1358707 reported by Valeriy Ponomaryov on 2014-08-19
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Manila
High
Valeriy Ponomaryov

Bug Description

cidr for share-network is set only if neutron subnet provided via creation operation. If we provide it via update operation then this field stay None.

For the moment this field is used by NetApp Cluster Mode driver and causes following error:

2014-08-15 20:23:58.415 ERROR manila.share.manager [req-dbccb555-c101-4c45-a456-b58399dad450 cc674b8857534ab98e10290f44548b75 c1034c6ff2df458fb528a50260ac8cdb] Failed to get share server for share creation.
2014-08-15 20:23:58.428 ERROR oslo.messaging.rpc.dispatcher [req-dbccb555-c101-4c45-a456-b58399dad450 cc674b8857534ab98e10290f44548b75 c1034c6ff2df458fb528a50260ac8cdb] Exception during message handling: unexpected type <type 'Non
eType'> for addr arg
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher incoming.message))
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 177, in _dispatch
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 123, in _do_dispatch
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher result = getattr(endpoint, method)(ctxt, **new_args)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 203, in create_share
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher {'status': 'error'})
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/openstack/common/excutils.py", line 82, in __exit__
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 197, in create_share
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher context, share_network_id, share_id)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 154, in _provide_share_server_for_share
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher return _provide_share_server_for_share()
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/openstack/common/lockutils.py", line 325, in inner
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher return f(*args, **kwargs)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 147, in _provide_share_server_for_share
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher share_server = self._setup_server(context, share_server)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 423, in _setup_server
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher self.network_api.deallocate_network(context, share_network)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/openstack/common/excutils.py", line 82, in __exit__
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/manager.py", line 411, in _setup_server
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher metadata=metadata)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/drivers/netapp/cluster_mode.py", line 223, in setup_server
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher vserver_name = self._vserver_create_if_not_exists(network_info)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/share/drivers/netapp/cluster_mode.py", line 385, in _vserver_create_if_not_exists
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher netmask = utils.cidr_to_netmask(network_info['cidr'])
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/opt/stack/manila/manila/utils.py", line 921, in cidr_to_netmask
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher network = netaddr.IPNetwork(cidr)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 931, in __init__
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher implicit_prefix, flags)
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 826, in parse_ip_network
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher raise TypeError('unexpected type %s for addr arg' % type(addr))
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher TypeError: unexpected type <type 'NoneType'> for addr arg
2014-08-15 20:23:58.428 TRACE oslo.messaging.rpc.dispatcher

tags: added: cmode share-network
Changed in manila:
importance: Undecided → High
Tina Tang (tina-tang) wrote :

The similiar exception was thrown when create the first share with a new share network.

The neutron net information is not saved into manila when creating the share network(see below command output). The neutron net information is fetched during the share server creation, a.k.a. creating first share with this share network.

stack@openstack-tangt1-01:/opt/stack/logs/screen$ manila share-network-show manila-demo1
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| cidr | None |
| created_at | 2014-08-21T00:34:40.000000 |
| description | None |
| id | 88f7c6f7-c088-4e2a-bca0-564a577c56fb |
| ip_version | None |
| name | manila-demo1 |
| network_type | None |
| neutron_net_id | dbd3d4ab-000d-45ea-ae97-49c5ac99cd37 |
| neutron_subnet_id | f7619e24-ab98-4ff6-9dd6-6144a379fb54 |
| project_id | f8842351bf59472ca41f54fe0ffbfbe5 |
| segmentation_id | None |
| status | None |
| updated_at | None |
+-------------------+-------------------------------------

In Manila share manager manila/share/manager.py

   def _setup_server(self, context, share_server, metadata=None):
        share_network = self.db.share_network_get(
            context, share_server['share_network_id']) ==> share network is get from DB here
        try:
            allocation_number = self.driver.get_network_allocations_number()
            if allocation_number:
                self.network_api.allocate_network( ==> The neutron net information is get and save to DB now
                    context, share_server, share_network,
                    count=allocation_number)

            network_info = self._form_server_setup_info(context, share_server,
                                                        share_network) ==> The network info mation is built based on share network read from DB before the neutron net information saved to DB
            server_info = self.driver.setup_server(network_info,
                                                   metadata=metadata)

Changed in manila:
assignee: nobody → Valeriy Ponomaryov (vponomaryov)
status: New → In Progress

Reviewed: https://review.openstack.org/117571
Committed: https://git.openstack.org/cgit/stackforge/manila/commit/?id=ddcb66c2e699262f372e93cdf8d8ee8f028a1caa
Submitter: Jenkins
Branch: master

commit ddcb66c2e699262f372e93cdf8d8ee8f028a1caa
Author: Valeriy Ponomaryov <email address hidden>
Date: Thu Aug 28 19:42:28 2014 +0300

    Update share_network obj after db update

    With first usage of share-network, backend driver receives share_network
    without 'cidr' value for subnet, because obj was gotten before db update
    with 'cidr' value. So we add additional re-get in case network-allocations
    stuff used.

    Change-Id: Id3ae1cbde96c583423943ad72f4879b1a71e942a
    Closes-Bug: #1358707

Changed in manila:
status: In Progress → Fix Committed
Changed in manila:
status: Fix Committed → Fix Released
Changed in manila:
milestone: none → juno-3
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