-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathikvm.py
36 lines (31 loc) · 1.16 KB
/
ikvm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'''Start iKVM to remote access server using IPMI protocol'''
import argparse
import os
def launch_kvm(args):
smcipmitool_dir = os.path.dirname(__file__)
cmd = [
os.path.join(args.jvm, 'bin/java'),
'-Djava.library.path=' + smcipmitool_dir,
'-jar', os.path.join(smcipmitool_dir, 'iKVM.jar'),
args.host, args.user, args.password,
# Not sure what exactly these paramaters mean, but that's what
# used by SMCIPMITool kvm
'null', '5900', '600', '0', '0'
]
os.execv(cmd[0], cmd)
def main():
parser = argparse.ArgumentParser(
description = __doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument('--user', default='ADMIN',
help='username for IPMI access')
parser.add_argument('--password', default='ADMIN',
help='password for IPMI access')
parser.add_argument('--jvm', default='/usr/lib/jvm/lw-oracle-jdk-8',
help='Directory of JVM')
parser.add_argument('host', help='Host to access')
args = parser.parse_args()
launch_kvm(args)
if __name__ == '__main__':
main()