我想通过pythonapi接口备份服务器上的VM,并通过ovirt引擎备份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()
我希望执行备份的VM可以使用pythonapi oVirt正常运行。error of ovirtsdk4
我想错误可能是因为旧卷曲。请更新curl、libcurl和NSS库,然后重试。你知道吗
参考号:curl: (35) SSL connect error
相关问题 更多 >
编程相关推荐