diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-06-15 18:38:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-06-15 18:38:09 +0000 |
| commit | 0876416ecee44bd60352b41b2372ce048366f59d (patch) | |
| tree | c4b3632cf8d904dbc5e098dd0a4c0236ce9c3c4e | |
| parent | e4b4d3472341a30fc394e5c7e05d2307991711da (diff) | |
| parent | 9e337dac2960bbe8eaa4fbe3a8e5ca3e5e228936 (diff) | |
| download | nova-0876416ecee44bd60352b41b2372ce048366f59d.tar.gz nova-0876416ecee44bd60352b41b2372ce048366f59d.tar.xz nova-0876416ecee44bd60352b41b2372ce048366f59d.zip | |
Merge "Revert "Fix nova-manage backend_add with sr_uuid""
| -rwxr-xr-x | bin/nova-manage | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index ce8a6d794..be1159f54 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -1331,26 +1331,11 @@ class StorageManagerCommands(object): # TODO(renukaapte) Add backend_introduce. ctxt = context.get_admin_context() params = dict(map(self._splitfun, args)) - sr_uuid = utils.gen_uuid() - - if flavor_label is None: - print "error: backend needs to be associated with flavor" - sys.exit(2) - - try: - flavors = db.sm_flavor_get(ctxt, flavor_label) - - except exception.NotFound as ex: - print "error: %s" % ex - sys.exit(2) - - config_params = " ".join(['%s=%s' % - (key, params[key]) for key in params]) if 'sr_uuid' in params: - sr_uuid = params['sr_uuid'] try: - backend = db.sm_backend_conf_get_by_sr(ctxt, sr_uuid) + backend = db.sm_backend_conf_get_by_sr(ctxt, + params['sr_uuid']) except exception.DBError, e: _db_error(e) @@ -1361,24 +1346,38 @@ class StorageManagerCommands(object): if c == 'y' or c == 'Y': try: db.sm_backend_conf_update(ctxt, backend['id'], - dict(created=False, - flavor_id=flavors['id'], - sr_type=sr_type, - config_params=config_params)) + dict(created=False)) except exception.DBError, e: _db_error(e) return else: print 'Backend config not found. Would you like to create it?' + print '(WARNING: Creating will destroy all data on backend!!!)' + c = raw_input('Proceed? (y/n) ') + if c != 'y' and c != 'Y': + return print '(WARNING: Creating will destroy all data on backend!!!)' c = raw_input('Proceed? (y/n) ') if c == 'y' or c == 'Y': + if flavor_label is None: + print "error: backend needs to be associated with flavor" + sys.exit(2) + + try: + flavors = db.sm_flavor_get(ctxt, flavor_label) + except exception.NotFound as ex: + print "error: %s" % ex + sys.exit(2) + + config_params = "".join(['%s=%s ' % + (key, params[key]) for key in params]) + try: db.sm_backend_conf_create(ctxt, dict(flavor_id=flavors['id'], - sr_uuid=sr_uuid, + sr_uuid=None, sr_type=sr_type, config_params=config_params)) except exception.DBError, e: |
