emc-openstack / storops

Python storage management library for VNX and Unity.
Apache License 2.0
53 stars 29 forks source link

Issue with cifsserver filter #370

Closed shenda1 closed 2 years ago

shenda1 commented 2 years ago
resp = conn.get_cifs_server(netbios_name='netbios_name')
print(resp._get_properties())

For the CIFS server filter, every parameter in the response is converted to a list, though parameters like name and id are only strings.

print(conn.get_cifs_server(_id='cifs_id'))

The above code is working fine, which retrieves the details using ID.

I have verified this with CG filter. It's working fine.

Response with Filter {'hash': -9223363257734933921, 'description': [None], 'domain': [None], 'file_interfaces': [{'UnityFileInterfaceList': [{'UnityFileInterface': {'hash': -9223363257735463634, 'id': 'if_43'}}]}], 'health': [{'UnityHealth': {'hash': 8779119841912}}], 'id': ['cifs_82'], 'is_standalone': [True], 'last_used_organizational_unit': [None], 'name': [None], 'nas_server': [{'UnityNasServer': {'hash': 8779125451598, 'id': 'nas_18'}}], 'netbios_name': ['ANSIBLE_CIFS'], 'smb_multi_channel_supported': [True], 'smb_protocol_versions': [['1.0', '2.0', '2.1', '3.0']], 'smbca_supported': [True], 'workgroup': ['ANSIBLE'], 'existed': True}

Response using CIFS server ID {'hash': 8758618742115, 'description': None, 'domain': None, 'file_interfaces': {'UnityFileInterfaceList': [{'UnityFileInterface': {'hash': -9223363278232559409, 'id': 'if_43'}}]}, 'health': {'UnityHealth': {'hash': -9223363278236637966}}, 'id': 'cifs_82', 'is_standalone': True, 'last_used_organizational_unit': None, 'name': None, 'nas_server': {'UnityNasServer': {'hash': -9223363278232558062, 'id': 'nas_18'}}, 'netbios_name': 'ANSIBLE_CIFS', 'smb_multi_channel_supported': True, 'smb_protocol_versions': ['1.0', '2.0', '2.1', '3.0'], 'smbca_supported': True, 'workgroup': 'ANSIBLE', 'existed': True}

Can you please look into this?

yong-huang commented 2 years ago

Please don't call _get_properties() directly. You should change your code to:

resp = conn.get_cifs_server(netbios_name='netbios_name')[0]
print(resp)

The result looks like:

{
  "UnityCifsServer": {
    "existed": true,
    "file_interfaces": {
      "UnityFileInterfaceList": [
        {
          "UnityFileInterface": {
            "hash": 100747516971,
            "id": "if_62"
          }
        }
      ]
    },
    "hash": 100747506728,
    "health": {
      "UnityHealth": {
        "hash": 100747506743
      }
    },
    "id": "cifs_21",
    "is_standalone": true,
    "nas_server": {
      "UnityNasServer": {
        "hash": 100746004057,
        "id": "nas_210"
      }
    },
    "netbios_name": "TEST-NETBIOS-2",
    "smb_multi_channel_supported": true,
    "smb_protocol_versions": [
      "1.0",
      "2.0",
      "2.1",
      "3.0"
    ],
    "smbca_supported": true,
    "workgroup": "TEST-WG-2"
  }
}
yong-huang commented 2 years ago

Not a valid issue, close it.