package BOZO_
+const BOSSERVICE_PORT = 7007;
+const BOSSERVICE_ID = 1;
+
/* Error codes */
const BZNOTACTIVE = 39424;
const BZNOENT = 39425;
from afs.lib.cell import cell
return cell(params[0])
+def get_bosserver(switch, params):
+ from afs.lib.bosserver import bosserver
+ return bosserver(params[0])
+
def get_fileserver(switch, params):
from afs.lib.fileserver import fileserver
return fileserver(params[0])
--- /dev/null
+# -*- coding: utf-8 -*-
+
+__copyright__ = """
+Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
+Written by David Howells (dhowells@redhat.com)
+
+Derived from StGIT:
+
+Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
+Copyright (C) 2008, Karl Hasselström <kha@treskal.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public Licence version 2 as
+published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public Licence for more details.
+
+You should have received a copy of the GNU General Public Licence
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+import os
+
+def get_command(mod):
+ """Import and return the given command module."""
+ return __import__(__name__ + '.' + mod, globals(), locals(), ['*'])
+
+def get_command_list():
+ commands = []
+ for p in __path__:
+ for fn in os.listdir(p):
+ if not fn.startswith("_") and fn.endswith('.py'):
+ commands.append(fn[:-3])
+ return commands
+
+def py_commands(commands, f):
+ f.write('command_list = {\n')
+ for key, val in sorted(commands.iteritems()):
+ f.write(' %r: %r,\n' % (key, val))
+ f.write(' }\n')
+
+#def _command_list(commands):
+# for cmd, (mod, help) in commands.iteritems():
+
+def pretty_command_list(commands, f):
+ cmd_len = max(len(cmd) for cmd in commands.iterkeys())
+ for cmd, help in cmds:
+ f.write(' %*s %s\n' % (-cmd_len, cmd, help))
+
+def _write_underlined(s, u, f):
+ f.write(s + '\n')
+ f.write(u*len(s) + '\n')
+
+def asciidoc_command_list(commands, f):
+ for cmd, help in commands:
+ f.write('linkstgsub:%s[]::\n' % cmd)
+ f.write(' %s\n' % help)
+ f.write('\n')
--- /dev/null
+alias = "listhosts"
--- /dev/null
+#
+# AFS Server management toolkit: Report server status
+# -*- coding: utf-8 -*-
+#
+
+__copyright__ = """
+Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
+Written by David Howells (dhowells@redhat.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public Licence version 2 as
+published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public Licence for more details.
+
+You should have received a copy of the GNU General Public Licence
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+from afs.argparse import *
+import kafs
+
+help = "Display the contents of the CellServDB file"
+
+command_arguments = [
+ [ "server", get_bosserver, "rs", "<machine name>" ],
+ [ "cell", get_cell, "os", "<cell name>" ],
+ [ "noauth", get_auth, "fn" ],
+ [ "localauth", get_auth, "fn" ],
+ [ "verbose", get_dummy, "fn" ],
+ [ "encrypt", get_dummy, "fn" ],
+]
+
+cant_combine_arguments = [
+ ( "cell", "localauth" ),
+ ( "noauth", "localauth" ),
+]
+
+description = r"""
+Display the contents of the CellServDB file
+"""
+
+def main(params):
+ cell = params["cell"]
+ bos_conn = cell.open_bos_server(params["server"], params)
+
+ ret = kafs.BOZO_GetCellName(bos_conn)
+ cellname = ret.name
+ print("Cell name is", cellname)
+
+ try:
+ i = 0
+ while True:
+ ret = kafs.BOZO_GetCellHost(bos_conn, i)
+ i += 1
+ print("Host", i, "is", ret.name)
+ except kafs.AbortBZDOM:
+ pass
--- /dev/null
+#
+# AFS Volume management toolkit: BOS server record
+# -*- coding: utf-8 -*-
+#
+
+__copyright__ = """
+Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
+Written by David Howells (dhowells@redhat.com)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public Licence version 2 as
+published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public Licence for more details.
+
+You should have received a copy of the GNU General Public Licence
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+from afs import exception
+from afs.lib.debug import debug
+from afs.lib.server import server
+
+class bosserver(server):
+ """Represents an AFS BOS server. We hold the server address here."""
+ def __init__(self, name):
+ debug("New BosServer", name)
+ server.__init__(self, name)
+
+ def __repr__(self):
+ return "<" + "AFSBOS:" + server.__str_(self) + ">"
kafs.VOLSERVICE_ID,
key, security)
return vol_conn
+
+ # Open a BOS Server connection
+ def open_bos_server(self, server, params=None):
+ key, security = self.determine_security(params)
+
+ debug("Trying", server.addr())
+ bos_conn = kafs.rx_new_connection(server.addr(),
+ kafs.BOSSERVICE_PORT,
+ kafs.BOSSERVICE_ID,
+ key, security)
+ return bos_conn