[openstack-dev][CLI] How to set NoneType in openstack CLI's json format string?
Sam
batmanzg at 163.com
Wed Feb 22 01:21:17 UTC 2023
Hi all,
I'm using openstack command like this, and got error:
```
gyw at c1:~$ openstack port create --network selfservice --vnic-type remote-managed \
> --binding-profile '{"pci_vendor_info": None, "pci_slot": None, "physical_network": None, "card_serial_number": "AB0123XX0042", "pf_mac_address": "08:c0:eb:8e:bd:f8", "vf_num":1, "vnic_type": "remote-managed"}' \
> pf0vf0
Expected '<key>=<value>' or JSON data for option --binding-profile, but encountered JSON parsing error: Expecting value: line 1 column 21 (char 20)
```
So how to set "pci_vendor_info" to NoneType of python in openstack CLI's json format string?
BTW, "NoneType of python" means the NoneType in python code, like these comment in https://github.com/openstack/neutron/blob/stable/yoga/neutron/common/ovn/utils.py
```
# With this example param_set:
#
# param_set = {
# 'do_not_check_this_key': None,
# 'pci_slot': [str],
# 'physical_network': [str, type(None)]
# }
#
# We confirm that each binding_profile key is of one of the listed types,
# allowing validation of polymorphic entries.
#
# 'physical_network' is polymorphic because: When a VNIC_REMOTE_MANAGED or
# VNIC_DIRECT with PORT_CAP_SWITCHDEV capability port is attached to a
# project network backed by an overlay (tunneled) network the value will be
# 'None'. For the case of ports attached to a project network backed by
# VLAN the value will be of type ``str``. This comes from Nova and is
# provided in the ``physical_network`` tag in the Nova PCI Passthrough
# configuration.
#
# In the above example the type of the value behind 'do_not_check_this_key'
# will not be checked, 'pci_slot' must be ``str``, 'physical_network must
# be either ``str`` or ``NoneType``.
```
Thank you~
--
Best Regards,
------------------------------------------------
Sam Green
Home Page: http://blog.csdn.net/batmancn
Email:batmanzg at 163.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20230222/13986299/attachment-0001.htm>
More information about the openstack-discuss
mailing list