本文整理汇总了Python中vdsm.commands.execCmd函数的典型用法代码示例。如果您正苦于以下问题:Python execCmd函数的具体用法?Python execCmd怎么用?Python execCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execCmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: check_brctl
def check_brctl():
try:
execCmd([EXT_BRCTL, "show"])
except OSError as e:
if e.errno == errno.ENOENT:
raise SkipTest("Cannot run %r: %s\nDo you have bridge-utils "
"installed?" % (EXT_BRCTL, e))
raise
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:8,代码来源:nettestlib.py
示例2: removeBridge
def removeBridge(self, bridge):
DynamicSourceRoute.addInterfaceTracking(bridge)
ifdown(bridge.name)
self._removeSourceRoute(bridge, StaticSourceRoute)
commands.execCmd([constants.EXT_BRCTL, 'delbr', bridge.name])
self.configApplier.removeBridge(bridge.name)
if bridge.port:
bridge.port.remove()
开发者ID:mykaul,项目名称:vdsm,代码行数:8,代码来源:ifcfg.py
示例3: stop_devices
def stop_devices(device_ifcfgs):
for dev in reversed(_sort_device_ifcfgs(device_ifcfgs)):
ifdown(dev)
if os.path.exists("/sys/class/net/%s/bridge" % dev):
# ifdown is not enough to remove nicless bridges
commands.execCmd([constants.EXT_BRCTL, "delbr", dev])
if _is_bond_name(dev):
if _is_running_bond(dev):
with open(netinfo_bonding.BONDING_MASTERS, "w") as f:
f.write("-%s\n" % dev)
开发者ID:nirs,项目名称:vdsm,代码行数:10,代码来源:ifcfg.py
示例4: removeBridge
def removeBridge(self, bridge):
if not self.owned_device(bridge.name):
IfcfgAcquire.acquire_device(bridge.name)
DynamicSourceRoute.addInterfaceTracking(bridge)
ifdown(bridge.name)
self._removeSourceRoute(bridge, StaticSourceRoute)
commands.execCmd([constants.EXT_BRCTL, "delbr", bridge.name])
self.configApplier.removeBridge(bridge.name)
if bridge.port:
bridge.port.remove()
开发者ID:nirs,项目名称:vdsm,代码行数:10,代码来源:ifcfg.py
示例5: teardown
def teardown(self):
ovsdb = create()
bridges = ovsdb.list_bridge_info().execute()
with ovsdb.transaction() as t:
for bridge in bridges:
if bridge in TEST_BRIDGES:
t.add(ovsdb.del_br(bridge['name']))
if not self.ovs_init_state_is_up:
execCmd([OVS_CTL, 'stop'])
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:11,代码来源:ovsnettestlib.py
示例6: configureNic
def configureNic(self, nic, **opts):
DynamicSourceRoute.addInterfaceTracking(nic)
self.configApplier.setIfaceConfigAndUp(nic)
self._addSourceRoute(nic)
ethtool_opts = getEthtoolOpts(nic.name)
if ethtool_opts:
# We ignore ethtool's return code to maintain initscripts'
# behaviour.
execCmd(
[_ETHTOOL_BINARY.cmd, '-K', nic.name] + ethtool_opts.split())
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:11,代码来源:iproute2.py
示例7: volumeStatvfs
def volumeStatvfs(volumeName, host=GLUSTER_VOL_HOST,
port=GLUSTER_VOL_PORT,
protocol=GLUSTER_VOL_PROTOCOL):
module = "gluster.gfapi"
command = [constants.EXT_PYTHON, '-m', module, '-v', volumeName,
'-p', str(port), '-H', host, '-t', protocol, '-c', 'statvfs']
# to include /usr/share/vdsm in python path
env = os.environ.copy()
env['PYTHONPATH'] = "%s:%s" % (
env.get("PYTHONPATH", ""), constants.P_VDSM)
env['PYTHONPATH'] = ":".join(map(os.path.abspath,
env['PYTHONPATH'].split(":")))
rc, out, err = commands.execCmd(command, raw=True, env=env)
if rc != 0:
raise ge.GlfsStatvfsException(rc, [out], [err])
res = json.loads(out)
return os.statvfs_result((res['f_bsize'],
res['f_frsize'],
res['f_blocks'],
res['f_bfree'],
res['f_bavail'],
res['f_files'],
res['f_ffree'],
res['f_favail'],
res['f_flag'],
res['f_namemax']))
开发者ID:yingyun001,项目名称:vdsm,代码行数:28,代码来源:gfapi.py
示例8: start
def start(self):
cmd = [_IPERF3_BINARY.cmd, '--server', '--bind', self._bind_to]
if self._net_ns is not None:
p = netns_exec(self._net_ns, cmd)
else:
p = execCmd(cmd, sync=False)
self._pid = p.pid
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:7,代码来源:nettestlib.py
示例9: docker_net_inspect
def docker_net_inspect(self, network):
return commands.execCmd([
self._exes.docker.cmd,
'network',
'inspect',
network,
], raw=True)
开发者ID:EdDev,项目名称:vdsm,代码行数:7,代码来源:conttestlib.py
示例10: testSudo
def testSudo(self, cmd):
checkSudo(['echo'])
rc, out, _ = commands.execCmd(cmd(('grep',
'Uid', '/proc/self/status')),
sudo=True)
self.assertEquals(rc, 0)
self.assertEquals(int(out[0].split()[2]), 0)
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:7,代码来源:commands_test.py
示例11: _systemctl
def _systemctl(*args):
cmd = [_SYSTEMCTL.cmd]
cmd.extend(args)
rc, out, err = commands.execCmd(cmd, raw=True)
if rc != 0:
raise cmdutils.Error(cmd=cmd, rc=rc, out=out, err=err)
return out
开发者ID:EdDev,项目名称:vdsm,代码行数:7,代码来源:lvm.py
示例12: _echo
def _echo(self, text):
proc = commands.execCmd(["echo", "-n", "test"], sync=False)
def parse(rc, out, err):
return out
return utils.AsyncProcessOperation(proc, parse)
开发者ID:yingyun001,项目名称:vdsm,代码行数:7,代码来源:utilsTests.py
示例13: _execCmd
def _execCmd(command):
returnCode, output, error = execCmd(command)
if returnCode:
raise IPRoute2Error(error)
return output
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:7,代码来源:ipwrapper.py
示例14: _start_virt_v2v
def _start_virt_v2v(self):
return execCmd(self._command(),
sync=False,
deathSignal=signal.SIGTERM,
nice=NICENESS.HIGH,
ioclass=IOCLASS.IDLE,
env=self._environment())
开发者ID:kanalun,项目名称:vdsm,代码行数:7,代码来源:v2v.py
示例15: testV2VOutput
def testV2VOutput(self):
cmd = [FAKE_VIRT_V2V.cmd,
'-v',
'-x',
'-ic', self.vpx_url,
'-o', 'vdsm',
'-of', 'raw',
'-oa', 'sparse',
'--vdsm-image-uuid', self.image_id_a,
'--vdsm-vol-uuid', self.volume_id_a,
'--vdsm-image-uuid', self.image_id_b,
'--vdsm-vol-uuid', self.volume_id_b,
'--password-file', '/tmp/mypass',
'--vdsm-vm-uuid', self.job_id,
'--vdsm-ovf-output', '/usr/local/var/run/vdsm/v2v',
'--machine-readable',
'-os', '/rhev/data-center/%s/%s' % (self.pool_id,
self.domain_id),
self.vm_name]
rc, output, error = execCmd(cmd, raw=True)
self.assertEqual(rc, 0)
with open('fake-virt-v2v.out', 'r') as f:
self.assertEqual(output, f.read())
with open('fake-virt-v2v.err', 'r') as f:
self.assertEqual(error, f.read())
开发者ID:EdDev,项目名称:vdsm,代码行数:28,代码来源:v2v_test.py
示例16: start
def start(self, interface, dhcp_range_from=None, dhcp_range_to=None,
dhcpv6_range_from=None, dhcpv6_range_to=None, router=None,
ipv6_slaac_prefix=None):
# --dhcp-authoritative The only DHCP server on network
# -p 0 don't act as a DNS server
# --dhcp-option=3,<router> advertise a specific gateway (or None)
# --dhcp-option=6 don't reply with any DNS servers
# -d don't daemonize and log to stderr
# --bind-dynamic bind only the testing veth iface
command = [
_DNSMASQ_BINARY.cmd, '--dhcp-authoritative',
'-p', '0',
'--dhcp-option=3' + (',{0}'.format(router) if router else ''),
'--dhcp-option=6',
'-i', interface, '-I', 'lo', '-d', '--bind-dynamic',
]
if dhcp_range_from and dhcp_range_to:
command += ['--dhcp-range={0},{1},2m'.format(dhcp_range_from,
dhcp_range_to)]
if dhcpv6_range_from and dhcpv6_range_to:
command += ['--dhcp-range={0},{1},2m'.format(dhcpv6_range_from,
dhcpv6_range_to)]
if ipv6_slaac_prefix:
command += ['--enable-ra']
command += ['--dhcp-range={0},slaac,2m'.format(ipv6_slaac_prefix)]
self.proc = execCmd(command, sync=False)
sleep(_START_CHECK_TIMEOUT)
if self.proc.returncode:
raise DhcpError('Failed to start dnsmasq DHCP server.\n%s\n%s' %
(''.join(self.proc.stderr), ' '.join(command)))
开发者ID:andrewlukoshko,项目名称:vdsm,代码行数:32,代码来源:dhcp.py
示例17: volumeEmptyCheck
def volumeEmptyCheck(volumeName, host=GLUSTER_VOL_HOST, port=GLUSTER_VOL_PORT, protocol=GLUSTER_VOL_PROTOCOL):
module = "gluster.gfapi"
command = [
constants.EXT_PYTHON,
"-m",
module,
"-v",
volumeName,
"-p",
str(port),
"-H",
host,
"-t",
protocol,
"-c",
"readdir",
]
# to include /usr/share/vdsm in python path
env = os.environ.copy()
env["PYTHONPATH"] = "%s:%s" % (env.get("PYTHONPATH", ""), constants.P_VDSM)
env["PYTHONPATH"] = ":".join(map(os.path.abspath, env["PYTHONPATH"].split(":")))
rc, out, err = commands.execCmd(command, raw=True, env=env)
if rc != 0:
raise ge.GlusterVolumeEmptyCheckFailedException(rc, [out], [err])
return out.upper() == "TRUE"
开发者ID:nirs,项目名称:vdsm,代码行数:27,代码来源:gfapi.py
示例18: _fail
def _fail(self, t):
proc = commands.execCmd(["sleep", str(t)], sync=False)
def parse(rc, out, err):
raise Exception("TEST!!!")
return utils.AsyncProcessOperation(proc, parse)
开发者ID:yingyun001,项目名称:vdsm,代码行数:7,代码来源:utilsTests.py
示例19: passwd_isconfigured
def passwd_isconfigured():
script = (str(_SASLDBLISTUSERS2), '-f', _LIBVIRT_SASLDB)
_, out, _ = commands.execCmd(script)
for user in out:
if SASL_USERNAME in user:
return YES
return NO
开发者ID:EdDev,项目名称:vdsm,代码行数:7,代码来源:passwd.py
示例20: snapshotScheduleDisable
def snapshotScheduleDisable():
command = [_snapSchedulerPath.cmd, "disable_force"]
rc, out, err = commands.execCmd(command)
if rc not in [0, SNAP_SCHEDULER_ALREADY_DISABLED_RC]:
raise ge.GlusterDisableSnapshotScheduleFailedException(
rc)
return True
开发者ID:kanalun,项目名称:vdsm,代码行数:7,代码来源:api.py
注:本文中的vdsm.commands.execCmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论