Bug 1469733

Summary: metadata update fails if preferered is null as the database schema doesn't allows null value
Product: Red Hat OpenStack Reporter: David Hill <dhill>
Component: openstack-manilaAssignee: Goutham Pacha Ravi <gouthamr>
Status: CLOSED ERRATA QA Contact: Dustin Schoenbrun <dschoenb>
Severity: medium Docs Contact: Don Domingo <ddomingo>
Priority: low    
Version: 10.0 (Newton)CC: dhill, dmaley, eharney, gouthamr, jmelvin, mruzicka, pgrist, scortopa, tbarron
Target Milestone: z9Keywords: Triaged, ZStream
Target Release: 10.0 (Newton)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-manila-3.0.0-12.el7ost Doc Type: Bug Fix
Doc Text:
Cause: When using the ONTAP driver in Manila with Vserver-scoped credentials, the driver cannot retrieve administrator-privileged information from the ONTAP backend, resulting it reporting missing information as Null values. Consequence: Share creation fails on the ONTAP backend when using Vserver-scoped credentials. Fix: The ONTAP driver has been fixed to report missing information appropriately. Result: Share creation succeeds on the ONTAP backend when using Vserver-scoped credentials, in addition to using ONTAP Cluster-scoped credentials.
Story Points: ---
Clone Of:
: 1473704 (view as bug list) Environment:
Last Closed: 2018-09-17 16:59:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Hill 2017-07-11 18:26:14 UTC
Description of problem:
metadata update fails if preferered is null as the database schema doesn't allows null value and here is a patch to fix in in sqlalchemy:


2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/manila/db/sqlalchemy/api.py", line 2481, in share_export_locations_update
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     context, location_ref['uuid'], el.get('metadata'), session=session)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/manila/db/sqlalchemy/api.py", line 164, in wrapper
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 151, in wrapper
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     ectxt.value = e.inner_exc
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     self.force_reraise()
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     six.reraise(self.type_, self.value, self.tb)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 139, in wrapper
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     return f(*args, **kwargs)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/manila/db/sqlalchemy/api.py", line 2571, in export_location_metadata_update
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     meta_ref.save(session=session)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/models.py", line 48, in save
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     session.flush()
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2027, in flush
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     self._flush(objects)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2145, in _flush
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     transaction.rollback(_capture_exception=True)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     compat.reraise(exc_type, exc_value, exc_tb)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 2109, in _flush
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     flush_context.execute()
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     rec.execute(self)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     uow
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     mapper, table, insert)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 800, in _emit_insert_statements
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     execute(statement, params)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     return meth(self, multiparams, params)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     return connection._execute_clauseelement(self, multiparams, params)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     compiled_sql, distilled_params
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     context)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     util.raise_from_cause(newraise, exc_info)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     reraise(type(exception), exception, tb=exc_tb)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     context)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     cursor.execute(statement, parameters)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     self.errorhandler(self, exc, value)
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server   File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server     raise errorclass, errorvalue
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server OperationalError: (_mysql_exceptions.OperationalError) (1048, "Column 'value' cannot be null") [SQL: u'INSERT INTO share_instance_export_locations_metadata (created_at, updated_at, deleted_at, deleted, export_location_id, `key`, value) VALUES (%s, %s, %s, %s, %s, %s, %s)'] [parameters: (datetime.datetime(2017, 7, 11, 18, 10, 14, 927115), datetime.datetime(2017, 7, 11, 18, 10, 14, 901766), None, 0, 21L, 'preferred', None)]
2017-07-11 14:10:14.960 23536 ERROR oslo_messaging.rpc.server 

[root@lab-openstack01 sqlalchemy(keystone_admin)]# diff -u api.py.orig api.py
--- api.py.orig	2017-07-11 13:47:55.591859922 -0400
+++ api.py	2017-07-11 14:15:32.904711884 -0400
@@ -2546,6 +2546,8 @@
         # that will not take effect using one session and we will rewrite,
         # in that case, single record - first one added with this call.
         session = get_session()
+ if not meta_value:
+ meta_value = 'none'
         item = {"value": meta_value, "updated_at": timeutils.utcnow()}

         meta_ref = _export_location_metadata_get_query(




https://bugs.launchpad.net/manila/+bug/1703660

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Install latest manila packages for RHOSP 10 while manila.conf is using a netapp user that doesn't have cluster administration privilege
2.
3.

Actual results:
Fails inserting the share instance metadata in the database

Expected results:
Succeeds in doing so

Additional info:
We live-patched the system with the above patch and we can confirm it works

Comment 1 David Hill 2017-07-11 19:06:21 UTC
The following patch [1] was pushed upstream

[1] https://review.openstack.org/482672

Comment 9 Serena Cortopassi 2018-04-03 15:05:00 UTC
Hi, any update or workaround about this issue?

A customer hit this in production (CASE 02051779), support told us to follow that Bugzilla.

Comment 17 Alex McLeod 2018-09-03 08:02:27 UTC
Hi there,

If this bug requires doc text for errata release, please set the 'Doc Type' and provide draft text according to the template in the 'Doc Text' field.

The documentation team will review, edit, and approve the text.

If this bug does not require doc text, please set the 'requires_doc_text' flag to -.

Thanks,
Alex

Comment 20 errata-xmlrpc 2018-09-17 16:59:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:2671