diff --git a/create/templates/create_instance.html b/create/templates/create_instance.html index 34ee73c..bb3b0a2 100644 --- a/create/templates/create_instance.html +++ b/create/templates/create_instance.html @@ -441,7 +441,7 @@
- {% if storages %} {% for storage in storages %} @@ -458,6 +458,20 @@
+
+ +
+ +
+
@@ -697,6 +711,9 @@ }); }); $("#template").removeAttr("disabled"); + $("#storage").val(pool).change(); + $("#storage").removeAttr("disabled"); + } function get_disk_bus_choices(compute_id, dev_idx, disk_type){ diff --git a/create/views.py b/create/views.py index 0bb2133..9bd881a 100644 --- a/create/views.py +++ b/create/views.py @@ -134,7 +134,7 @@ def create_instance(request, compute_id): error_msg = _("Image has already exist. Please check volumes or change instance name") error_messages.append(error_msg) else: - clone_path = conn.clone_from_template(data['name'], templ_path, metadata=meta_prealloc) + clone_path = conn.clone_from_template(data['name'], templ_path, data['storage'], metadata=meta_prealloc) volume = dict() volume['path'] = clone_path volume['type'] = conn.get_volume_type(clone_path) diff --git a/vrtManager/create.py b/vrtManager/create.py index 5a41a6a..fd3203a 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -118,9 +118,13 @@ class wvmCreate(wvmConnect): vol = self.get_volume_by_path(vol_path) return vol.storagePoolLookupByVolume() - def clone_from_template(self, clone, template, metadata=False, owner=default_owner): + def clone_from_template(self, clone, template, storage=None, metadata=False, owner=default_owner): vol = self.get_volume_by_path(template) - stg = vol.storagePoolLookupByVolume() + if not storage: + stg = vol.storagePoolLookupByVolume() + else: + stg = self.get_storage(storage) + storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type") format = util.get_xml_path(vol.XMLDesc(0), "/volume/target/format/@type") if storage_type == 'dir':