【问题标题】:How to FIX "ovirtsdk4.Error: Error while sending HTTP request:" error in oVirt如何修复 oVirt 中的“ovirtsdk4.Error:发送 HTTP 请求时出错:”错误
【发布时间】:2019-04-23 04:08:13
【问题描述】:

我想通过Python API接口备份服务器上的VM,我通过ovirt-engine备份VM。如何使用 Ovirtsdk4 进行备份?

试了很多次,还是报错

import logging
import ovirtsdk4 as sdk

logging.basicConfig(level=logging.DEBUG, filename='example.log')

def get_connection():
    # Create the connection to the server:
    return sdk.Connection(
        url='https://172.32.42.75/ovirt-engine/api',
        username='admin@internal',
        password='password',
        ca_file='/etc/pki/ovirt-engine/ca.pem',
        debug=True,
        log=logging.getLogger(),
    )

if __name__ == "__main__":

    # Set VM name
    vm_name = 'myvm'

    # Create a connection to the server:
    connection = get_connection()

    # Get a reference to the root service:
    system_service = connection.system_service()

    # Get the reference to the "vms" service:
    vms_service = system_service.vms_service()

    # Locate VM service
    try:
        vm = vms_service.list(search="name=%s" % vm_name, all_content=True)[0]
        ovf_filename = "%s.ovf" % vm.id
        with open(ovf_filename, "wb") as ovf_file:
            ovf_file.write(vm.initialization.configuration.data)
    finally:
        # Close the connection to the server:
        connection.close()

我希望执行备份的虚拟机可以使用 Python API oVirt 正常运行。error of ovirtsdk4

【问题讨论】:

    标签: python python-2.7


    【解决方案1】:

    我认为错误可能是由于较旧的 curl。请更新 curl、libcurl 和 NSS 库,然后重试。

    参考:curl: (35) SSL connect error

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-13
      • 1970-01-01
      • 2019-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-09
      相关资源
      最近更新 更多