3 import sipb_xen_database
7 from invirt.config import structs as config
9 sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
12 p = subprocess.Popen(['/usr/sbin/xm', 'list'], stdout=subprocess.PIPE)
14 output = p.stdout.read()
15 vms = [x.split()[0][2:] for x in output.splitlines() if x.startswith('d_')]
18 def reload_conserver():
19 p = subprocess.Popen(['/etc/init.d/conserver-server', 'reload'], stdout=subprocess.PIPE)
22 if __name__ == '__main__':
23 hostname = socket.getfqdn().lower()
24 realm = config.authn[0].realm
25 principal = 'host/'+hostname+'@'+realm
26 config = '\n'.join('console %s { master %s; }' % (vm, hostname)
28 f = open('/etc/conserver/sipb-xen-consoles.cf', 'w')
32 subprocess.call(['/usr/bin/kinit', '-k', '-t', '/etc/krb5.keytab',
34 subprocess.call(['/usr/bin/remctl', 'sipb-xen-console.mit.edu',
35 'console', 'update', config])