Remove volume source option on some dialogs

When creating a volume from snapshot or image, volume source
option should not be displayed.

Change-Id: I27d1a8e23b3ccf6c57922309bddf28dc9a76bab7
Closes-Bug: #1282845
This commit is contained in:
Zhenguo Niu 2014-02-21 14:56:14 +08:00 committed by Gerrit Code Review
parent 06cf31320c
commit aeaae9fdb0

View File

@ -109,6 +109,7 @@ class CreateForm(forms.SelfHandlingForm):
'to or greater than the snapshot size (%sGB)') \
% snapshot.size
del self.fields['image_source']
del self.fields['volume_source']
del self.fields['volume_source_type']
del self.fields['availability_zone']
except Exception:
@ -138,6 +139,7 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['size'].help_text = size_help_text
self.fields['image_source'].choices = ((image.id, image),)
del self.fields['snapshot_source']
del self.fields['volume_source']
del self.fields['volume_source_type']
except Exception:
msg = _('Unable to load the specified image. %s')