[Kimchi-devel] [PATCHv4 2/4] Add volume ref_cnt: Update controller and json schema
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Thu Feb 27 09:49:00 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 | 25 +++++++++++++++++++++++++
src/kimchi/control/storagevolumes.py | 1 +
src/kimchi/i18n.py | 4 ++++
3 files changed, 30 insertions(+)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index f595bbf..b519fec 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -143,6 +143,31 @@
}
}
},
+ "storagevolumes_create": {
+ "type": "object",
+ "error": "KCHVOL0015E",
+ "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 718c97a..c4d6c41 100644
--- a/src/kimchi/control/storagevolumes.py
+++ b/src/kimchi/control/storagevolumes.py
@@ -49,6 +49,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 e22bb4b..32126e5 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -149,6 +149,10 @@ 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"),
+ "KCHVOL0015E": _("Storage volume requires a volume name"),
"KCHIFACE0001E": _("Interface %(name)s does not exist"),
--
1.8.1.2
More information about the Kimchi-devel
mailing list