当前位置: 首页>>代码示例>>Python>>正文


Python API.get_product_info方法代码示例

本文整理汇总了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
开发者ID:nijinashok,项目名称:ovirt-log-collector,代码行数:27,代码来源:hypervisors.py

示例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
开发者ID:fatherlinux,项目名称:service-cart,代码行数:11,代码来源:helpers.py

示例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:
开发者ID:abradshaw,项目名称:ovirt-api-scriptlets,代码行数:33,代码来源:add_pm.py


注:本文中的ovirtsdk.api.API.get_product_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。