本文整理汇总了Python中ovirtsdk.api.API.get_product_info方法的典型用法代码示例。如果您正苦于以下问题:Python API.get_product_info方法的具体用法?Python API.get_product_info怎么用?Python API.get_product_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovirtsdk.api.API
的用法示例。
在下文中一共展示了API.get_product_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initialize_api
# 需要导入模块: from ovirtsdk.api import API [as 别名]
# 或者: from ovirtsdk.api.API import get_product_info [as 别名]
def _initialize_api(hostname, username, password, ca, insecure):
"""
Initialize the oVirt RESTful API
"""
url = 'https://{hostname}/ovirt-engine/api'.format(
hostname=hostname,
)
api = API(url=url,
username=username,
password=password,
ca_file=ca,
validate_cert_chain=not insecure)
pi = api.get_product_info()
if pi is not None:
vrm = '%s.%s.%s' % (
pi.get_version().get_major(),
pi.get_version().get_minor(),
pi.get_version().get_revision()
)
logging.debug("API Vendor(%s)\tAPI Version(%s)" % (
pi.get_vendor(), vrm)
)
else:
api.test(throw_exception=True)
return api
示例2: get_connection
# 需要导入模块: from ovirtsdk.api import API [as 别名]
# 或者: from ovirtsdk.api.API import get_product_info [as 别名]
def get_connection(location):
api = API( url="https://" + locations.get(location, "host"),
username=locations.get(location, "username"),
password=locations.get(location, "password"),
ca_file=locations.get(location, "certificate")
)
print "Connected to %s successfully!" % api.get_product_info().name
return api
示例3: API
# 需要导入模块: from ovirtsdk.api import API [as 别名]
# 或者: from ovirtsdk.api.API import get_product_info [as 别名]
from ovirtsdk.api import API
from ovirtsdk.xml import params
VERSION = params.Version(major='3', minor='5')
URL = 'https://rhevm.example.com/ovirt-engine/api'
CA = '/etc/pki/ovirt-engine/ca.pem'
USERNAME = '[email protected]'
PASSWORD = 'paSSwoRD'
HOST_NAME = 'rhevh1'
PM_ADDRESS = '192.168.101.11'
try:
api = API(url=URL, username=USERNAME, password=PASSWORD, ca_file=CA)
print "Connected to %s successfully!" % api.get_product_info().name
except Exception as err:
print "Connection failed: %s" % err
try:
host = api.hosts.get(HOST_NAME)
pm = host.get_power_management()
pm.set_type('ilo')
pm.set_enabled(True)
pm.set_address(PM_ADDRESS)
pm.set_username('root')
pm.set_password('Secret')
host.update()
except Exception as err: