[jira] [Commented] (CLOUDSTACK-10356) Fix Some Potential NPE

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16446244#comment-16446244
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10356:
-

blueorangutan commented on issue #2573: [CLOUDSTACK-10356] Fix NPE in 
Cloudstack found with NPEDetector 
URL: https://github.com/apache/cloudstack/pull/2573#issuecomment-383197474
 
 
   Trillian test result (tid-2528)
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 85758 seconds
   Marvin logs: 
https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2573-t2528-kvm-centos7.zip
   Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
   Intermitten failure detected: /marvin/tests/smoke/test_primary_storage.py
   Intermitten failure detected: /marvin/tests/smoke/test_routers.py
   Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py
   Intermitten failure detected: /marvin/tests/smoke/test_ssvm.py
   Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
   Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py
   Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
   Smoke tests completed. 60 look OK, 7 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_add_primary_storage_disabled_host | `Error` | 0.64 | 
test_primary_storage.py
   test_01_primary_storage_nfs | `Error` | 0.12 | test_primary_storage.py
   ContextSuite context=TestStorageTags>:setup | `Error` | 0.22 | 
test_primary_storage.py
   test_04_restart_network_wo_cleanup | `Failure` | 2.92 | test_routers.py
   test_02_list_snapshots_with_removed_data_store | `Error` | 1.16 | 
test_snapshots.py
   test_05_stop_ssvm | `Failure` | 57.98 | test_ssvm.py
   test_08_migrate_vm | `Error` | 13.82 | test_vm_life_cycle.py
   test_01_cancel_host_maintenace_with_no_migration_jobs | `Failure` | 0.12 | 
test_host_maintenance.py
   test_02_cancel_host_maintenace_with_migration_jobs | `Error` | 2.33 | 
test_host_maintenance.py
   test_hostha_enable_ha_when_host_in_maintenance | `Error` | 4.60 | 
test_hostha_kvm.py
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Fix Some Potential NPE 
> ---
>
> Key: CLOUDSTACK-10356
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10356
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.12.0.0
>Reporter: lujie
>Priority: Major
> Attachments: CLOUDSTACK-10356_1.patch
>
>
> We have developed a static analysis tool 
> [NPEDetector|https://github.com/lujiefsi/NPEDetector] to find some potential 
> NPE. Our analysis shows that some callees may return null in corner case(e.g. 
> node crash , IO exception), some of their callers have  _!=null_ check but 
> some do not have. In this issue we post a patch which can add  !=null  based 
> on existed !=null  check. For example:
> Callee GlobalLoadBalancingRulesServiceImpl#lookupGslbServiceProvider:
> {code:java}
> protected GslbServiceProvider lookupGslbServiceProvider() {
> return _gslbProviders.size() == 0 ? null : _gslbProviders.get(0);// may 
> return null;
> }
> {code}
> Caller GlobalLoadBalancingRulesServiceImpl#checkGslbServiceEnabledInZone have 
> _!=null_:
> {code:java}
> private boolean checkGslbServiceEnabledInZone(long zoneId, long 
> physicalNetworkId) {
>GslbServiceProvider gslbProvider = lookupGslbServiceProvider();
>if (gslbProvider == null) {
>   throw new CloudRuntimeException("No GSLB provider is available");
>}
>return gslbProvider.isServiceEnabledInZone(zoneId, physicalNetworkId);
> }
> {code}
> but another 
> GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig does 
> not have !=null check:
> {code:java}
> GslbServiceProvider gslbProvider = lookupGslbServiceProvider();
> siteLb.setGslbProviderPublicIp(gslbProvider.getZoneGslbProviderPublicIp(dataCenterId,physicalNetworkId));
> .{code}
> So we will add below code in non-(!=null) caller 
> GlobalLoadBalancingRulesServiceImpl#applyGlobalLoadBalancerRuleConfig
> {code:java}
> if (gslbProvider == null) {
> throw new CloudRuntimeException("No GSLB provider is available");
> }
> {code}
> But due to we are not very  familiar with CLOUDSTACK, hope some expert can 
> review it.
> Thanks



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10304) SystemVM - Apache Web Server Version Number Information Disclosure

2018-04-20 Thread Boris Stoyanov (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445737#comment-16445737
 ] 

Boris Stoyanov commented on CLOUDSTACK-10304:
-

PR has been merged should we close this one?

