Converts volumes status models into namespace dict

* Allows continued use of statuses as enums while allowing
   them to be iterated through (like a dictionary).

Change-Id: I9a9c95e4611fe7fc1ef0ee498df8fa9df55a9279
This commit is contained in:
Jose Idar 2014-10-22 07:41:43 -05:00
parent b2abf89f3e
commit 2f6690d3cb
1 changed files with 13 additions and 14 deletions

View File

@ -13,20 +13,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cafe.configurator.managers import _NamespaceDict
_CommonStatus = _NamespaceDict(**dict(
AVAILABLE="available",
DELETING="deleting",
CREATING="creating",
ERROR="error",
ERROR_DELETING="error_deleting"))
class _CommonStatus(object):
AVAILABLE = "available"
DELETING = "deleting"
CREATING = "creating"
ERROR = "error"
ERROR_DELETING = "error_deleting"
Volume = _NamespaceDict(**dict(
ATTACHING="attaching",
IN_USE="in-use"))
Volume.update(_CommonStatus)
class Volume(_CommonStatus):
ATTACHING = "attaching"
IN_USE = "in-use"
class Snapshot(_CommonStatus):
pass
Snapshot = _NamespaceDict()
Snapshot.update(_CommonStatus)