本文整理汇总了Python中vdsm.vdscli.connect函数的典型用法代码示例。如果您正苦于以下问题:Python connect函数的具体用法?Python connect怎么用?Python connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _boot_from_hd
def _boot_from_hd(self):
# Temporary attach cloud-init no-cloud iso if we have to
if (
self.environment[ohostedcons.VMEnv.BOOT] == 'disk' and
self.environment[ohostedcons.VMEnv.CDROM]
):
self.environment[
ohostedcons.VMEnv.SUBST
]['@[email protected]'] = self.environment[
ohostedcons.VMEnv.CDROM
]
created = False
while not created:
try:
self._create_vm()
created = True
except socket.error as e:
self.logger.debug(
'Error talking with VDSM (%s), reconnecting.' % str(e),
exc_info=True
)
cli = vdscli.connect(
timeout=ohostedcons.Const.VDSCLI_SSL_TIMEOUT
)
self.environment[ohostedcons.VDSMEnv.VDS_CLI] = cli
开发者ID:tiraboschi,项目名称:ovirt-hosted-engine-setup,代码行数:25,代码来源:runvm.py
示例2: _setupVdsConnection
def _setupVdsConnection(self):
if self.hibernating:
return
hostPort = vdscli.cannonizeHostPort(
self._dst,
config.getint('addresses', 'management_port'))
self.remoteHost, port = hostPort.rsplit(':', 1)
try:
client = self._createClient(port)
requestQueues = config.get('addresses', 'request_queues')
requestQueue = requestQueues.split(",")[0]
self._destServer = jsonrpcvdscli.connect(requestQueue, client)
self.log.debug('Initiating connection with destination')
self._destServer.ping()
except (JsonRpcBindingsError, JsonRpcNoResponseError):
if config.getboolean('vars', 'ssl'):
self._destServer = vdscli.connect(
hostPort,
useSSL=True,
TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
else:
self._destServer = kaxmlrpclib.Server('http://' + hostPort)
self.log.debug('Destination server is: ' + hostPort)
开发者ID:mykaul,项目名称:vdsm,代码行数:27,代码来源:migration.py
示例3: start
def start(self):
self.vdscli = vdscli.connect()
self.netinfo = self._get_netinfo()
if config.get('vars', 'net_persistence') == 'unified':
self.config = RunningConfig()
else:
self.config = None
开发者ID:HongweiBi,项目名称:vdsm,代码行数:7,代码来源:utils.py
示例4: _setupVdsConnection
def _setupVdsConnection(self):
if self.hibernating:
return
# FIXME: The port will depend on the binding being used.
# This assumes xmlrpc
hostPort = vdscli.cannonizeHostPort(
self._dst,
config.getint('addresses', 'management_port'))
self.remoteHost, _ = hostPort.rsplit(':', 1)
if config.getboolean('vars', 'ssl'):
self._destServer = vdscli.connect(
hostPort,
useSSL=True,
TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
else:
self._destServer = kaxmlrpclib.Server('http://' + hostPort)
self.log.debug('Destination server is: ' + hostPort)
try:
self.log.debug('Initiating connection with destination')
status = self._destServer.getVmStats(self._vm.id)
if not status['status']['code']:
self.log.error("Machine already exists on the destination")
self.status = errCode['exist']
except Exception:
self.log.exception("Error initiating connection")
self.status = errCode['noConPeer']
开发者ID:HongweiBi,项目名称:vdsm,代码行数:28,代码来源:migration.py
示例5: get_domain_path
def get_domain_path(config_):
"""
Return path of storage domain holding engine vm
"""
vdsm = vdscli.connect()
sd_uuid = config_.get(config.ENGINE, config.SD_UUID)
dom_type = config_.get(config.ENGINE, config.DOMAIN_TYPE)
parent = constants.SD_MOUNT_PARENT
if dom_type == "glusterfs":
parent = os.path.join(parent, "glusterSD")
if dom_type.startswith("nfs"):
response = vdsm.getStorageDomainInfo(sd_uuid)
if response["status"]["code"] == 0:
try:
local_path = response["info"]["remotePath"].replace("/", "_")
path = os.path.join(parent, local_path, sd_uuid)
if os.access(path, os.F_OK):
return path
# don't have remotePath? so fallback to old logic
except KeyError:
pass
# fallback in case of getStorageDomainInfo call fails
# please note that this code will get stuck if some of
# the storage domains is not accessible rhbz#1140824
for dname in os.listdir(parent):
path = os.path.join(parent, dname, sd_uuid)
if os.access(path, os.F_OK):
return path
raise Exception("path to storage domain {0} not found in {1}".format(sd_uuid, parent))
开发者ID:a7179072,项目名称:ovirt-hosted-engine-ha,代码行数:31,代码来源:path.py
示例6: get_fc_lun_tuple_list
def get_fc_lun_tuple_list(self):
# workaround for vdsm check before use vdscli:
if os.system("service vdsmd status|grep 'active (running)' &>/dev/null"):
os.system("service sanlock stop")
os.system("service libvirtd stop")
os.system("service supervdsmd stop")
os.system("vdsm-tool configure")
os.system("service vdsmd restart")
# workaround for imageio-daemon start success
os.system("service ovirt-imageio-daemon restart")
connecting = True
fc_lun_list = []
FC_DOMAIN = 2
while connecting:
try:
cli = vdscli.connect(timeout=900)
devices = cli.getDeviceList(FC_DOMAIN)
connecting = False
except socket_error as serr:
if serr.errno == errno.ECONNREFUSED:
time.sleep(2)
else:
raise serr
if devices['status']['code']:
raise RuntimeError(devices['status']['message'])
for device in devices['devList']:
device_info = "%s %sGiB\n%s %s status: %s" % (
device["GUID"], int(device['capacity']) / pow(2, 30),
device['vendorID'], device['productID'], device["status"],
)
fc_lun_list.append((device_info, None))
return fc_lun_list
开发者ID:spofa,项目名称:eayunos-console,代码行数:32,代码来源:tabhostedengine.py
示例7: _setupVdsConnection
def _setupVdsConnection(self):
if self._mode == 'file': return
self.remoteHost = self._dst.split(':')[0]
# FIXME: The port will depend on the binding being used.
# This assumes xmlrpc
self.remotePort = self._vm.cif.bindings['xmlrpc'].serverPort
try:
self.remotePort = self._dst.split(':')[1]
except:
pass
serverAddress = self.remoteHost + ':' + self.remotePort
if config.getboolean('vars', 'ssl'):
self.destServer = vdscli.connect(serverAddress, useSSL=True,
TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
else:
self.destServer = kaxmlrpclib.Server('http://' + serverAddress)
self.log.debug('Destination server is: ' + serverAddress)
try:
self.log.debug('Initiating connection with destination')
status = self.destServer.getVmStats(self._vm.id)
if not status['status']['code']:
self.log.error("Machine already exists on the destination")
self.status = errCode['exist']
except:
self.log.error("Error initiating connection", exc_info=True)
self.status = errCode['noConPeer']
开发者ID:ekohl,项目名称:vdsm,代码行数:26,代码来源:vm.py
示例8: __init__
def __init__(self):
self.vdscli = vdscli.connect()
self.netinfo = \
netinfo.NetInfo(self.vdscli.getVdsCapabilities()['info'])
if config.get('vars', 'net_persistence') == 'unified':
self.config = RunningConfig()
else:
self.config = None
开发者ID:therealmik,项目名称:vdsm,代码行数:8,代码来源:utils.py
示例9: _connect_to_server
def _connect_to_server(host, port, use_ssl):
host_port = "%s:%s" % (host, port)
try:
return vdscli.connect(host_port, use_ssl)
except socket.error as e:
if e[0] == errno.ECONNREFUSED:
raise ConnectionRefusedError(
"Connection to %s refused" % (host_port,))
raise
开发者ID:fancyKai,项目名称:vdsm,代码行数:9,代码来源:dump_volume_chains.py
示例10: __init__
def __init__(self):
super(XmlRpcVdsmInterface, self).__init__()
try:
self.vdsm_api = vdscli.connect()
response = self.vdsm_api.ping()
self._check_status(response)
except socket.error as e:
self.handle_connection_error(e)
except vdsmException, e:
e.handle_exception()
开发者ID:oVirt,项目名称:mom,代码行数:10,代码来源:vdsmxmlrpcInterface.py
示例11: start
def start(self):
if _JSONRPC_ENABLED:
requestQueues = config.get('addresses', 'request_queues')
requestQueue = requestQueues.split(",")[0]
self.vdscli = jsonrpcvdscli.connect(requestQueue, xml_compat=False)
else:
self.vdscli = vdscli.connect()
self.netinfo = self._get_netinfo()
if config.get('vars', 'net_persistence') == 'unified':
self.config = RunningConfig()
else:
self.config = None
开发者ID:mykaul,项目名称:vdsm,代码行数:12,代码来源:utils.py
示例12: _misc
def _misc(self):
self.logger.info(_('Configuring the management bridge'))
conn = vdscli.connect()
networks = {
self.environment[ohostedcons.NetworkEnv.BRIDGE_NAME]:
vds_info.network(
vds_info.capabilities(conn),
self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]
)
}
_setupNetworks(conn, networks, {}, {'connectivityCheck': False})
_setSafeNetworkConfig(conn)
开发者ID:malysoun,项目名称:ovirt-hosted-engine-setup,代码行数:12,代码来源:bridge.py
示例13: setupclient
def setupclient(useSSL, tsPath,
timeout=sslutils.SOCKET_DEFAULT_TIMEOUT):
server = TestServer(useSSL, tsPath)
server.start()
hostPort = '0:' + str(server.port)
client = vdscli.connect(hostPort=hostPort,
useSSL=useSSL,
tsPath=tsPath,
timeout=timeout)
try:
yield client
finally:
server.stop()
开发者ID:fancyKai,项目名称:vdsm,代码行数:13,代码来源:vdscliTests.py
示例14: get_fc_lun_tuple_list
def get_fc_lun_tuple_list(self):
cli = vdscli.connect(timeout=900)
fc_lun_list = []
FC_DOMAIN = 2
devices = cli.getDeviceList(FC_DOMAIN)
if devices['status']['code'] != 0:
raise RuntimeError(devices['status']['message'])
for device in devices['devList']:
device_info = "%s %sGiB\n%s %s status: %s" % (
device["GUID"], int(device['capacity']) / pow(2, 30),
device['vendorID'], device['productID'], device["status"],
)
fc_lun_list.append((device_info, None))
return fc_lun_list
开发者ID:walteryang47,项目名称:eayunos-console,代码行数:14,代码来源:tabhostedengine.py
示例15: _connect
def _connect(self):
cli = vdscli.connect(timeout=ohostedcons.Const.VDSCLI_SSL_TIMEOUT)
self.environment[ohostedcons.VDSMEnv.VDS_CLI] = cli
vdsmReady = False
retry = 0
while not vdsmReady and retry < self.MAX_RETRY:
retry += 1
try:
hwinfo = cli.getVdsHardwareInfo()
self.logger.debug(str(hwinfo))
if hwinfo['status']['code'] == 0:
vdsmReady = True
else:
self.logger.info(_('Waiting for VDSM hardware info'))
time.sleep(1)
except socket.error:
self.logger.info(_('Waiting for VDSM hardware info'))
time.sleep(1)
开发者ID:tiraboschi,项目名称:ovirt-hosted-engine-setup,代码行数:18,代码来源:vdsmenv.py
示例16: testKSM
def testKSM(self):
run = 1
pages_to_scan = random.randint(100, 200)
# Set a simple MOM policy to change KSM paramters unconditionally.
testPolicyStr = """
(Host.Control "ksm_run" %d)
(Host.Control "ksm_pages_to_scan" %d)""" % \
(run, pages_to_scan)
s = vdscli.connect()
r = s.setMOMPolicy(testPolicyStr)
self.assertEqual(r['status']['code'], 0, str(r))
# Wait for the policy taking effect
time.sleep(10)
hostStats = s.getVdsStats()['info']
self.assertEqual(bool(run), hostStats['ksmState'])
self.assertEqual(pages_to_scan, hostStats['ksmPages'])
开发者ID:hackxay,项目名称:vdsm,代码行数:19,代码来源:momTests.py
示例17: _setupVdsConnection
def _setupVdsConnection(self):
if self.hibernating:
return
# FIXME: The port will depend on the binding being used.
# This assumes xmlrpc
hostPort = vdscli.cannonizeHostPort(
self._dst,
config.getint('addresses', 'management_port'))
self.remoteHost, _ = hostPort.rsplit(':', 1)
if config.getboolean('vars', 'ssl'):
self._destServer = vdscli.connect(
hostPort,
useSSL=True,
TransportClass=kaxmlrpclib.TcpkeepSafeTransport)
else:
self._destServer = kaxmlrpclib.Server('http://' + hostPort)
self.log.debug('Destination server is: ' + hostPort)
开发者ID:txomon,项目名称:vdsm,代码行数:19,代码来源:migration.py
示例18: _boot_from_install_media
def _boot_from_install_media(self):
# Need to be done after firewall closeup for allowing the user to
# connect from remote.
os_installed = False
self._create_vm()
while not os_installed:
try:
os_installed = check_liveliness.manualSetupDispatcher(
self,
check_liveliness.MSD_OS_INSTALLED,
)
except socket.error as e:
self.logger.debug(
'Error talking with VDSM (%s), reconnecting.' % str(e),
exc_info=True
)
cli = vdscli.connect(
timeout=ohostedcons.Const.VDSCLI_SSL_TIMEOUT
)
self.environment[ohostedcons.VDSMEnv.VDS_CLI] = cli
开发者ID:tiraboschi,项目名称:ovirt-hosted-engine-setup,代码行数:20,代码来源:runvm.py
示例19: __connect__
def __connect__( self ):
''''Connect VDSM, default connect local VDSM'''
return vdscli.connect()
开发者ID:leogao,项目名称:ovirt_test,代码行数:3,代码来源:vdsm_storage.py
示例20: sync_mgmt
def sync_mgmt():
"""Guess mgmt interface and update TUI config
FIXME: Autoinstall should write MANAGED_BY and MANAGED_IFNAMES
into /etc/defaults/ovirt
"""
engine_data = None
cfg = NodeManagement().retrieve()
mgmtIface = []
try:
cli = vdscli.connect()
networks = cli.getVdsCapabilities()['info']['networks']
for net in networks:
if net in ('ovirtmgmt', 'rhevm'):
if 'bridge' in networks[net]:
mgmtIface = [networks[net]['bridge']]
else:
mgmtIface = [networks[net]['iface']]
except socket_error as err:
if err.errno == errno.ECONNREFUSED:
LOGGER.debug("Connection refused with VDSM", exc_info=True)
elif err.errno == errno.ENETUNREACH:
LOGGER.debug("Network is unreachable to reach VDSM", exc_info=True)
else:
LOGGER.error("Catching exception:", exc_info=True)
except KeyError as err:
LOGGER.error("Cannot collect network data!", exc_info=True)
except Exception as err:
if 'No permission to read file:' in str(err):
LOGGER.debug("pem files not available yet!", exc_info=True)
else:
LOGGER.error("Catching exception:", exc_info=True)
if cfg["mserver"] is not None and validate_server(cfg["mserver"]):
cfg["mserver"], cfg["mport"] = cfg["mserver"].split(":")
if cfg["mserver"] is not None and cfg["mserver"] != "None" and \
cfg["mserver"] != "":
server_url = [unicode(info) for info in [cfg["mserver"],
cfg["mport"]] if info]
port, sslPort = compatiblePort(cfg["mport"])
if sslPort:
proto = "https"
else:
proto = "http"
engine_data = '"%s %s://%s"' % (
config.engine_name,
proto,
":".join(server_url)
)
if cfg['mserver'] == 'None' or cfg['mserver'] is None:
cfg['mserver'] = ""
if cfg['mport'] == 'None':
cfg['mport'] = config.ENGINE_PORT
# Update the /etc/defaults/ovirt file
_hack_to_workaround_pyaug_issues(mgmtIface, cfg, engine_data)
开发者ID:oVirt,项目名称:ovirt-node-plugin-vdsm,代码行数:62,代码来源:engine_page.py
注:本文中的vdsm.vdscli.connect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论