[Kimchi-devel] [PATCH 2/4] Add volume ref_cnt: Update controller and json schema
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Mon Feb 17 08:38:13 UTC 2014
From: Royce Lv <lvroyce at linux.vnet.ibm.com>
Add ref_cnt to controller to report reference count information.
Update json schema validation.
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
src/kimchi/API.json | 24 ++++++++++++++++++++++++
src/kimchi/control/storagevolumes.py | 1 +
src/kimchi/i18n.py | 3 +++
3 files changed, 28 insertions(+)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index a61e778..77c9f5c 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -131,6 +131,30 @@
}
}
},
+ "storagevolumes_create": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "description": "The name of the Storage Volume",
+ "type": "string",
+ "minLength": 1,
+ "required": true,
+ "error": "KCHVOL0012E"
+ },
+ "allocation": {
+ "description": "The size(MiB) of allocation when create the storage volume",
+ "type": "number",
+ "minimum": 1,
+ "error": "KCHVOL0013E"
+ },
+ "format": {
+ "description": "The format of the volume",
+ "type": "string",
+ "pattern": "^qcow2|raw$",
+ "error": "KCHVOL0014E"
+ }
+ }
+ },
"vms_create": {
"type": "object",
"error": "KCHVM0016E",
diff --git a/src/kimchi/control/storagevolumes.py b/src/kimchi/control/storagevolumes.py
index cd15bcc..b05a5a8 100644
--- a/src/kimchi/control/storagevolumes.py
+++ b/src/kimchi/control/storagevolumes.py
@@ -55,6 +55,7 @@ class StorageVolume(Resource):
'capacity': self.info['capacity'],
'allocation': self.info['allocation'],
'path': self.info['path'],
+ 'ref_cnt': self.info['ref_cnt'],
'format': self.info['format']}
for key in ('os_version', 'os_distro', 'bootable'):
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index b5ed850..b7f4ff5 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -144,6 +144,9 @@ messages = {
"KCHVOL0009E": _("Unable to wipe storage volumes %(name)s. Details: %(err)s"),
"KCHVOL0010E": _("Unable to delete storage volume %(name)s. Details: %(err)s"),
"KCHVOL0011E": _("Unable to resize storage volume %(name)s. Details: %(err)s"),
+ "KCHVOL0012E": _("Storage volume name must be a string"),
+ "KCHVOL0013E": _("Storage volume allocation must be an integer number"),
+ "KCHVOL0014E": _("Storage volume format not supported"),
"KCHIFACE0001E": _("Interface %(name)s does not exist"),
--
1.8.1.2
More information about the Kimchi-devel
mailing list