代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/openstack-nova 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/python2
import os
import sys
import syslog
command = os.environ.get('SSH_ORIGINAL_COMMAND')
ssh_connection = os.environ.get('SSH_CONNECTION')
if command is None:
sys.stderr.write('This command must be run via SSH ForceCommand (see man 5 sshd_config).\n')
sys.exit(1)
syslog.openlog('nova_migration_wrapper')
def allow_command(user, args):
syslog.syslog(syslog.LOG_INFO, "Allowing connection='{}' command={} ".format(
ssh_connection,
repr(args)
))
os.execlp('sudo', 'sudo', '-u', user, *args)
def deny_command(args):
syslog.syslog(syslog.LOG_ERR, "Denying connection='{}' command={}".format(
ssh_connection,
repr(args)
))
sys.stderr.write('Forbidden\n')
sys.exit(1)
# Handle libvirt ssh tunnel script snippet
# https://github.com/libvirt/libvirt/blob/f0803dae93d62a4b8a2f67f4873c290a76d978b3/src/rpc/virnetsocket.c#L890
libvirt_sock = '/var/run/libvirt/libvirt-sock'
live_migration_tunnel_cmd = "sh -c 'if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " \
"ARG=-q0;" \
"else " \
"ARG=;" \
"fi;" \
"'nc' $ARG -U {}'".format(libvirt_sock)
cold_migration_root = '/var/lib/nova/instances/'
cold_migration_cmds = [
['mkdir', '-p'],
['rm', '-rf'],
['touch'],
['rm'],
['scp', '-r', '-t'],
['scp', '-r', '-f'],
['scp', '-t'],
['scp', '-f'],
]
rootwrap_args = ['/usr/bin/nova-rootwrap', '/etc/nova/migration/rootwrap.conf']
def validate_cold_migration_cmd(args):
target_path = os.path.normpath(args[-1])
cmd = args[:-1]
return cmd in cold_migration_cmds and target_path.startswith(cold_migration_root)
# Rules
args = command.split(' ')
if command == live_migration_tunnel_cmd:
args = ['nc', '-U', libvirt_sock]
allow_command('nova', args)
if validate_cold_migration_cmd(args):
args = rootwrap_args + args
allow_command('root', args)
deny_command(args)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。