This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 99ca81a  ui: do not send conserve mode on L2 network offering creation 
from the UI (#2694)
99ca81a is described below

commit 99ca81a676006cc5d351bd94e32e284256d00b4a
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Thu Jun 7 02:50:37 2018 -0300

    ui: do not send conserve mode on L2 network offering creation from the UI 
(#2694)
    
    Do not send conserve mode param on L2 network offering creation from the 
UI. Fix config drive NPE issue on L2 network.
---
 .../storage/configdrive/ConfigDriveBuilder.java          |  2 +-
 ui/scripts/configuration.js                              | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/engine/storage/configdrive/src/org/apache/cloudstack/storage/configdrive/ConfigDriveBuilder.java
 
b/engine/storage/configdrive/src/org/apache/cloudstack/storage/configdrive/ConfigDriveBuilder.java
index dc6b889..55e7979 100644
--- 
a/engine/storage/configdrive/src/org/apache/cloudstack/storage/configdrive/ConfigDriveBuilder.java
+++ 
b/engine/storage/configdrive/src/org/apache/cloudstack/storage/configdrive/ConfigDriveBuilder.java
@@ -286,7 +286,7 @@ public class ConfigDriveBuilder {
         if (!NetworkModel.METATDATA_DIR.equals(dataType)) {
             return;
         }
-        if (StringUtils.isNotBlank(content)) {
+        if (StringUtils.isEmpty(content)) {
             return;
         }
         //keys are a special case in OpenStack format
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 2eee7bb..f229d24 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -2412,14 +2412,17 @@
                                             if ($useVpcCb.is(':checked')) { 
//if useVpc is checked,
                                                 
$useVpcCb.removeAttr("checked"); //remove "checked" attribute in useVpc
                                             }
+                                            $conservemode.css('display', 
'inline-block');
                                         } else if ($guestTypeField.val() == 
'Isolated') { //Isolated network offering
                                             $useVpc.css('display', 
'inline-block');
                                             $supportedServices.css('display', 
'inline-block');
                                             $userDataL2.hide();
+                                            $conservemode.css('display', 
'inline-block');
                                         } else if ($guestTypeField.val() == 
'L2') {
                                             $useVpc.hide();
                                             $supportedServices.hide();
                                             $userDataL2.css('display', 
'inline-block');
+                                            $conservemode.hide();
                                         }
                                         var $providers = 
$useVpcCb.closest('form').find('.dynamic-input 
select[name!="service.Connectivity.provider"]');
                                         var $optionsOfProviders = 
$providers.find('option');
@@ -3403,6 +3406,9 @@
                                     } else {
                                         delete inputData.serviceProviderList;
                                     }
+
+                                    //Conserve mode is irrelevant on L2 
network offerings as there are no resources to conserve, do not pass it, true 
by default on server side
+                                    delete inputData.conservemode;
                                 }
 
                                 if (inputData['forvpc'] == 'on') {
@@ -3411,10 +3417,12 @@
                                     delete inputData.forvpc; //if forVpc 
checkbox is unchecked, do not pass forVpc parameter to API call since we need 
to keep API call's size as small as possible (p.s. forVpc is defaulted as false 
at server-side)
                                 }
 
-                                if (inputData['conservemode'] == 'on') {
-                                    delete inputData.conservemode; //if 
ConserveMode checkbox is checked, do not pass conservemode parameter to API 
call since we need to keep API call's size as small as possible (p.s. 
conservemode is defaulted as true at server-side)
-                                } else {
-                                    inputData['conservemode'] = false;
+                                if (inputData['guestIpType'] == "Shared" || 
inputData['guestIpType'] == "Isolated") {
+                                    if (inputData['conservemode'] == 'on') {
+                                        delete inputData.conservemode; //if 
ConserveMode checkbox is checked, do not pass conservemode parameter to API 
call since we need to keep API call's size as small as possible (p.s. 
conservemode is defaulted as true at server-side)
+                                    } else {
+                                        inputData['conservemode'] = false;
+                                    }
                                 }
 
                                 // Make service provider map

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to