[Kimchi-devel] [PATCH] Remove LUN assignment in VM

Aline Manera alinefm at linux.vnet.ibm.com
Wed Mar 26 06:40:47 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

It will be done in Template level.
Remove it from VM and update docs accordingly.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 docs/API.md             |    2 --
 src/kimchi/API.json     |    9 +--------
 src/kimchi/i18n.py      |    2 --
 src/kimchi/model/vms.py |   16 +---------------
 4 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/docs/API.md b/docs/API.md
index f928320..65044f8 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -55,8 +55,6 @@ the following general conventions:
                      Independent Computing Environments
             * null: Graphics is disabled or type not supported
         * listen: The network which the vnc/spice server listens on.
-    * volumes *(optional)*: List of Fibre channel LUN names to be assigned as
-                            disk to VM. Required if pool is type SCSI.
 
 
 ### Resource: Virtual Machine
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 8ecd665..5ca94e3 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -190,14 +190,7 @@
                     "pattern": "^/storagepools/[^/]+/?$",
                     "error": "KCHVM0013E"
                 },
-                "graphics": { "$ref": "#/kimchitype/graphics" },
-                "volumes": {
-                    "description": "list of scsi volumes to be assigned to the new VM.",
-                    "type": "array",
-                    "items": { "type": "string" },
-                    "uniqueItems": true,
-                    "error": "KCHVM0018E"
-                }
+                "graphics": { "$ref": "#/kimchitype/graphics" }
             }
         },
         "vm_update": {
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 398d49a..fabb0b4 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -76,8 +76,6 @@ messages = {
     "KCHVM0014E": _("Supported virtual machine graphics are spice or VNC"),
     "KCHVM0015E": _("Graphics address to listen on must be IPv4 or IPv6"),
     "KCHVM0016E": _("Specify a template to create a virtual machine from"),
-    "KCHVM0017E": _("Volume list (LUNs names) not given."),
-    "KCHVM0018E": _("Virtual machine volumes must be a list of strings with distinct LUNs names."),
     "KCHVM0019E": _("Unable to start virtual machine %(name)s. Details: %(err)s"),
     "KCHVM0020E": _("Unable to stop virtual machine %(name)s. Details: %(err)s"),
     "KCHVM0021E": _("Unable to delete virtual machine %(name)s. Details: %(err)s"),
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index ef1d617..c8dfc90 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -29,7 +29,7 @@ from kimchi import vnc
 from kimchi import xmlutils
 from kimchi.config import READONLY_POOL_TYPE
 from kimchi.exception import InvalidOperation, InvalidParameter
-from kimchi.exception import MissingParameter, NotFoundError, OperationFailed
+from kimchi.exception import NotFoundError, OperationFailed
 from kimchi.model.config import CapabilitiesModel
 from kimchi.model.templates import TemplateModel
 from kimchi.model.utils import get_vm_name
@@ -153,11 +153,6 @@ class VMsModel(object):
                                'diskRdKB': diskRdKB,
                                'diskWrKB': diskWrKB})
 
-    def _get_volume_path(self, pool, vol):
-        conn = self.conn.get()
-        pool = conn.storagePoolLookupByName(pool)
-        return pool.storageVolLookupByName(vol).path()
-
     def create(self, params):
         conn = self.conn.get()
         t_name = template_name_from_uri(params['template'])
@@ -186,15 +181,6 @@ class VMsModel(object):
         vol_list = []
         if t._get_storage_type() in ["iscsi", "scsi"]:
             vol_list = []
-        elif t._get_storage_type() in READONLY_POOL_TYPE:
-            if not params.get('volumes'):
-                raise MissingParameter('KCHVM0017E')
-            else:
-                # Get system path of the LUNs
-                pool = t.info['storagepool'].split('/')[-1]
-                for vol in params.get('volumes'):
-                    path = self._get_volume_path(pool, vol)
-                    vol_list.append((vol, path))
         else:
             vol_list = t.fork_vm_storage(vm_uuid)
 
-- 
1.7.10.4




More information about the Kimchi-devel mailing list