On 02/25/2014 05:35 AM, lvroyce(a)linux.vnet.ibm.com wrote:
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Add ref_cnt to controller to report reference count information.
Update json schema validation.
Signed-off-by: Royce Lv <lvroyce(a)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 f595bbf..4afdebf 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -143,6 +143,30 @@
}
}
},
+ "storagevolumes_create": {
+ "type": "object",
Missing 'error' parameter.
In the outer 'error' schema we should list the required parameters.
+ "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 fea0184..d59a87c 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -147,6 +147,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"),