> SystemVM - Apache Web Server Version Number Information Disclosure
> --
>
> Key: CLOUDSTACK-10304
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10304
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: SystemVM
>Affects Versions: 4.11.0.0
>Reporter: Julian Gilbert
>Assignee: Rohit Yadav
>Priority: Major
> Fix For: 4.12.0.0, 4.11.1.0
>
>
> {color:#00}The Secondary Storage System VM discloses its Apache Web 
> Server version number in HTTP headers and error pages. This type of 
> information disclosure can lead to medium vulnerabilities being reported in 
> web vulnerability scanners and reveals the Apache server version 
> unnecessarily.{color}
> {color:#00}The apache2 directory structure no longer contains 
> /etc/apache2/conf.d/ in Debian 9 and therefore the appropriate apache2 
> security configuration file is in another location. The 
> /opt/cloud/bin/setup/common.sh script has not been updated to reflect 
> this.{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445731#comment-16445731
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183051578
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
-encap = false;
-}
-
 checkCustomerGatewayCidrList(guestCidrList);
 
-long accountId = gw.getAccountId();
-Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
-if (existedGw != null && existedGw.getId() != gw.getId()) {
-throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+String name = cmd.getName();
+if (name != null) {
+long accountId = gw.getAccountId();
+Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
+if (existedGw != null && existedGw.getId() != gw.getId()) {
+throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+}
 }
 
 gw.setName(name);
 gw.setGatewayIp(gatewayIp);
 gw.setGuestCidrList(guestCidrList);
 gw.setIkePolicy(ikePolicy);
 gw.setEspPolicy(espPolicy);
-gw.setIpsecPsk(ipsecPsk);
+gw.setIpsecPsk(cmd.getIpsecPsk());
 
 Review comment:
   @rhtyd so, I have to move these into the conditions otherwise they may be 
null right?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
>   

[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445729#comment-16445729
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183051200
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
-encap = false;
-}
-
 checkCustomerGatewayCidrList(guestCidrList);
 
-long accountId = gw.getAccountId();
-Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
-if (existedGw != null && existedGw.getId() != gw.getId()) {
-throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+String name = cmd.getName();
+if (name != null) {
+long accountId = gw.getAccountId();
+Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
+if (existedGw != null && existedGw.getId() != gw.getId()) {
+throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+}
 }
 
 gw.setName(name);
 
 Review comment:
   good catch!


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>  

[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445728#comment-16445728
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183051161
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
 
 Review comment:
   same here, no need to "default" an existing record


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445727#comment-16445727
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183051063
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
 
 Review comment:
   if null, we should keep what we already have


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445712#comment-16445712
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048444
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
-encap = false;
-}
-
 checkCustomerGatewayCidrList(guestCidrList);
 
-long accountId = gw.getAccountId();
-Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
-if (existedGw != null && existedGw.getId() != gw.getId()) {
-throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+String name = cmd.getName();
+if (name != null) {
 
 Review comment:
   I see you've a null check here, but what is name is not provided, the code 
will fallthrough?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445703#comment-16445703
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on issue #2377: CLOUDSTACK-10207: updateVpnCustomerGateway: fix 
defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#issuecomment-383093482
 
 
   @resmo manual testing is fine, given your comment I'm okay to merge.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445705#comment-16445705
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048107
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 
 Review comment:
   should we throw an exception instead when name is null or empty?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445718#comment-16445718
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183049938
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
-encap = false;
-}
-
 checkCustomerGatewayCidrList(guestCidrList);
 
-long accountId = gw.getAccountId();
-Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
-if (existedGw != null && existedGw.getId() != gw.getId()) {
-throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+String name = cmd.getName();
+if (name != null) {
 
 Review comment:
   this is "updateCustomerGateway" so we already have a valid name. if no name 
is provided, we should just keep the name as is.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445714#comment-16445714
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

resmo commented on issue #2377: CLOUDSTACK-10207: updateVpnCustomerGateway: fix 
defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#issuecomment-383094901
 
 
   I discovered the flow while developing ansible modules. 
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/cloudstack/cs_vpn_customer_gateway.py.
 In my integration tests I had to always add all arguments 
(https://github.com/ansible/ansible/blob/devel/test/integration/targets/cs_vpn_customer_gateway/tasks/main.yml#L105)
 to have the idempotent result. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445706#comment-16445706
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048203
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
 
 Review comment:
   Here, should we throw an exception or keep the default when ikeLifetime is 
null?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445710#comment-16445710
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048263
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
 
 Review comment:
   Same for above two Boolean options?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445713#comment-16445713
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on a change in pull request #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#discussion_r183048519
 
 

 ##
 File path: server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java
 ##
 @@ -426,72 +426,52 @@ public Site2SiteCustomerGateway 
updateCustomerGateway(UpdateVpnCustomerGatewayCm
 }
 }
 }
-String name = cmd.getName();
 String gatewayIp = cmd.getGatewayIp();
 if (!NetUtils.isValidIp(gatewayIp) && 
!NetUtils.verifyDomainName(gatewayIp)) {
 throw new InvalidParameterValueException("The customer gateway 
ip/Domain " + gatewayIp + " is invalid!");
 }
-if (name == null) {
-name = "VPN-" + gatewayIp;
-}
 String guestCidrList = cmd.getGuestCidrList();
 if (!NetUtils.isValidCidrList(guestCidrList)) {
 throw new InvalidParameterValueException("The customer gateway 
peer cidr list " + guestCidrList + " contains an invalid cidr!");
 }
-String ipsecPsk = cmd.getIpsecPsk();
 String ikePolicy = cmd.getIkePolicy();
-String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("ike", ikePolicy)) {
-throw new InvalidParameterValueException("The customer gateway IKE 
policy" + ikePolicy + " is invalid!  Verify the required Diffie Hellman (DH) 
group is specified.");
+throw new InvalidParameterValueException("Error while updating a 
customer gateway. The IKE policy" + ikePolicy + " is invalid! Verify whether 
the required Diffie Hellman (DH) group is specified.");
 }
+String espPolicy = cmd.getEspPolicy();
 if (!NetUtils.isValidS2SVpnPolicy("esp", espPolicy)) {
 throw new InvalidParameterValueException("The customer gateway ESP 
policy" + espPolicy + " is invalid!");
 }
 Long ikeLifetime = cmd.getIkeLifetime();
-if (ikeLifetime == null) {
-// Default value of lifetime is 1 day
-ikeLifetime = (long)86400;
-}
-if (ikeLifetime > 86400) {
+if (ikeLifetime != null && ikeLifetime > 86400) {
 throw new InvalidParameterValueException("The IKE lifetime " + 
ikeLifetime + " of vpn connection is invalid!");
 }
 Long espLifetime = cmd.getEspLifetime();
-if (espLifetime == null) {
-// Default value of lifetime is 1 hour
-espLifetime = (long)3600;
-}
-if (espLifetime > 86400) {
+if (espLifetime != null && espLifetime > 86400) {
 throw new InvalidParameterValueException("The ESP lifetime " + 
espLifetime + " of vpn connection is invalid!");
 }
 
-Boolean dpd = cmd.getDpd();
-if (dpd == null) {
-dpd = false;
-}
-
-Boolean encap = cmd.getEncap();
-if (encap == null) {
-encap = false;
-}
-
 checkCustomerGatewayCidrList(guestCidrList);
 
-long accountId = gw.getAccountId();
-Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
-if (existedGw != null && existedGw.getId() != gw.getId()) {
-throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+String name = cmd.getName();
+if (name != null) {
+long accountId = gw.getAccountId();
+Site2SiteCustomerGatewayVO existedGw = 
_customerGatewayDao.findByNameAndAccountId(name, accountId);
+if (existedGw != null && existedGw.getId() != gw.getId()) {
+throw new InvalidParameterValueException("The customer gateway 
with name " + name + " already existed!");
+}
 }
 
 gw.setName(name);
 
 Review comment:
   here a null name could be set.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>

[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445702#comment-16445702
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

rhtyd commented on issue #2377: CLOUDSTACK-10207: updateVpnCustomerGateway: fix 
defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#issuecomment-383093396
 
 
   Tests LGTM. Let me review it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10207) updateVpnCustomerGateway: unexpected changes on optional keys

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445694#comment-16445694
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10207:
-

borisstoyanov commented on issue #2377: CLOUDSTACK-10207: 
updateVpnCustomerGateway: fix defaulting for option…
URL: https://github.com/apache/cloudstack/pull/2377#issuecomment-383091103
 
 
   @resmo can you just give a brief overview how you've covered the manual 
testing? 
   @rhtyd @DaanHoogland I think this could be merged as well?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> updateVpnCustomerGateway: unexpected changes on optional keys
> -
>
> Key: CLOUDSTACK-10207
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10207
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: API
>Reporter: René Moser
>Assignee: René Moser
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10288) Config drive - Usedata corruption when gzipped

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445690#comment-16445690
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10288:
-

DaanHoogland commented on issue #2566: ConfigDrive fixes: CLOUDSTACK-10288, 
CLOUDSTACK-10289
URL: https://github.com/apache/cloudstack/pull/2566#issuecomment-383090688
 
 
   the error I reported earlier, I could not reproduce. ready for merge fwiw


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Config drive - Usedata corruption when gzipped 
> ---
>
> Key: CLOUDSTACK-10288
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10288
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.11.0.0
>Reporter: Rohit Yadav
>Assignee: Frank Maximus
>Priority: Major
>
> Should be able to create userdata via "echo hi | gzip | base64 -w0" and read 
> it back in VM via "mount -o loop /dev/sr1 /mnt/tmp; cat 
> /mnt/tmp/cloudstack/userdata/user_data.txt | gunzip" 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10288) Config drive - Usedata corruption when gzipped

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445699#comment-16445699
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10288:
-

DaanHoogland commented on issue #2566: ConfigDrive fixes: CLOUDSTACK-10288, 
CLOUDSTACK-10289
URL: https://github.com/apache/cloudstack/pull/2566#issuecomment-382670641
 
 
   @fmaximus I think I found a bug. I will retest but here is the issue:
   when creating an offering with all options on virtual router except for user 
data (on configdrive) and creating a template with password enabled it creates 
a vm in a new network of this new offering type but does not supply the 
generated password. See the screenshot to see the issue.
   ![screenshot from 2018-04-19 
09-15-31](https://user-images.githubusercontent.com/2486961/38983391-bcceb09c-43b3-11e8-8eec-ef9adf03071e.png)
   
   I have not been able to reproduce this error, so never mind.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Config drive - Usedata corruption when gzipped 
> ---
>
> Key: CLOUDSTACK-10288
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10288
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.11.0.0
>Reporter: Rohit Yadav
>Assignee: Frank Maximus
>Priority: Major
>
> Should be able to create userdata via "echo hi | gzip | base64 -w0" and read 
> it back in VM via "mount -o loop /dev/sr1 /mnt/tmp; cat 
> /mnt/tmp/cloudstack/userdata/user_data.txt | gunzip" 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10326) Prevent hosts fall into Maintenance when there are running VMs on it

2018-04-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16445683#comment-16445683
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10326:
-

borisstoyanov commented on issue #2493: CLOUDSTACK-10326: Prevent hosts fall 
into Maintenance when there are running VMs on it
URL: https://github.com/apache/cloudstack/pull/2493#issuecomment-383087774
 
 
   @nvazquez should this be marked against 4.11.1 ? I don't think we'll be able 
to squeeze it in...


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Prevent hosts fall into Maintenance when there are running VMs on it
> 
>
> Key: CLOUDSTACK-10326
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10326
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.11.0.0
>Reporter: Nicolas Vazquez
>Assignee: Nicolas Vazquez
>Priority: Major
> Fix For: 4.11.1.0
>
> Attachments: CLOUDSTACK-10326-Debug.png, 
> CLOUDSTACK-10326-InitialState.png, CLOUDSTACK-10326-Migrating.png, 
> CLOUDSTACK-10326-MigrationFailed.png
>
>
> This issue was discovered, fixed and tested on KVM, but applies for every 
> hypervisor.
> h2. Background
> When enabling maintenance mode in a host, host state is put into 
> 'PrepareForMaintenance' and running VMs are migrated into another host. After 
> every VM is migrated, host goes to 'Maintenance' state.
> Checks are performed on ResourceManagerImpl.checkAndMaintan() method:
>  * List VMs with host_id = HOST_ID
>  * List VMs with last_host_id = HOST_ID and state=Migrating
> When both queries are empty, then the host can be put into Maintenance.
> When a VM is being migrated to DEST_HOST, its host_id column is set to 
> DEST_HOST, last_host_id = ORIGIN_HOST and state = Migrating. If then 
> migration fails, host_id = last_host_id = ORIGIN_HOST 
> h2. Issue
> This sequence:
>  * Enable maintenance mode on ORIGIN_HOST
>  * VMs start being migrated to a host, say DEST_HOST
>  * checkAndMaintain() starts:
>  ** First check passes (no VM with host_id = ORIGIN_HOST_ID as those are 
> being migrated)
>  ** Before the second check, one or more migrations fail
>  ** Second check passes, however there are VMs running on the host as 
> migrations have failed.
>  * Host goes into Maintenance state.
> Screenshots attached, query executed on each case:
> select id, name, instance_name, state, host_id, last_host_id from vm_instance;



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)