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

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Mar 5 08:46:54 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..6e932ed 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -143,6 +143,31 @@
                 }
             }
         },
+        "storagevolumes_create": {
+            "type": "object",
+            "error": "KCHVOL0016E",
+            "properties": {
+                "name": {
+                    "description": "The name of the Storage Volume",
+                    "type": "string",
+                    "minLength": 1,
+                    "required": true,
+                    "error": "KCHVOL0013E"
+                },
+                "allocation": {
+                    "description": "The size(MiB) of allocation when create the storage volume",
+                    "type": "number",
+                    "minimum": 1,
+                    "error": "KCHVOL0014E"
+                },
+                "format": {
+                    "description": "The format of the volume",
+                    "type": "string",
+                    "pattern": "^qcow2|raw$",
+                    "error": "KCHVOL0015E"
+                }
+            }
+        },
         "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 36785e6..d4046de 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -152,6 +152,10 @@ messages = {
     "KCHVOL0010E": _("Unable to delete storage volume %(name)s. Details: %(err)s"),
     "KCHVOL0011E": _("Unable to resize storage volume %(name)s. Details: %(err)s"),
     "KCHVOL0012E": _("Storage type %(type)s does not support volume create and delete"),
+    "KCHVOL0013E": _("Storage volume name must be a string"),
+    "KCHVOL0014E": _("Storage volume allocation must be an integer number"),
+    "KCHVOL0015E": _("Storage volume format not supported"),
+    "KCHVOL0016E": _("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