Skip to content

Instantly share code, notes, and snippets.

@thesues
Created January 25, 2022 03:00
Show Gist options
  • Save thesues/2ff091c74ec0abdf8c71eb9959ee1f0a to your computer and use it in GitHub Desktop.
Save thesues/2ff091c74ec0abdf8c71eb9959ee1f0a to your computer and use it in GitHub Desktop.
1. comment out
```python
def call_api(gateway_list, endpoint, element, http_method='put', api_vars=None):
"""
Generic API handler to process a given request across multiple gateways
:param gateway_list: (list)
:param endpoint: (str) http api endpoint name to call
:param element: (str) object to act upon
:param http_method: (str) put or get http method
:param api_vars: (dict) variables to pass to the api call
:return: (str, int) string description and http status code
"""
#target_state = target_ready(gateway_list)
#if target_state.get('status') != 'OK':
# return ('failed, gateway(s) unavailable:'
# '{}'.format(target_state.get('summary'))), 503
```
2. add parameter valid
```python
def call_api(gateway_list, endpoint, element, http_method='put', api_vars=None, valid=true):
```
3. 找2台服务器A,B, 只开启A的gateway, 关闭B的gateway, 修改delete/put 绑定的部分, 调用call_api(valid=false)
4. 这时候应该A服务器配置成功(需要yujiang手动检查), 另一台B没有任何变化
5. 启动另一台B服务器gateway, 看是否某个api可以出发refresh, 然后iscsi配置也同步成功(需要yujiang手动检查)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment