Add same launch instance error handling as image to instance

Previously, when launching an instance with an instance snapshot rather
than with an image, the error handling was not as pleasant. I.e. the
volume size was not automatically set to the minimum size and the error
message would only appear after attempting to launch an instance. This
is a small patch that addresses this and makes the user experience more
friendly.

Change-Id: Ib694f66c74e90ee2e15201673de953c08cf10122
Closes-bug: #1752360
This commit is contained in:
Beth Elwell 2018-02-28 15:52:06 +00:00
parent 6d4405951d
commit 3233de8f0d
1 changed files with 2 additions and 1 deletions

View File

@ -516,7 +516,8 @@
function checkVolumeForImage() {
var source = selection[0];
if (source && ctrl.currentBootSource === bootSourceTypes.IMAGE) {
if (source && ctrl.currentBootSource === bootSourceTypes.IMAGE ||
source && ctrl.currentBootSource === bootSourceTypes.INSTANCE_SNAPSHOT ) {
var imageGb = source.size * 1e-9;
var imageDisk = source.min_disk;
ctrl.minVolumeSize = Math.ceil(Math.max(imageGb, imageDisk));