[Kimchi-devel] [PATCHv3 3/5] Add volume ref_cnt: Update controller and json schema

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Feb 25 08:35:47 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 f595bbf..4afdebf 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -143,6 +143,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 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"),
 
-- 
1.8.1.2




More information about the Kimchi-devel mailing list