Revert "Fix nova-manage backend_add with sr_uuid"
Fixes bug 988596 Change 77495cfe breaks storage manager, as it makes a wrong assumption about nova-manage. The sr-uuid must be generated and provided by the xenapi storage manager. When the volume service is started, SM volume driver will create a new SR for everything that does not have an existing sr_uuid and will populate the db with the result. It will only introduce the SRs that do have one. The introduce will work only if the uuid provided is something SM understands. This partially reverts commit 77495cfed17f12f225e11fbc10e0f8db516dadf2. Changes in db are left intact. Change-Id: I8405ac905a15f829f704951b94297f3b6f6c0a29
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user