NetApp / ontap-rest-python

This repository contains sample code illustrating how to access the ONTAP REST API using Python. This Repository also contains ONTAPI Usage reporting code that helps to identify ONTAPI usage in your environment using ONTAP REST APIs.
BSD 3-Clause "New" or "Revised" License
62 stars 41 forks source link

'failed to set field "ip_interfaces[0].location.broadcast_domain.name" to "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc"' #35

Closed ashwinwriter closed 2 years ago

ashwinwriter commented 2 years ago

Hi,

Encountered following error while running function 'create' under svm_operations.py. Rest all functions (list/update/start/stop/delete) working as expected.

Here, I am trying to create a SVM for NFS protocol.

[root@centos9 /]# python3.9 svm_operations.py -c 192.168.0.120 -u admin Password:

Demonstrates SVM Operations using REST API:-

What SVM Operation would you like to do? [list/create/update/start/stop/delete] create Enter the name of the SVM: nfs

Would you like to configure an Interface (y/n): y Enter the name of Management LIF: nfs_mgmt Enter the IP address: 192.168.0.40 Enter the NetMask: 255.255.255.0

List of Nodes:-

Node Name :- ontap991-01 Node UUID :- eb0b8287-5848-11ec-b300-000c2951836a Enter the Home Node: ontap991-01 Enter the UUID: eb0b8287-5848-11ec-b300-000c2951836a

Would you like to configure an NFS (y/n): y Would you like to configure an CIFS (y/n): n Would you like to configure an DNS (y/n): n {'name': 'nfs', 'language': 'c.utf_8', 'ipspace': {'name': 'Default'}, 'ip_interfaces': [{'ip': {'address': '192.168.0.40', 'netmask': '255.255.255.0'}, 'location': {'broadcast_domain': {'name': 'Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc'}, 'home_node': {'name': 'ontap991-01', 'uuid': 'eb0b8287-5848-11ec-b300-000c2951836a'}}, 'name': 'nfs_mgmt', 'service_policy': 'default-data-files'}], 'nfs': {'enabled': True}} {'error': {'message': 'failed to set field "ip_interfaces[0].location.broadcast_domain.name" to "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc"', 'code': '2', 'target': 'ip_interfaces[0].location.broadcast_domain.name'}} [root@centos9 /]#

Could you help me resolving this error ?

Many thanks!

RobertBlackhart commented 2 years ago

This is an error being returned from ONTAP. Unfortunately, the message isn't very clear on why. Have you tried other names for the broadcast_domain field? I'm not sure what code 2 will mean. Have you checked the logs on the cluster to see if there is more of an error message there?

ashwinwriter commented 2 years ago

Thanks for the reply. Yes, I did check on the NetApp side there isn't much captured there. I only see Post error under audit log - Error: failed to set field "ip_interfaces[0].location.broadcast_domain.name" to "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc".

Will continue to troubleshoot.

ashwinwriter commented 2 years ago

Issue resolved.

On the NetApp logs: under mgwd.log, it logged: ERR: Table::vserver: Broadcast Domain Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc does not exist.

Possible Cause: Looks like it was looking to create this broadcast domain name which did not exists. Not sure, why _ckjblahblah was added in the first place, b'cos in any case it could not created it. B'cos broadcast should exist before you could assign it and the only one that existed was 'Default'. So ideally it should be whatever that actually exists in your environment.

Steps taken: I looked for this broadcast domain name in the svm_operations.py and found it on the line92: LINE 92: "name": "Default_ckjfbvsnkfdjasbdkfsndlfe_cbekjrvckujeakbxjwc"}

I simply changed it to "Default", and it worked.

root@centos9 /]# python3.9 svm_operations.py -c 192.168.0.120 -u admin Password:

Demonstrates SVM Operations using REST API:-

What SVM Operation would you like to do? [list/create/update/start/stop/delete] create Enter the name of the SVM: test3

Would you like to configure an Interface (y/n): y Enter the name of Management LIF: test3_lif Enter the IP address: 192.168.0.142 Enter the NetMask: 255.255.255.0

List of Nodes:-

Node Name :- ontap991-01 Node UUID :- eb0b8287-5848-11ec-b300-000c2951836a Enter the Home Node: ontap991-01 Enter the UUID: eb0b8287-5848-11ec-b300-000c2951836a

Would you like to configure an NFS (y/n): y

Would you like to configure an CIFS (y/n): n

Would you like to configure an DNS (y/n): n {'name': 'test3', 'language': 'c.utf_8', 'ipspace': {'name': 'Default'}, 'ip_interfaces': [{'ip': {'address': '192.168.0.142', 'netmask': '255.255.255.0'}, 'location': {'broadcast_domain': {'name': 'Default'}, 'home_node': {'name': 'ontap991-01', 'uuid': 'eb0b8287-5848-11ec-b300-000c2951836a'}}, 'name': 'test3_lif', 'service_policy': 'default-data-files'}], 'nfs': {'enabled': True}} Operation completed successfully. [root@centos9 /]#

RobertBlackhart commented 2 years ago

I'm not sure why that example value was used in the example script, but you're right, you need to reference an existing Broadcast Domain name (like "Default"). Changing it to "Default" was the right thing to do for your case.

I think it would help eliminate some confusion to change the checked in script that way too. Do you want to submit your change as a pull request and I can merge that in?

ashwinwriter commented 2 years ago

Thanks Rob for the reply. I really appreciate it. I would like to submit a change as a pull request, but have no idea how to do that. Could you do this ?

RobertBlackhart commented 2 years ago

Done. I've submitted the change so you should be able to sync up to the head of line version of the code and run the script like above with no errors.

ashwinwriter commented 2 years ago

Thanks, Rob.