Commit 269c4015 by Szabolcs Gelencser

Set template image as shared by default. Do not show shared images in plain vm creation

parent e155a219
No preview for this file type
...@@ -130,6 +130,8 @@ class VmFromPlainImageForm(forms.Form): ...@@ -130,6 +130,8 @@ class VmFromPlainImageForm(forms.Form):
super(VmFromPlainImageForm, self).__init__(*args, **kwargs) super(VmFromPlainImageForm, self).__init__(*args, **kwargs)
images = openstack_api.glance.image_list_detailed(request)[0] #TODO: flatten? images = openstack_api.glance.image_list_detailed(request)[0] #TODO: flatten?
images = [i for i in images if i._apiresource["visibility"] in ["private", "public"]]
def sizeof_fmt(num, suffix='B'): def sizeof_fmt(num, suffix='B'):
for unit in ['', 'K', 'M', 'G', 'T']: for unit in ['', 'K', 'M', 'G', 'T']:
if abs(num) < 1024.0: if abs(num) < 1024.0:
......
...@@ -523,6 +523,7 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -523,6 +523,7 @@ class SaveAsTemplateOperation(InstanceOperation):
with_shutdown=True, clone=False, task=None, **kwargs): with_shutdown=True, clone=False, task=None, **kwargs):
template_image_id = openstack_api.nova.snapshot_create(request, self.instance.id, name) template_image_id = openstack_api.nova.snapshot_create(request, self.instance.id, name)
openstack_api.glance.image_update(request, template_image_id, visibility="shared")
template = InstanceTemplate( template = InstanceTemplate(
name=name, name=name,
image_id=template_image_id, image_id=template_image_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment