diff --git a/neo/admin/app.py b/neo/admin/app.py index d8be85d02627dddbedaf8e4a722d83073467c311..58e20498df13947a4f310cd0371a05dfca50b4f3 100644 --- a/neo/admin/app.py +++ b/neo/admin/app.py @@ -50,7 +50,7 @@ class Dispatcher: class Application(object): """The storage node application.""" - def __init__(self, filename, section): + def __init__(self, filename, section, uuid=None): config = ConfigurationManager(filename, section) self.name = config.getName() @@ -69,7 +69,7 @@ class Application(object): # The partition table is initialized after getting the number of # partitions. self.pt = None - self.uuid = None + self.uuid = uuid self.primary_master_node = None self.ptid = None self.monitoring_handler = MasterMonitoringEventHandler(self) diff --git a/neo/master/app.py b/neo/master/app.py index 58e8e680a1b84a496f28e1331065038f0c85d08f..b509066e536fe982ebdb26a114389579fb1d3cbc 100644 --- a/neo/master/app.py +++ b/neo/master/app.py @@ -41,7 +41,7 @@ REQUIRED_NODE_NUMBER = 1 class Application(object): """The master node application.""" - def __init__(self, filename, section): + def __init__(self, filename, section, uuid=None): config = ConfigurationManager(filename, section) self.connector_handler = getConnectorHandler(config.getConnector()) @@ -77,7 +77,9 @@ class Application(object): self.cluster_state = None # Generate an UUID for self - self.uuid = self.getNewUUID(protocol.MASTER_NODE_TYPE) + if uuid is None: + uuid = self.getNewUUID(protocol.MASTER_NODE_TYPE) + self.uuid = uuid # The last OID. self.loid = None diff --git a/neo/storage/app.py b/neo/storage/app.py index b6b1836032cde715276510c9dbbe37d4620d8af4..a03be881419b20996800eb08cae17981b280b99f 100644 --- a/neo/storage/app.py +++ b/neo/storage/app.py @@ -39,10 +39,10 @@ from neo.bootstrap import BootstrapManager class Application(object): """The storage node application.""" - def __init__(self, filename, section, reset=False): + def __init__(self, filename, section, reset=False, uuid=None): config = ConfigurationManager(filename, section) - self.uuid = None + self.uuid = uuid self.name = config.getName() logging.debug('the name is %s', self.name) self.connector_handler = getConnectorHandler(config.getConnector()) diff --git a/neoadmin b/neoadmin index d562bef90ff492d1fb4f3147c77dff97051b5bcf..652f9be339b255d9ed8144c4ffc3aef41d65524a 100755 --- a/neoadmin +++ b/neoadmin @@ -22,6 +22,8 @@ from optparse import OptionParser from neo import setupLog parser = OptionParser() +parser.add_option('-u', '--uuid', help='specify an UUID to use for this ' \ + 'process') parser.add_option('-v', '--verbose', action = 'store_true', help = 'print verbose messages') parser.add_option('-c', '--config', help = 'specify a configuration file') @@ -31,10 +33,13 @@ parser.add_option('-l', '--logfile', help = 'specify a logging file') (options, args) = parser.parse_args() config = options.config or 'neo.conf' section = options.section or 'admin' +uuid = options.uuid +if uuid is not None: + uuid = bin(uuid) logfile = options.logfile or None setupLog(section, logfile, options.verbose) from neo.admin.app import Application -app = Application(config, section) +app = Application(config, section, uuid) app.run() diff --git a/neomaster b/neomaster index 1d9ce365f42f9bd76c58dca64f4e904167b280e7..87b259cc2e8b5d141ca790429caafaafff5f3f89 100755 --- a/neomaster +++ b/neomaster @@ -20,8 +20,11 @@ from optparse import OptionParser from neo import setupLog +from neo.util import bin parser = OptionParser() +parser.add_option('-u', '--uuid', help='specify an UUID to use for this ' \ + 'process') parser.add_option('-v', '--verbose', action = 'store_true', help = 'print verbose messages') parser.add_option('-c', '--config', help = 'specify a configuration file') @@ -31,10 +34,13 @@ parser.add_option('-l', '--logfile', help = 'specify a logging file') (options, args) = parser.parse_args() config = options.config or 'neo.conf' section = options.section or 'master' +uuid = options.uuid +if uuid is not None: + uuid = bin(uuid) logfile = options.logfile or None setupLog(section, logfile, options.verbose) from neo.master.app import Application -app = Application(config, section) +app = Application(config, section, uuid) app.run() diff --git a/neostorage b/neostorage index c6a15e2c59995731fb1cd8add95896787af932fa..efb81274455a5c6a14d28222ad8069a5e65aaabf 100755 --- a/neostorage +++ b/neostorage @@ -23,6 +23,9 @@ from neo import setupLog parser = OptionParser() +parser.add_option('-u', '--uuid', help='specify an UUID to use for this ' \ + 'process. Previously assigned UUID takes precedence (ie ' \ + 'you should always use -R with this switch)') parser.add_option('-v', '--verbose', action = 'store_true', help = 'print verbose messages') parser.add_option('-c', '--config', help = 'specify a configuration file') @@ -34,10 +37,13 @@ parser.add_option('-R', '--reset', action = 'store_true', (options, args) = parser.parse_args() config = options.config or 'neo.conf' section = options.section or 'storage' +uuid = options.uuid +if uuid is not None: + uuid = bin(uuid) logfile = options.logfile or None setupLog(section, logfile, options.verbose) from neo.storage.app import Application -app = Application(config, section, options.reset) +app = Application(config, section, options.reset, uuid=uuid) app.run()