Report msg error when cannot revert to snapshot
This patch fix bug: when revert volume to snapshot which status is not available, the report msg error, '%s' should be behind snapshot not volume. Change-Id: Ia449f3619837f2050ddfbbbf006451d1aba5014a
This commit is contained in:
parent
c068ce071b
commit
9da0397766
|
@ -363,15 +363,19 @@ class API(base.Base):
|
|||
v_res = volume.update_single_status_where(
|
||||
'reverting', 'available')
|
||||
if not v_res:
|
||||
msg = _("Can't revert volume %s to its latest snapshot. "
|
||||
"Volume's status must be 'available'.") % volume.id
|
||||
msg = (_("Can't revert volume %(vol_id)s to its latest snapshot "
|
||||
"%(snap_id)s. Volume's status must be 'available'.")
|
||||
% {"vol_id": volume.id,
|
||||
"snap_id": snapshot.id})
|
||||
raise exception.InvalidVolume(reason=msg)
|
||||
s_res = snapshot.update_single_status_where(
|
||||
fields.SnapshotStatus.RESTORING,
|
||||
fields.SnapshotStatus.AVAILABLE)
|
||||
if not s_res:
|
||||
msg = _("Can't revert volume %s to its latest snapshot. "
|
||||
"Snapshot's status must be 'available'.") % snapshot.id
|
||||
msg = (_("Can't revert volume %(vol_id)s to its latest snapshot "
|
||||
"%(snap_id)s. Snapshot's status must be 'available'.")
|
||||
% {"vol_id": volume.id,
|
||||
"snap_id": snapshot.id})
|
||||
raise exception.InvalidSnapshot(reason=msg)
|
||||
|
||||
self.volume_rpcapi.revert_to_snapshot(context, volume, snapshot)
|
||||
|
|
Loading…
Reference in New Issue