當前位置: 首頁>>代碼示例>>Python>>正文


Python ovirtsdk4.Connection方法代碼示例

本文整理匯總了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 
開發者ID:oVirt,項目名稱:ovirt-ansible-disaster-recovery,代碼行數:10,代碼來源:validator.py

示例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 
開發者ID:oVirt,項目名稱:ovirt-ansible-disaster-recovery,代碼行數:12,代碼來源:generate_mapping.py

示例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 
開發者ID:oVirt,項目名稱:ovirt-ansible-disaster-recovery,代碼行數:29,代碼來源:generate_vars.py


注:本文中的ovirtsdk4.Connection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。