本文整理汇总了Python中ovirtsdk4.Connection方法的典型用法代码示例。如果您正苦于以下问题:Python ovirtsdk4.Connection方法的具体用法?Python ovirtsdk4.Connection怎么用?Python ovirtsdk4.Connection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovirtsdk4
的用法示例。
在下文中一共展示了ovirtsdk4.Connection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _connect_sdk
# 需要导入模块: import ovirtsdk4 [as 别名]
# 或者: from ovirtsdk4 import Connection [as 别名]
def _connect_sdk(self, url, username, password, ca):
connection = sdk.Connection(
url=url,
username=username,
password=password,
ca_file=ca,
)
return connection
示例2: _connect_sdk
# 需要导入模块: import ovirtsdk4 [as 别名]
# 或者: from ovirtsdk4 import Connection [as 别名]
def _connect_sdk(url, username, password, ca, log_):
connection = sdk.Connection(
url=url,
username=username,
password=password,
ca_file=ca,
debug=True,
log=log_,
)
return connection
示例3: _validate_connection
# 需要导入模块: import ovirtsdk4 [as 别名]
# 或者: from ovirtsdk4 import Connection [as 别名]
def _validate_connection(self,
log,
url,
username,
password,
ca):
conn = None
try:
conn = self._connect_sdk(url,
username,
password,
ca)
dcs_service = conn.system_service().data_centers_service()
dcs_service.list()
except Exception as e:
msg = "Connection to setup has failed. " \
"Please check your cradentials: " \
"\n URL: " + url \
+ "\n USER: " + username \
+ "\n CA file: " + ca
log.error(msg)
print("%s%s%s%s" % (FAIL, PREFIX, msg, END))
log.error("Error: %s", e)
if conn:
conn.close()
return False
return True