[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111591078
  
--- Diff: server/src/com/cloud/api/ApiServlet.java ---
@@ -290,6 +292,17 @@ void processRequestInContext(final HttpServletRequest 
req, final HttpServletResp
 CallContext.register(accountMgr.getSystemUser(), 
accountMgr.getSystemAccount());
 }
 
+if (CallContext.current().getCallingAccount().getType() == 
Account.ACCOUNT_TYPE_ADMIN) {
+s_logger.debug("CIDRs from which Admin accounts are 
allowed to perform API calls " + adminCidrs);
--- End diff --

I was thinking trace here and debug or info on the first load of the cidr


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread wido
Github user wido commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111589656
  
--- Diff: server/src/com/cloud/api/ApiServlet.java ---
@@ -290,6 +292,17 @@ void processRequestInContext(final HttpServletRequest 
req, final HttpServletResp
 CallContext.register(accountMgr.getSystemUser(), 
accountMgr.getSystemAccount());
 }
 
+if (CallContext.current().getCallingAccount().getType() == 
Account.ACCOUNT_TYPE_ADMIN) {
+s_logger.debug("CIDRs from which Admin accounts are 
allowed to perform API calls " + adminCidrs);
--- End diff --

You suggest setting this to TRACE instead of debug?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread wido
Github user wido commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111589706
  
--- Diff: server/src/com/cloud/api/ApiServlet.java ---
@@ -290,6 +292,17 @@ void processRequestInContext(final HttpServletRequest 
req, final HttpServletResp
 CallContext.register(accountMgr.getSystemUser(), 
accountMgr.getSystemAccount());
 }
 
+if (CallContext.current().getCallingAccount().getType() == 
Account.ACCOUNT_TYPE_ADMIN) {
+s_logger.debug("CIDRs from which Admin accounts are 
allowed to perform API calls " + adminCidrs);
+if 
(!NetUtils.isIpInCidrList(InetAddress.getByName(remoteAddress), 
adminCidrs.split(","))) {
+auditTrailSb.append(" " + 
HttpServletResponse.SC_UNAUTHORIZED + " " + "IP-Address of remote not in 
configured Admin CIDR list");
+final String serializedResponse =
+
apiServer.getSerializedApiError(HttpServletResponse.SC_UNAUTHORIZED, 
"IP-Address of remote not in configured Admin CIDR list",
+params, responseType);
+HttpUtils.writeHttpResponse(resp, serializedResponse, 
HttpServletResponse.SC_UNAUTHORIZED, responseType, 
apiServer.getJSONContentType());
--- End diff --

True, true. I would say WARN?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread wido
Github user wido commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111589627
  
--- Diff: api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java 
---
@@ -28,6 +28,8 @@
 "API end point. Can be used by CS components/services deployed 
remotely, for sending CS API requests", true);
 public static final ConfigKey DefaultUIPageSize = new 
ConfigKey("Advanced", Long.class, "default.ui.page.size", "20",
 "The default pagesize to be used by UI and other clients when 
making list* API calls", true, ConfigKey.Scope.Global);
+public static final ConfigKey ManagementAdminCidr = new 
ConfigKey("Advanced", String.class, "management.admin.cidr",
+"0.0.0.0/0,::/0", "Comma separated list of IPv4/IPv6 CIDRs 
from which Admin accounts can perform API calls", true, ConfigKey.Scope.Global);
--- End diff --

I agree. I have set it to open for all for now. We can submit a different 
PR afterwards to change the default imho.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread wido
Github user wido commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111589567
  
--- Diff: core/src/com/cloud/network/HAProxyConfigurator.java ---
@@ -538,7 +536,7 @@ private String getLbSubRuleForStickiness(final 
LoadBalancerTO lbTO) {
 if (stickinessSubRule != null && !destsAvailable) {
 s_logger.warn("Haproxy stickiness policy for lb rule: " + 
lbTO.getSrcIp() + ":" + lbTO.getSrcPort() + ": Not Applied, cause:  backends 
are unavailable");
 }
-if (publicPort.equals(NetUtils.HTTP_PORT) && !keepAliveEnabled || 
httpbasedStickiness) {
+if (publicPort == NetUtils.HTTP_PORT && !keepAliveEnabled || 
httpbasedStickiness) {
--- End diff --

It is a port number so it should be a Int. It's a part of the NetUtils 
refactor. I found that only HTTP/HTTPS port were Strings.

I wanted to make the change in other files as small as possible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111568764
  
--- Diff: api/src/org/apache/cloudstack/config/ApiServiceConfiguration.java 
---
@@ -28,6 +28,8 @@
 "API end point. Can be used by CS components/services deployed 
remotely, for sending CS API requests", true);
 public static final ConfigKey DefaultUIPageSize = new 
ConfigKey("Advanced", Long.class, "default.ui.page.size", "20",
 "The default pagesize to be used by UI and other clients when 
making list* API calls", true, ConfigKey.Scope.Global);
+public static final ConfigKey ManagementAdminCidr = new 
ConfigKey("Advanced", String.class, "management.admin.cidr",
+"0.0.0.0/0,::/0", "Comma separated list of IPv4/IPv6 CIDRs 
from which Admin accounts can perform API calls", true, ConfigKey.Scope.Global);
--- End diff --

argument for this default: backwards compatible
argument against: inherent security risk


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r11156
  
--- Diff: server/src/com/cloud/api/ApiServlet.java ---
@@ -290,6 +292,17 @@ void processRequestInContext(final HttpServletRequest 
req, final HttpServletResp
 CallContext.register(accountMgr.getSystemUser(), 
accountMgr.getSystemAccount());
 }
 
+if (CallContext.current().getCallingAccount().getType() == 
Account.ACCOUNT_TYPE_ADMIN) {
+s_logger.debug("CIDRs from which Admin accounts are 
allowed to perform API calls " + adminCidrs);
+if 
(!NetUtils.isIpInCidrList(InetAddress.getByName(remoteAddress), 
adminCidrs.split(","))) {
+auditTrailSb.append(" " + 
HttpServletResponse.SC_UNAUTHORIZED + " " + "IP-Address of remote not in 
configured Admin CIDR list");
+final String serializedResponse =
+
apiServer.getSerializedApiError(HttpServletResponse.SC_UNAUTHORIZED, 
"IP-Address of remote not in configured Admin CIDR list",
+params, responseType);
+HttpUtils.writeHttpResponse(resp, serializedResponse, 
HttpServletResponse.SC_UNAUTHORIZED, responseType, 
apiServer.getJSONContentType());
--- End diff --

this you do want to log on every attempt (WARN or INFO???)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111568831
  
--- Diff: server/src/com/cloud/api/ApiServlet.java ---
@@ -290,6 +292,17 @@ void processRequestInContext(final HttpServletRequest 
req, final HttpServletResp
 CallContext.register(accountMgr.getSystemUser(), 
accountMgr.getSystemAccount());
 }
 
+if (CallContext.current().getCallingAccount().getType() == 
Account.ACCOUNT_TYPE_ADMIN) {
+s_logger.debug("CIDRs from which Admin accounts are 
allowed to perform API calls " + adminCidrs);
--- End diff --

you don't want to log this on every call.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2046#discussion_r111568225
  
--- Diff: core/src/com/cloud/network/HAProxyConfigurator.java ---
@@ -538,7 +536,7 @@ private String getLbSubRuleForStickiness(final 
LoadBalancerTO lbTO) {
 if (stickinessSubRule != null && !destsAvailable) {
 s_logger.warn("Haproxy stickiness policy for lb rule: " + 
lbTO.getSrcIp() + ":" + lbTO.getSrcPort() + ": Not Applied, cause:  backends 
are unavailable");
 }
-if (publicPort.equals(NetUtils.HTTP_PORT) && !keepAliveEnabled || 
httpbasedStickiness) {
+if (publicPort == NetUtils.HTTP_PORT && !keepAliveEnabled || 
httpbasedStickiness) {
--- End diff --

why this? equals() seems more what is intended then ==
is making it an int really the best? as opposed to Integer (or String for 
that matter)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2046: CLOUDSTACK-7958: Add configuration for limit ...

2017-04-14 Thread wido
GitHub user wido opened a pull request:

https://github.com/apache/cloudstack/pull/2046

CLOUDSTACK-7958: Add configuration for limit to CIDRs for Admin API calls

The global setting 'management.admin.cidr' is set to 0.0.0.0/0,::/0
by default preserve the current behavior and thus allow API calls
for Admin accounts from all IPv4 and IPv6 subnets.

Users can set it to a comma-separated list of IPv4/IPv6 subnets to
restrict API calls for Admin accounts to certain parts of their network(s).

This is to improve Security. Should a attacker steal the Access/Secret key
of a Admin account he/she still needs to be in a subnet from where Admin 
accounts
are allowed to perform API calls.

This is a good security measure for APIs which are connected to the public 
internet.


This PR also includes a commit to cleanup and improve NetUtils.

No existing methods have been altered. That has been verified by adding 
additional Unit Tests for this.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/wido/cloudstack admin-cidr

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2046.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2046


commit 770b0bdd4f20deefcb11d9c7b7713e06e3281e8e
Author: Wido den Hollander 
Date:   2017-04-13T15:23:24Z

Cleanup and Improve NetUtils

This class had many unused methods, inconsistent names and redundant code.

This commit cleans up code, renames a few methods and constants.

Methods were renamed to clearly show that they are for IPv4 or IPv6.

Tests were improved and added to test the changes that were made to the 
code.

Signed-off-by: Wido den Hollander 

commit fb6ab51ba384cb2ae3eed788f3c241b4c28c9bf5
Author: Wido den Hollander 
Date:   2017-04-13T15:23:36Z

CLOUDSTACK-7958: Add configuration for limit to CIDRs

The global setting 'management.admin.cidr' is set to 0.0.0.0/0,::/0
by default preserve the current behavior and thus allow API calls
for Admin accounts from all IPv4 and IPv6 subnets.

Users can set it to a comma-separated list of IPv4/IPv6 subnets to
restrict API calls for Admin accounts to certain parts of their network(s).

This is to improve Security. Should a attacker steal the Access/Secret key
of a Admin account he/she still needs to be in a subnet from where Admin 
accounts
are allowed to perform API calls.

This is a good security measure for APIs which are connected to the public 
internet.

Signed-off-by: Wido den Hollander 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2045: Fix snmptrap alert bug

2017-04-14 Thread WingkaiHo
GitHub user WingkaiHo opened a pull request:

https://github.com/apache/cloudstack/pull/2045

Fix snmptrap alert bug

Fix snmptrap alerts info omit to send the field of SnmpConstants.sysUpTime. 

So when standard snmptrapd  receive alerts package the field OID will 
dislocation

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/WingkaiHo/cloudstack fix-snmptrap-bug

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2045.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2045


commit 83d4c26d64c1c8bb393f7e3eb7281c787c8e558f
Author: WingkaiHo 
Date:   2017-04-14T10:01:55Z

fix snmptrap alerts info omit to send the field of SnmpConstants.sysUpTime




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2030: WIP: CLOUDSTACK-9864 cleanup stale worker VMs...

2017-04-14 Thread DaanHoogland
GitHub user DaanHoogland reopened a pull request:

https://github.com/apache/cloudstack/pull/2030

WIP: CLOUDSTACK-9864 cleanup stale worker VMs after job expiry time



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack snapshot-housekeeping

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2030.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2030


commit 40869570fc510fac0d2357f272e96cd4a4518176
Author: Daan Hoogland 
Date:   2017-03-30T14:35:37Z

CE-113 trace logging and rethrow instead of nesting CloudRuntimeException

commit 66d7d846352d52cc539b1dafb5e4d0f1620829a5
Author: Daan Hoogland 
Date:   2017-04-05T12:19:14Z

CE-113 configure workervm gc based on job expiry

commit 996f5834e6a0a9e4dc57d436ceeb5b89e6dc9974
Author: Daan Hoogland 
Date:   2017-04-05T15:35:41Z

CE-113 extra trace log of worker VMs

commit 9a8ea7c0d1c9775ad7e4200db2b3eca93e121909
Author: Daan Hoogland 
Date:   2017-04-06T09:33:53Z

CE-113 removed TODOs

commit e2c0f09609b48f4539f13edcc742ca7e06f0cca2
Author: Daan Hoogland 
Date:   2017-04-07T12:54:19Z

CE-113 use of duration (instead of the old clock-tick-based code




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2030: WIP: CLOUDSTACK-9864 cleanup stale worker VMs...

2017-04-14 Thread DaanHoogland
Github user DaanHoogland closed the pull request at:

https://github.com/apache/cloudstack/pull/2030


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2044: CLOUDSTACK-9877 Cleanup unlinked templates

2017-04-14 Thread DaanHoogland
GitHub user DaanHoogland opened a pull request:

https://github.com/apache/cloudstack/pull/2044

CLOUDSTACK-9877 Cleanup unlinked templates

This implements CLOUDSTACK-9877 by marking templates for gc when
1. the template they where created with is deleted from cloudstack
2. all vms that still use it were created as full clones

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack 
cleanup-unlinked-templates

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2044.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2044


commit 7a051b31587e43f94b49bf6f26478b33fc8c4c42
Author: Daan Hoogland 
Date:   2017-03-23T15:45:43Z

CE-110 move config to public fields

commit cf495adfd3fea9fc4806bb1453bbe05d2200f155
Author: Daan Hoogland 
Date:   2017-04-14T07:33:35Z

CE-110 remove duplicate-unused functionality

commit 5cd18ebfb61839816f827eef8b0604c052edf96d
Author: Daan Hoogland 
Date:   2017-04-14T07:41:46Z

CE-110 task for marking cleaning fully cloned templates
  implemented by marking them for GC




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1282: CLOUDSTACK-9200: Fixed failed to delete snaps...

2017-04-13 Thread anshul1886
Github user anshul1886 closed the pull request at:

https://github.com/apache/cloudstack/pull/1282


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1867: CLOUDSTACK-9706: Added snapshots cleanup in s...

2017-04-13 Thread anshul1886
GitHub user anshul1886 reopened a pull request:

https://github.com/apache/cloudstack/pull/1867

CLOUDSTACK-9706: Added snapshots cleanup in start and storage GC thre…

…ad if they are failed to cleanup during DeleteSnapshot command

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/anshul1886/cloudstack-1 CLOUDSTACK-9706

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1867.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1867


commit c68931fc64718d8c7f22d401f624ae649effdf94
Author: Anshul Gangwar 
Date:   2016-05-09T07:15:31Z

CLOUDSTACK-9706: Added snapshots cleanup in start and storage GC thread if 
they are failed to cleanup during DeleteSnapshot command




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1282: CLOUDSTACK-9200: Fixed failed to delete snaps...

2017-04-13 Thread anshul1886
Github user anshul1886 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1282#discussion_r111531779
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -245,6 +245,12 @@ public boolean deleteSnapshot(Long snapshotId) {
 return true;
 }
 
+if(snapshotVO.getState() == Snapshot.State.Allocated) {
--- End diff --

@rhtyd Missed that change. Closing PR now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1867: CLOUDSTACK-9706: Added snapshots cleanup in s...

2017-04-13 Thread anshul1886
Github user anshul1886 closed the pull request at:

https://github.com/apache/cloudstack/pull/1867


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2043: CLOUDSTACK-9876: Removed test test_01_test_vm...

2017-04-13 Thread anshul1886
GitHub user anshul1886 opened a pull request:

https://github.com/apache/cloudstack/pull/2043

CLOUDSTACK-9876: Removed test test_01_test_vm_volume_snapshot

As we no longer have that restriction and now after fix for CLOUDSTACK-8663 
we allow VM and volume snapshots to exist together

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/anshul1886/cloudstack-1 CLOUDSTACK-9876

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2043.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2043


commit fa5e59675e2750edc55a4c75ff8770d363c55de7
Author: Anshul Gangwar 
Date:   2017-04-14T05:24:56Z

CLOUDSTACK-9876: Removed test test_01_test_vm_volume_snapshot as we no 
longer have that restriction and now after fix for CLOUDSTACK-8663 we allow VM 
and volume snapshots to exist together




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2042: CLOUDSTACK-9875: Unable to re-apply Explicit ...

2017-04-13 Thread harikrishna-patnala
GitHub user harikrishna-patnala opened a pull request:

https://github.com/apache/cloudstack/pull/2042

CLOUDSTACK-9875: Unable to re-apply Explicit dedication to VM

Problem:
When a VM is deployed with in an Affinity group which has the cluster 
dedicated to a subdomain (zone is dedicated to parent domain) it is getting 
successful. We can also stop the vm and remove the affinity group, but if you 
want to add back the affinity it is failing.

Following are the steps to reproduce

1. I had created a Domain (Glass SA Parent Domain) and under it a subdomain 
(Glass SA Subdomain) and created an account to it.
2. Apply dedication to the zone for primary domain (Glass SA Parent Domain)
3. Apply dedication to the cluster for sub domain (Glass SA Subdomain)
4. Logged in with the Account of Subdomain.
5. Created an instance with the affinity (DedicatedGrp-domain-Glass SA 
Subdomain) - the dedication set with the cluster for the subdomain.
6. Powered off the VM, removed the affinity.
7. Tried adding back (the cluster affinity subdomain) - gives the error 
"Entity affinity Group () and entity Acct () belong to different accounts" 

Root cause:
During VM deployment there is clear check on affinity type 
(account/domain). Here since the acl_type is "domain" it does not expect to be 
same owner for entities.
But during update of affinity to VM there is no specific check for acl_type 
"domain".

Solution:
Fix is to make the access check similar to VM deployment where it does not 
expect to be same owner for entities if the acl_type is "domain".

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Accelerite/cloudstack CLOUDSTACK-9875

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2042.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2042


commit 4f6e5daa580aa5b456e946783cb08cabc4b9c6bc
Author: Harikrishna Patnala 
Date:   2015-11-18T12:03:49Z

CLOUDSTACK-9875: Unable to re-apply Explicit dedication to VM

Problem:
When a VM is deployed with in an Affinity group which has the cluster 
dedicated to a subdomain (zone is dedicated to parent domain) it is getting 
successful. We can also stop the vm and remove the affinity group, but if you 
want to add back the affinity it is failing.

Root cause:
During VM deployment there is clear check on affinity type 
(account/domain). Here since the acl_type is "domain" it does not expect to be 
same owner for entities.
But during update of affinity to VM there is no specific check for acl_type 
"domain".

Solution:
Fix is to make the access check similar to VM deployment where it does not 
expect to be same owner for entities if the acl_type is "domain".




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1950: [4.10] CLOUDSTACK-9462: Build packages on Ubu...

2017-04-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1950


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2033: [master/4.10+] CLOUDSTACK-9462: Support for U...

2017-04-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2033


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2023: BUG-ID: CLOUDSTACK-9808 Added system Vm upgra...

2017-04-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2023


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1282: CLOUDSTACK-9200: Fixed failed to delete snaps...

2017-04-13 Thread Slair1
Github user Slair1 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1282#discussion_r111500346
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -245,6 +245,12 @@ public boolean deleteSnapshot(Long snapshotId) {
 return true;
 }
 
+if(snapshotVO.getState() == Snapshot.State.Allocated) {
--- End diff --

@rhtyd , you're right, this change has since already been merged by PR 
#977.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #914: BUG-ID CLOUDSTACK-8939 VM Snapshot size with m...

2017-04-13 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/914#discussion_r111375928
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
 ---
@@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection 
conn, final VolumeObjectTO v
 }
 }
 if (volumeTo.getVolumeType() == Volume.Type.ROOT) {
-final Map allVMs = VM.getAllRecords(conn);
-// add size of memory snapshot vdi
-if (allVMs != null && allVMs.size() > 0) {
-for (final VM vmr : allVMs.keySet()) {
-try {
-final String vName = vmr.getNameLabel(conn);
-if (vName != null && vName.contains(vmName) && 
vmr.getIsASnapshot(conn)) {
-final VDI memoryVDI = vmr.getSuspendVDI(conn);
-if (!isRefNull(memoryVDI)) {
-size = size + 
memoryVDI.getPhysicalUtilisation(conn);
-final VDI pMemoryVDI = 
memoryVDI.getParent(conn);
-if (!isRefNull(pMemoryVDI)) {
-size = size + 
pMemoryVDI.getPhysicalUtilisation(conn);
+VM vm = getVM(conn, vmName);
--- End diff --

LGTM for code change


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2041: CLOUDSTACK-9873: VR related periodic jobs are...

2017-04-12 Thread Slair1
GitHub user Slair1 opened a pull request:

https://github.com/apache/cloudstack/pull/2041

CLOUDSTACK-9873: VR related periodic jobs are scheduled twice and run twice 
on management servers

The "start" method of VirtualNetworkApplianceManagerImpl schedules several 
period checks, including stats updates, alert updates, and VR checks including 
S2S vpn checks.

VpcVirtualNetworkApplianceManagerImpl extends 
VirtualNetworkApplianceManagerImpl. Thus when 
VpcVirtualNetworkApplianceManagerImpl is used, it re-runs the "start" method 
and once again schedules all the various jobs. Thus all the jobs run twice at 
each scheduled run. This is easily seen in the mangement-server.log (this is 
one of the checks that is doubled-up):

`cat /var/log/cloudstack/management/management-server.log | grep "routers 
to update status"`

Before (runs twice every 30 seconds):
```
2017-04-10 21:48:12,879 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-5f7bc584) (logid:4d5b1031) Found 10 routers to 
update status.
2017-04-10 21:48:12,932 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-d027ab6f) (logid:1bc50629) Found 10 routers to 
update status.
2017-04-10 21:48:42,877 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-2c8f4d18) (logid:e9111785) Found 10 routers to 
update status.
2017-04-10 21:48:42,927 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-1bfd5351) (logid:ad0f95ef) Found 10 routers to 
update status.
2017-04-10 21:49:12,874 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-ede0d2bb) (logid:6f244423) Found 10 routers to 
update status.
2017-04-10 21:49:12,928 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-d58842d5) (logid:8442d73c) Found 10 routers to 
update status.
```
After change (runs once every 30 seconds):
```
2017-04-12 15:19:09,150 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-34e46de7) (logid:280dc634) Found 10 routers to 
update status.
2017-04-12 15:19:39,150 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-5499a10d) (logid:33ca447b) Found 10 routers to 
update status.
2017-04-12 15:20:09,155 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-1df751da) (logid:c8d29e06) Found 10 routers to 
update status.
2017-04-12 15:20:39,152 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-b4cb567a) (logid:a09e1f29) Found 10 routers to 
update status.
2017-04-12 15:21:09,153 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-ab8e4023) (logid:f329b5ff) Found 10 routers to 
update status.
2017-04-12 15:21:39,150 DEBUG [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-04fee930) (logid:32f6619b) Found 10 routers to 
update status.
```
Exacerbates #2040 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Slair1/cloudstack 
CLOUDSTACK-9873-VR-Scheduled-Checks-Scheduled-Twice

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2041.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2041


commit 81d83db5276a77b5c0debd8b5e58cf668e92196d
Author: Slair1 
Date:   2017-04-12T15:17:16Z

VR related periodic jobs are scheduled twice and run twice on management 
servers




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2040: CLOUDSTACK-9872: Gather all S2S vpn statuses ...

2017-04-12 Thread Slair1
GitHub user Slair1 opened a pull request:

https://github.com/apache/cloudstack/pull/2040

CLOUDSTACK-9872: Gather all S2S vpn statuses before outputting

The checkbatchs2svpn.sh VR script returns ("via echo") that status of each 
requested S2S VPN check one-at-a-time.  If there is even a slight delay between 
VPN checks, the sshExecutor stops monitoring stdout and assumes it has all of 
the output.

When checking the management server logs, we see a request to check _X_ 
number of VPNs, but the response is occasionally less than _X_ number... The 
rest of the Cloudstack code assumes "isConnected" as false if the VPN is not 
included in the response.

We've noticed that if an account had more than 3 site-to-site VPNs, that 
there are many errors per day stating that a S2S VPN is down.

This is exacerbated by Issue CLOUDSTACK-9873, because that issues causes 
the S2S VPN check (and many others) to run twice as often as intended.

Example where a request was to check 4x S2S VPN connections, but only 3x 
responses were returned.
```
2017-04-11 17:05:40,444 DEBUG [c.c.h.x.r.CitrixResourceBase] 
(DirectAgent-190:ctx-e894af45) (logid:cbbccfaa) Executing command in VR: 
/opt/cloud/bin/router_proxy.sh checkbatchs2svpn.sh 169.254.2.130 67.41.109.167 
65.100.18.183 67.41.109.165 67.41.109.166

2017-04-11 17:05:41,836 DEBUG [c.c.a.t.Request] 
(DirectAgent-190:ctx-e894af45) (logid:cbbccfaa) Seq 51-772085861117329631: 
Processing:  { Ans: , MgmtId: 345050927939, via: 
51(cloudxen01.dsm1.ippathways.net), Ver: v1, Flags: 110, 
[{"com.cloud.agent.api.CheckS2SVpnConnectionsAnswer":{"ipToConnected":{"65.100.18.183":true,"67.41.109.167":true,"67.41.109.165":true},"ipToDetail":{"65.100.18.183":"ISAKMP
 SA found;IPsec SA found;Site-to-site VPN have 
connected","67.41.109.167":"ISAKMP SA found;IPsec SA found;Site-to-site VPN 
have connected","67.41.109.165":"ISAKMP SA found;IPsec SA found;Site-to-site 
VPN have connected"},"details":"67.41.109.167:0:ISAKMP SA found;IPsec SA 
found;Site-to-site VPN have connected&65.100.18.183:0:ISAKMP SA found;IPsec SA 
found;Site-to-site VPN have connected&67.41.109.165:0:ISAKMP SA found;IPsec SA 
found;Site-to-site VPN have connected&","result":true,"wait":0}}] }
```



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Slair1/cloudstack 
CLOUDSTACK-9872-Check-Batch-S2S-VPN

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2040.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2040


commit 9814be159d87073535716542a4430380e4202576
Author: Slair1 
Date:   2017-04-12T14:58:56Z

Gather all S2S vpn statuses before outputting




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2039: rbd: Use libvirt to create new volumes and no...

2017-04-12 Thread wido
GitHub user wido opened a pull request:

https://github.com/apache/cloudstack/pull/2039

rbd: Use libvirt to create new volumes and not rados-java

Since libvirt 1.2.2 libvirt will properly create volumes
using RBD format 2.

We can use libvirt to creates the volumes which strips a bit of
code from the CloudStack Agent's responsbility.

RBD format 2 is already used by all volumes created by CloudStack.

This format is the most recent format of RBD and is still actively
being developed.

This removes the support for Ubuntu 12.04 as that does not have the
proper libvirt version available.

Signed-off-by: Wido den Hollander 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/wido/cloudstack rbd-create-libvirt

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2039.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2039


commit 808e88c7fcc17b38319f6e3c9f9f5a941bc8ebaa
Author: Wido den Hollander 
Date:   2017-03-28T12:22:58Z

rbd: Use libvirt to create new volumes and not rados-java

Since libvirt 1.2.2 libvirt will properly create volumes
using RBD format 2.

We can use libvirt to creates the volumes which strips a bit of
code from the CloudStack Agent's responsbility.

RBD format 2 is already used by all volumes created by CloudStack.

This format is the most recent format of RBD and is still actively
being developed.

This removes the support for Ubuntu 12.04 as that does not have the
proper libvirt version available.

Signed-off-by: Wido den Hollander 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2038: ipv6: Allow all ICMPv6 traffic if -1 is provi...

2017-04-12 Thread wido
GitHub user wido opened a pull request:

https://github.com/apache/cloudstack/pull/2038

ipv6: Allow all ICMPv6 traffic if -1 is provided as a ICMP type

ip6tables no longer takes '--icmpv6-type any' as a argument.

To allow all ICMPv6 traffic with ip6tables it has to be invoked this way:

  $ ip6tables -I i-2-14-VM -p icmpv6 -s ::/0 -j ACCEPT

All ICMPv6 traffic is now allow into the Instance.

Signed-off-by: Wido den Hollander 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/wido/cloudstack ipv6-icmpv6all

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2038.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2038


commit eaffe3a13bdbcc03ed4af1f1115c147f62e3de10
Author: Wido den Hollander 
Date:   2017-04-12T13:02:30Z

ipv6: Allow all ICMPv6 traffic if -1 is provided as a ICMP type

ip6tables no longer takes '--icmpv6-type any' as a argument.

To allow all ICMPv6 traffic with ip6tables it has to be invoked this way:

  $ ip6tables -I i-2-14-VM -p icmpv6 -s ::/0 -j ACCEPT

All ICMPv6 traffic is now allow into the Instance.

Signed-off-by: Wido den Hollander 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2033: [master/4.10+] CLOUDSTACK-9462: Support for U...

2017-04-12 Thread rhtyd
Github user rhtyd closed the pull request at:

https://github.com/apache/cloudstack/pull/2033


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2033: [master/4.10+] CLOUDSTACK-9462: Support for U...

2017-04-12 Thread rhtyd
GitHub user rhtyd reopened a pull request:

https://github.com/apache/cloudstack/pull/2033

[master/4.10+] CLOUDSTACK-9462: Support for Ubuntu 14.04/16.04 with 
tomcat6/tomcat7

This extends work from @ustcweizhou from 
https://github.com/apache/cloudstack/pull/1950 by fixing some build issues to 
make this work with Ubuntu 14.04 and 16.04.

This closes #1950

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack 
ubuntu1604-fixsystemd-weiz

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2033.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2033


commit 4a77a799490a0cd655b1a53377c4db1bb51ddc7c
Author: Wei Zhou 
Date:   2017-02-17T08:59:52Z

CLOUDSTACK-9462: Build packages on Ubuntu 14.04/16.04 and support 
tomcat6/tomcat7

Changes
(1) add systemd support in debian/control and debian/rules for 16.04
(2) add python-setuptools in Build-Depends in debian/control
(3) seperate cloudstack-management.service and 
cloudstack-management.default for CentOS7 and Ubuntu 16.04
(4) add server7-ssl.xml and server7-nonssl.xml in management installation
(5) link /usr/share/cloudstack-management/lib and 
/usr/share/cloudstack-management/bin to correct path (tomcat6 or tomcat7)
(6) link /etc/cloudstack/management/server.xml to correct file path 
(server-nonssl.xml or server7-nonssl.xml)
(7) remove *.zip from .gitignore to avoid build error caused by missing 
/vhds/test.vhd.zip

Instruction
(1) build packages on Ubuntu 16.04: dpkg-buildpackage -uc -us
Output on Ubuntu 16.04:
-rw-r--r-- 1 root root  4090 Feb 17 10:12 
cloudstack_4.10.0.0-SNAPSHOT_amd64.changes
-rw-r--r-- 1 root root  1235 Feb 17 09:53 
cloudstack_4.10.0.0-SNAPSHOT.dsc
-rw-r--r-- 1 root root   8018248 Feb 17 09:53 
cloudstack_4.10.0.0-SNAPSHOT.tar.xz
-rw-r--r-- 1 root root  91868746 Feb 17 10:11 
cloudstack-agent_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 52882 Feb 17 10:12 
cloudstack-cli_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root  98556216 Feb 17 10:08 
cloudstack-common_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 52864 Feb 17 10:12 
cloudstack-docs_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root585434 Feb 17 10:12 
cloudstack-integration-tests_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 323459934 Feb 17 10:10 
cloudstack-management_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root442656 Feb 17 10:12 
cloudstack-marvin_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root  87037576 Feb 17 10:12 
cloudstack-usage_4.10.0.0-SNAPSHOT_all.deb

(2) setup tomcat6/tomcat7 on management server:
tomcat6: cloudstack-setup-management --tomcat6
tomcat7: cloudstack-setup-management --tomcat7

Signed-off-by: Rohit Yadav 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2037: CLOUDSTACK-9871: Set SQL Mode in SQL Session ...

2017-04-12 Thread wido
GitHub user wido opened a pull request:

https://github.com/apache/cloudstack/pull/2037

CLOUDSTACK-9871: Set SQL Mode in SQL Session for MySQL 5.7 compatibility

MySQL 5.7 has a more strict SQL mode by default with which CloudStack
is not compatible.

By setting the SQL Mode to a more relaxed mode on run-time we can
run without changing any SQL server settings.

Admins could also apply this to the [mysqld] section of their my.cnf:

sql_mode = 
'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

Signed-off-by: Wido den Hollander 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/wido/cloudstack sql_mode

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2037.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2037


commit d3f307b1b06da095db7f4410b9e7505182b726af
Author: Wido den Hollander 
Date:   2017-04-12T07:48:16Z

CLOUDSTACK-9871: Set SQL Mode in SQL Session for MySQL 5.7 compatibility

MySQL 5.7 has a more strict SQL mode by default with which CloudStack
is not compatible.

By setting the SQL Mode to a more relaxed mode on run-time we can
run without changing any SQL server settings.

Admins could also apply this to the [mysqld] section of their my.cnf:

sql_mode = 
'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

Signed-off-by: Wido den Hollander 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...

2017-04-12 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1996#discussion_r111075302
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java ---
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.user;
+
+
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.RegisterResponse;
+import org.apache.cloudstack.api.response.UserResponse;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+@APICommand(name = "getUserKeys",
+description = "This command allows the user to query the 
seceret and API keys for the account",
+responseObject = RegisterResponse.class,
+requestHasSensitiveInfo = false,
+responseHasSensitiveInfo = true,
+authorized = {RoleType.User})
+
+public class GetUserKeysCmd extends BaseCmd{
+
+@Parameter(name= ApiConstants.ID, type = CommandType.UUID, entityType 
= UserResponse.class, required = true, description = "ID of the user whose keys 
are required")
+private Long id;
+
+public static final Logger s_logger = 
Logger.getLogger(RegisterCmd.class.getName());
+public static final String s_name = "getuserkeysresponse";
+
+public Long getID(){
+return id;
+}
+
+public String getCommandName(){
+return s_name;
+}
+
+public long getEntityOwnerId(){
+User user = _entityMgr.findById(User.class, getID());
+if(user != null){
+return user.getAccountId();
+}
+else return Account.ACCOUNT_ID_SYSTEM;
+}
+public void execute(){
+List keys = _accountService.getKeys(this);
+RegisterResponse response = new RegisterResponse();
+if(keys != null){
+response.setApiKey(keys.get(0));
+response.setSecretKey(keys.get(1));
+}
+
+response.setObjectName("listkeys");
--- End diff --

Should this be 'userKeys'?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...

2017-04-12 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1996#discussion_r111075076
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java ---
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.user;
+
+
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.RegisterResponse;
+import org.apache.cloudstack.api.response.UserResponse;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+@APICommand(name = "getUserKeys",
+description = "This command allows the user to query the 
seceret and API keys for the account",
+responseObject = RegisterResponse.class,
+requestHasSensitiveInfo = false,
+responseHasSensitiveInfo = true,
+authorized = {RoleType.User})
--- End diff --

Can you add the 'since' parameter? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...

2017-04-12 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1996#discussion_r111078382
  
--- Diff: server/src/com/cloud/api/ApiDBUtils.java ---
@@ -559,6 +561,8 @@
 @Inject
 private VpcManager vpcMgr;
 @Inject
+private AccountManager accountManager;
--- End diff --

Why there is a need to inject AccountManager? If the config key is a static 
it can be accessed as AccountManager.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1740: CLOUDSTACK-9572 Snapshot on primary storage n...

2017-04-12 Thread yvsubhash
Github user yvsubhash closed the pull request at:

https://github.com/apache/cloudstack/pull/1740


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2025: [4.10-blocker] Fix error in restart network i...

2017-04-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2025


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2022: [dvswitch blocker] CLOUDSTACK-9591: Fix syste...

2017-04-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2022


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2036: [CLOUDSTACK-9858] Retirement of midonet plugi...

2017-04-11 Thread rafaelweingartner
GitHub user rafaelweingartner opened a pull request:

https://github.com/apache/cloudstack/pull/2036

[CLOUDSTACK-9858] Retirement of midonet plugin (build disabling)

Recently there have been two threads asking and discussing the 
“midonet” integration with Apache CloudStack (ACS) [1-2].

After quite some discussions, we noticed that despite having some people 
willing to use it, the plugin has never been fully developed by its vendor 
(Midokura). Further, nobody else has put the effort on fully testing and 
finishing its implementation. It seems that the plugin was incorporated into 
our code base without being fully finished. Moreover, I have asked around at 
the Midonet community, and the java client they use has changed quite a bit 
from the one we use.

It begs the question if it does not work, why do we advertise such 
integration? [3]. 
Following the component retirement process defined in [4], a vote thread 
was started in [5]. The community decided to retire this Midonet plugin. This 
task represents the first step of the retirement, which is the disabling of the 
plugin in CloudStack`s build process.
 
[1] 
http://cloudstack.markmail.org/thread/qyedle5jb2c34gsc#query:+page:1+mid:xn2zq2v3eim5vl2q+state:results
[2] 
http://cloudstack.markmail.org/message/rewzk4v7dgzpsxkm?q=midonet+order:date-backward=1#query:midonet%20order%3Adate-backward+page:1+mid:i563khxlginf6smg+state:results
[3] http://docs.cloudstack.apache.org/en/latest/networking/midonet.html
[4] 
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=68720798
[5] http://markmail.org/message/qigrtfirwnmct4hr

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/rafaelweingartner/cloudstack 
midoneDisablingForRetirement

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2036.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2036


commit a3f351c07e73e4a207d10e3d23003c81cb3ab58b
Author: Rafael Weingartner 
Date:   2017-04-11T20:04:10Z

[CLOUDSTACK-9858] Retirement of midonet plugin (build disabling)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1721: CLOUDSTACK-9557 Deploy from VMsnapshot fails ...

2017-04-11 Thread yvsubhash
Github user yvsubhash closed the pull request at:

https://github.com/apache/cloudstack/pull/1721


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #827: BUG-ID: CLOUDSTACK-8849: Usage job should stop...

2017-04-11 Thread yvsubhash
Github user yvsubhash closed the pull request at:

https://github.com/apache/cloudstack/pull/827


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110854129
  
--- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
@@ -848,13 +849,38 @@ public int compare(final PublicIpAddress o1, final 
PublicIpAddress o2) {
 associatedWithNetworkId = ipAddrList.get(0).getNetworkId();
 }
 
+// for network if the ips does not have any rules, then only 
last ip
+List userIps = 
_ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+
+int ipsWithrules = 0;
+int ipsStaticNat = 0;
+for (IPAddressVO ip : userIps) {
+if ( _rulesDao.countRulesByIpIdAndState(ip.getId(), 
FirewallRule.State.Active) > 0 ) {
--- End diff --

Updated


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110854097
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -230,5 +230,11 @@ JOIN `cloud`.`vm_snapshots` s ON 
(s.service_offering_id = o.id AND s.vm_id = v.i
 WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND
 (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory');
 
+<<< 1c48deefe9b534198cad19b5528ce0dcfa8d04a5
 -- CLOUDSTACK-9827: Storage tags stored in multiple places
 DROP VIEW IF EXISTS `cloud`.`storage_tag_view`;
+
+ALTER TABLE `user_ip_address` ADD COLUMN `rule_state` VARCHAR(32) COMMENT 
'static  rule state while removing';
+===
--- End diff --

Corrected


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110854055
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -230,5 +230,11 @@ JOIN `cloud`.`vm_snapshots` s ON 
(s.service_offering_id = o.id AND s.vm_id = v.i
 WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND
 (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory');
 
+<<< 1c48deefe9b534198cad19b5528ce0dcfa8d04a5
--- End diff --

My bad, on multiple times rebase some how I missed it. Corrected now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread ProjectMoon
Github user ProjectMoon commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110848750
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -230,5 +230,11 @@ JOIN `cloud`.`vm_snapshots` s ON 
(s.service_offering_id = o.id AND s.vm_id = v.i
 WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND
 (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory');
 
+<<< 1c48deefe9b534198cad19b5528ce0dcfa8d04a5
 -- CLOUDSTACK-9827: Storage tags stored in multiple places
 DROP VIEW IF EXISTS `cloud`.`storage_tag_view`;
+
+ALTER TABLE `user_ip_address` ADD COLUMN `rule_state` VARCHAR(32) COMMENT 
'static  rule state while removing';
+===
--- End diff --

Conflict line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread ProjectMoon
Github user ProjectMoon commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110849362
  
--- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
@@ -848,13 +849,38 @@ public int compare(final PublicIpAddress o1, final 
PublicIpAddress o2) {
 associatedWithNetworkId = ipAddrList.get(0).getNetworkId();
 }
 
+// for network if the ips does not have any rules, then only 
last ip
+List userIps = 
_ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+
+int ipsWithrules = 0;
+int ipsStaticNat = 0;
+for (IPAddressVO ip : userIps) {
+if ( _rulesDao.countRulesByIpIdAndState(ip.getId(), 
FirewallRule.State.Active) > 0 ) {
--- End diff --

Inconsistent formatting of the parentheses in the `if`. A bit nitpicky, but 
the code has to adhere to format.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-11 Thread ProjectMoon
Github user ProjectMoon commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110848709
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -230,5 +230,11 @@ JOIN `cloud`.`vm_snapshots` s ON 
(s.service_offering_id = o.id AND s.vm_id = v.i
 WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND
 (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory');
 
+<<< 1c48deefe9b534198cad19b5528ce0dcfa8d04a5
--- End diff --

It seems you got a conflict stuck in the file.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-10 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110818988
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
 ---
@@ -625,15 +627,20 @@ protected ExecutionResult 
cleanupNetworkElementCommand(final IpAssocCommand cmd)
 
 // there is only one ip in this public vlan and removing 
it, so
 // remove the nic
-if (ipsCount == 1 && !ip.isAdd()) {
-removeVif = true;
+if (lastIp != null && lastIp.equalsIgnoreCase("true") && 
!ip.isAdd()) {
--- End diff --

@ProjectMoon  
Updated to use org.apache.commons.lang.StringUtils
Can you please review it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1826: CLOUDSTACK-9675: Cloudstack Metrics Miscellan...

2017-04-10 Thread rashmidixit
Github user rashmidixit closed the pull request at:

https://github.com/apache/cloudstack/pull/1826


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2026: CLOUDSTACK-9861: Expire VM snapshots after co...

2017-04-10 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2026#discussion_r110594291
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -232,3 +232,5 @@ WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size 
IS NULL) AND
 
 -- CLOUDSTACK-9827: Storage tags stored in multiple places
 DROP VIEW IF EXISTS `cloud`.`storage_tag_view`;
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 
'VMSanpshotManager', 'vmsnapshot.expire.interval', '-1', 'VM Snapshot expire 
interval in hours','-1', NULL, 'Account', 0);
--- End diff --

@rhtd removed the upgrade sql


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1935: CLOUDSTACK-9764: Delete domain failure due to...

2017-04-07 Thread nvazquez
Github user nvazquez commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1935#discussion_r110421451
  
--- Diff: server/test/com/cloud/user/DomainManagerImplTest.java ---
@@ -134,4 +164,69 @@ public void testFindDomainByIdOrPathValidId() {
 Assert.assertEquals(domain, domainManager.findDomainByIdOrPath(1L, 
"/validDomain/"));
 }
 
+@Test(expected=InvalidParameterValueException.class)
+public void testDeleteDomainNullDomain() {
+Mockito.when(_domainDao.findById(DOMAIN_ID)).thenReturn(null);
+domainManager.deleteDomain(DOMAIN_ID, testDomainCleanup);
+}
+
+@Test(expected=PermissionDeniedException.class)
+public void testDeleteDomainRootDomain() {
+
Mockito.when(_domainDao.findById(Domain.ROOT_DOMAIN)).thenReturn(domain);
+domainManager.deleteDomain(Domain.ROOT_DOMAIN, testDomainCleanup);
+}
+
+@Test
+public void testDeleteDomainNoCleanup() {
+domainManager.deleteDomain(DOMAIN_ID, testDomainCleanup);
+Mockito.verify(domainManager).deleteDomain(domain, 
testDomainCleanup);
+
Mockito.verify(domainManager).removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+Mockito.verify(domainManager).cleanupDomainOfferings(DOMAIN_ID);
+Mockito.verify(lock).unlock();
+}
+
+@Test
+public void 
testRemoveDomainWithNoAccountsForCleanupNetworksOrDedicatedResourcesRemoveDomain()
 {
+
domainManager.removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+
Mockito.verify(domainManager).publishRemoveEventsAndRemoveDomain(domain);
+}
+
+@Test(expected=CloudRuntimeException.class)
+public void 
testRemoveDomainWithNoAccountsForCleanupNetworksOrDedicatedResourcesDontRemoveDomain()
 {
+domainNetworkIds.add(2l);
+
domainManager.removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+Mockito.verify(domainManager).failRemoveOperation(domain, 
domainAccountsForCleanup, domainNetworkIds, false);
+}
+
+@Test
+public void testPublishRemoveEventsAndRemoveDomainSuccessfulDelete() {
+domainManager.publishRemoveEventsAndRemoveDomain(domain);
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_PRE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_domainDao).remove(DOMAIN_ID);
+}
+
+@Test(expected=CloudRuntimeException.class)
+public void testPublishRemoveEventsAndRemoveDomainExceptionDelete() {
+Mockito.when(_domainDao.remove(DOMAIN_ID)).thenReturn(false);
+domainManager.publishRemoveEventsAndRemoveDomain(domain);
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_PRE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_messageBus, 
Mockito.never()).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_domainDao).remove(DOMAIN_ID);
+}
+
+@Test
+public void testFailRemoveOperation() {
+try {
+domainManager.failRemoveOperation(domain, 
domainAccountsForCleanup, domainNetworkIds, true);
--- End diff --

Great, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1935: CLOUDSTACK-9764: Delete domain failure due to...

2017-04-07 Thread nvazquez
Github user nvazquez commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1935#discussion_r110421376
  
--- Diff: server/src/com/cloud/user/DomainManagerImpl.java ---
@@ -273,82 +284,145 @@ public boolean deleteDomain(long domainId, Boolean 
cleanup) {
 
 @Override
 public boolean deleteDomain(DomainVO domain, Boolean cleanup) {
-// mark domain as inactive
-s_logger.debug("Marking domain id=" + domain.getId() + " as " + 
Domain.State.Inactive + " before actually deleting it");
-domain.setState(Domain.State.Inactive);
-_domainDao.update(domain.getId(), domain);
-boolean rollBackState = false;
-boolean hasDedicatedResources = false;
+GlobalLock lock = getGlobalLock("AccountCleanup");
+if (lock == null) {
+s_logger.debug("Couldn't get the global lock");
+return false;
+}
+
+if (!lock.lock(30)) {
+s_logger.debug("Couldn't lock the db");
+return false;
+}
 
 try {
-long ownerId = domain.getAccountId();
-if ((cleanup != null) && cleanup.booleanValue()) {
-if (!cleanupDomain(domain.getId(), ownerId)) {
-rollBackState = true;
-CloudRuntimeException e =
-new CloudRuntimeException("Failed to clean up 
domain resources and sub domains, delete failed on domain " + domain.getName() 
+ " (id: " +
-domain.getId() + ").");
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
-}
-} else {
-//don't delete the domain if there are accounts set for 
cleanup, or non-removed networks exist, or domain has dedicated resources
-List networkIds = 
_networkDomainDao.listNetworkIdsByDomain(domain.getId());
-List accountsForCleanup = 
_accountDao.findCleanupsForRemovedAccounts(domain.getId());
-List dedicatedResources = 
_dedicatedDao.listByDomainId(domain.getId());
-if (dedicatedResources != null && 
!dedicatedResources.isEmpty()) {
-s_logger.error("There are dedicated resources for the 
domain " + domain.getId());
-hasDedicatedResources = true;
-}
-if (accountsForCleanup.isEmpty() && networkIds.isEmpty() 
&& !hasDedicatedResources) {
-_messageBus.publish(_name, 
MESSAGE_PRE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain);
-if (!_domainDao.remove(domain.getId())) {
-rollBackState = true;
-CloudRuntimeException e =
-new CloudRuntimeException("Delete failed on 
domain " + domain.getName() + " (id: " + domain.getId() +
-"); Please make sure all users and sub 
domains have been removed from the domain before deleting");
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
-}
-_messageBus.publish(_name, 
MESSAGE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain);
+// mark domain as inactive
+s_logger.debug("Marking domain id=" + domain.getId() + " as " 
+ Domain.State.Inactive + " before actually deleting it");
+domain.setState(Domain.State.Inactive);
+_domainDao.update(domain.getId(), domain);
+
+boolean rollBackState = false;
+
+try {
+long ownerId = domain.getAccountId();
+if (BooleanUtils.toBoolean(cleanup)) {
+tryCleanupDomain(domain, ownerId);
 } else {
-rollBackState = true;
-String msg = null;
-if (!accountsForCleanup.isEmpty()) {
-msg = accountsForCleanup.size() + " accounts to 
cleanup";
-} else if (!networkIds.isEmpty()) {
-msg = networkIds.size() + " non-removed networks";
-} else if (hasDedicatedResources) {
-msg = "dedicated resources.";
-}
+
removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+}
 
-CloudRuntimeException e = new 
CloudRuntimeException("Can't delete the domain yet because it has " + msg);
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
+

[GitHub] cloudstack pull request #2034: [4.9+][network blocker] CLOUDSTACK-9838: Allo...

2017-04-07 Thread rhtyd
Github user rhtyd closed the pull request at:

https://github.com/apache/cloudstack/pull/2034


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2034: [4.9+][network blocker] CLOUDSTACK-9838: Allo...

2017-04-07 Thread rhtyd
GitHub user rhtyd reopened a pull request:

https://github.com/apache/cloudstack/pull/2034

[4.9+][network blocker] CLOUDSTACK-9838: Allow ingress traffic between 
guest VMs via snat IPs

This enables the firewall/mangle tables rules to ACCEPT instead of RETURN, 
which
is the same behaviour as observed in ACS 4.5. By accepting the traffic, 
guest
VMs will be able to communicate tcp traffic between each other over snat 
public
IPs.

This is a regression from ACS 4.5, observed in ACS 4.9.2.0.
Pinging for review - @PaulAngus @borisstoyanov @DagSonsteboSB 
@abhinandanprateek @DaanHoogland and others

@blueorangutan package

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack CLOUDSTACK-9838

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2034.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2034


commit f4835294869f01def94618f2c206160ccb3b719f
Author: Rohit Yadav 
Date:   2017-04-07T11:44:18Z

CLOUDSTACK-9838: Allow ingress traffic between guest VMs via snat IPs

This enables the firewall/mangle tables rules to ACCEPT instead of RETURN, 
which
is the same behaviour as observed in ACS 4.5. By accepting the traffic, 
guest
VMs will be able to communicate tcp traffic between each other over snat 
public
IPs.

Signed-off-by: Rohit Yadav 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2035: CLOUDSTACK-9867:VM snapshot on primary storag...

2017-04-07 Thread abhinandanprateek
GitHub user abhinandanprateek opened a pull request:

https://github.com/apache/cloudstack/pull/2035

CLOUDSTACK-9867:VM snapshot on primary storage usage metrics



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack ir24

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2035.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2035


commit 8f9e93316c66907246be1d653da27ae9feb5a27c
Author: Abhinandan Prateek 
Date:   2017-03-22T06:54:19Z

CLOUDSTACK-9867:VM snapshot on primary storage usage metrics




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2034: [4.9+][network blocker] CLOUDSTACK-9838: Allo...

2017-04-07 Thread rhtyd
GitHub user rhtyd opened a pull request:

https://github.com/apache/cloudstack/pull/2034

[4.9+][network blocker] CLOUDSTACK-9838: Allow ingress traffic between 
guest VMs via snat IPs

This enables the firewall/mangle tables rules to ACCEPT instead of RETURN, 
which
is the same behaviour as observed in ACS 4.5. By accepting the traffic, 
guest
VMs will be able to communicate tcp traffic between each other over snat 
public
IPs.

This is a regression from ACS 4.5, observed in ACS 4.9.2.0.
Pinging for review - @PaulAngus @borisstoyanov @DagSonsteboSB 
@abhinandanprateek @DaanHoogland and others

@blueorangutan package

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack CLOUDSTACK-9838

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2034.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2034


commit f4835294869f01def94618f2c206160ccb3b719f
Author: Rohit Yadav 
Date:   2017-04-07T11:44:18Z

CLOUDSTACK-9838: Allow ingress traffic between guest VMs via snat IPs

This enables the firewall/mangle tables rules to ACCEPT instead of RETURN, 
which
is the same behaviour as observed in ACS 4.5. By accepting the traffic, 
guest
VMs will be able to communicate tcp traffic between each other over snat 
public
IPs.

Signed-off-by: Rohit Yadav 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2033: [Ignore] Test PR

2017-04-07 Thread rhtyd
GitHub user rhtyd opened a pull request:

https://github.com/apache/cloudstack/pull/2033

[Ignore] Test PR

See https://github.com/apache/cloudstack/pull/1950

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack 
ubuntu1604-fixsystemd-weiz

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2033.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2033


commit d87fc8a69d0f4cc1147aef03adf5594f3a5fc6cb
Author: Wei Zhou 
Date:   2017-02-17T08:59:52Z

CLOUDSTACK-9462: Build packages on Ubuntu 14.04/16.04 and support 
tomcat6/tomcat7

Changes
(1) add systemd support in debian/control and debian/rules for 16.04
(2) add python-setuptools in Build-Depends in debian/control
(3) seperate cloudstack-management.service and 
cloudstack-management.default for CentOS7 and Ubuntu 16.04
(4) add server7-ssl.xml and server7-nonssl.xml in management installation
(5) link /usr/share/cloudstack-management/lib and 
/usr/share/cloudstack-management/bin to correct path (tomcat6 or tomcat7)
(6) link /etc/cloudstack/management/server.xml to correct file path 
(server-nonssl.xml or server7-nonssl.xml)
(7) remove *.zip from .gitignore to avoid build error caused by missing 
/vhds/test.vhd.zip

Instruction
(1) build packages on Ubuntu 16.04: dpkg-buildpackage -uc -us
Output on Ubuntu 16.04:
-rw-r--r-- 1 root root  4090 Feb 17 10:12 
cloudstack_4.10.0.0-SNAPSHOT_amd64.changes
-rw-r--r-- 1 root root  1235 Feb 17 09:53 
cloudstack_4.10.0.0-SNAPSHOT.dsc
-rw-r--r-- 1 root root   8018248 Feb 17 09:53 
cloudstack_4.10.0.0-SNAPSHOT.tar.xz
-rw-r--r-- 1 root root  91868746 Feb 17 10:11 
cloudstack-agent_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 52882 Feb 17 10:12 
cloudstack-cli_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root  98556216 Feb 17 10:08 
cloudstack-common_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 52864 Feb 17 10:12 
cloudstack-docs_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root585434 Feb 17 10:12 
cloudstack-integration-tests_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root 323459934 Feb 17 10:10 
cloudstack-management_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root442656 Feb 17 10:12 
cloudstack-marvin_4.10.0.0-SNAPSHOT_all.deb
-rw-r--r-- 1 root root  87037576 Feb 17 10:12 
cloudstack-usage_4.10.0.0-SNAPSHOT_all.deb

(2) setup tomcat6/tomcat7 on management server:
tomcat6: cloudstack-setup-management --tomcat6
tomcat7: cloudstack-setup-management --tomcat7

Already tested on Ubuntu 16.04, upgraded from 4.7.1 to 4.10.0-SNAPSHOT

commit 038bed94fcebd6404393a087dd6f2d5ebbf7a410
Author: Rohit Yadav 
Date:   2017-04-07T06:50:54Z

CLOUDSTACK-9462: Fix init-system-helpers version in debian control

Signed-off-by: Rohit Yadav 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2032: CLOUDSTACK-9783: corrected the version number...

2017-04-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2032


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2032: CLOUDSTACK-9783: corrected the version number...

2017-04-06 Thread karuturi
GitHub user karuturi opened a pull request:

https://github.com/apache/cloudstack/pull/2032

CLOUDSTACK-9783: corrected the version number in metrics pom

master is broken after fwd-merging metrics PR #1944 from 4.9
This is due to the incorrect parent version number in the metrics pom.
Corrected the same to reflect master version number.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Accelerite/cloudstack master-fix-after-1944

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2032.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2032


commit e1c76dcc235fd350f87725adaf359619331db278
Author: Rajani Karuturi 
Date:   2017-04-07T04:22:27Z

CLOUDSTACK-9783: corrected the version number in metrics pom

master is broken after fwd-merging metrics PR #1944 from 4.9
This is due to the incorrect parent version number in the metrics pom.
Corrected the same to reflect master version number.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2031: CLOUDSTACK - 8672 : Test PR

2017-04-06 Thread nitin-maharana
GitHub user nitin-maharana opened a pull request:

https://github.com/apache/cloudstack/pull/2031

CLOUDSTACK - 8672 : Test PR

Currently running with few commit. Please don't review this PR.
According to the result of this PR, I will update in original PR(1859).

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Accelerite/cloudstack CLOUDSTACK-8672-TEST

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2031.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2031


commit 58aec81013b44a2e83052adc2a9f9c802210e7db
Author: Rajesh Battala 
Date:   2015-07-23T08:44:07Z

CLOUDSTACK-8672 : NCC Integration with CloudStack.

commit 2ce10b7d97b63edfb24465dfd22a525f99ee1b90
Author: Priyank Parihar 
Date:   2015-08-07T11:10:00Z

CLOUDSTACK-8672 : NCC Integration with CloudStack.

commit b0b1914985320f62ca3f8c0838ea8e10dd28
Author: Nitin Kumar Maharana 
Date:   2015-08-07T11:40:13Z

CLOUDSTACK-8672 : NCC Integration with CloudStack.

commit 29e4f70742ce0a9b91cb3111bac282b5a0cd8331
Author: Sowmya Krishnan 
Date:   2017-01-25T11:47:43Z

CLOUDSTACK-8672 : NCC Integration with CloudStack.
Marvin Integration Tests for Shared and Dedicated Workflow.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1889: CLOUDSTACK-9718: Revamp the dropdown showing ...

2017-04-06 Thread rashmidixit
Github user rashmidixit closed the pull request at:

https://github.com/apache/cloudstack/pull/1889


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1889: CLOUDSTACK-9718: Revamp the dropdown showing ...

2017-04-06 Thread rashmidixit
GitHub user rashmidixit reopened a pull request:

https://github.com/apache/cloudstack/pull/1889

CLOUDSTACK-9718: Revamp the dropdown showing lists of hosts available for 
migration in a Zone

Refer to 
[CLOUDSTACK-9718](https://issues.apache.org/jira/browse/CLOUDSTACK-9718) for 
more details.

Problem: All the hosts suitable for VM Migration are not shown in the UI. 
This could
confuse the user as the target host might never be shown in the UI.

Root Cause: The API (findHostsForMigration) always returned page 1 results 
which would
be always <= default.page.size global parameter. Therefore, in case of large
no. of hosts where the result can map to multiple pages, this issue would 
arise.

Solution: 1. Replace drop-down with listView widget.
2. Allow lazy-loading of records on listView's scroll.
3. Show additional parameters (CPU/Memory used) to assist admin in decision 
making.
4. Provide 'Search by host name' to limit the results.

Conflicts:
client/WEB-INF/classes/resources/messages.properties
client/WEB-INF/classes/resources/messages_ja_JP.properties
client/WEB-INF/classes/resources/messages_zh_CN.properties
ui/css/cloudstack3.css
ui/dictionary2.jsp

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Accelerite/cloudstack CLOUDSTACK-9718

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1889.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1889


commit d8158fe5f4bcdbe58fac4fde1969253f31cdce47
Author: rashmidixit 
Date:   2017-03-16T10:35:22Z

 CLOUDSTACK-9718: Revamp the dropdown showing lists of hosts available for 
migration in a Zone

Reviewed-By: Rashmi Dixit

Problem: All the hosts suitable for VM Migration are not shown in the 
UI. This could
confuse the user as the target host might never be shown in the UI.

Root Cause: The API (findHostsForMigration) always returned page 1 
results which would
be always <= default.page.size global parameter. Therefore, in case of 
large
no. of hosts where the result can map to multiple pages, this issue 
would arise.

Solution: 1. Replace drop-down with listView widget.
2. Allow lazy-loading of records on listView's scroll.
3. Show additional parameters (CPU/Memory used) to assist admin in 
decision making.
4. Provide 'Search by host name' to limit the results.

Added change where if there are no hosts found, an empty row with message 
will
appear.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2030: WIP: CLOUDSTACK-9864 cleanup stale worker VMs...

2017-04-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2030#discussion_r110145877
  
--- Diff: 
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
 ---
@@ -550,15 +552,21 @@ public boolean needRecycle(String workerTag) {
 return true;
 }
 
-// disable time-out check until we have found out a VMware API 
that can check if
-// there are pending tasks on the subject VM
-/*
-if(System.currentTimeMillis() - startTick > 
_hungWorkerTimeout) {
-if(s_logger.isInfoEnabled())
-s_logger.info("Worker VM expired, seconds elapsed: 
" + (System.currentTimeMillis() - startTick) / 1000);
-return true;
-}
- */
+// this time-out check was disabled
+// "until we have found out a VMware API that can check if there 
are pending tasks on the subject VM"
+// but as we expire jobs and those stale worker VMs stay around 
untill an MS reboot we opt in to have them removed anyway
+Long hungWorkerTimeout = 2 * 
(AsyncJobManagerImpl.JobExpireMinutes.value() + 
AsyncJobManagerImpl.JobCancelThresholdMinutes.value()) * MILISECONDS_PER_MINUTE;
+Long letsSayNow = System.currentTimeMillis();
+if(s_vmwareCleanOldWorderVMs.value() && letsSayNow - startTick > 
hungWorkerTimeout) {
+if(s_logger.isInfoEnabled()) {
+s_logger.info("Worker VM expired, seconds elapsed: " + 
(System.currentTimeMillis() - startTick) / 1000);
+}
--- End diff --

For timeouts you may want to use java Duration, that is much cleaner.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2030: WIP: CLOUDSTACK-9864 cleanup stale worker VMs...

2017-04-06 Thread abhinandanprateek
Github user abhinandanprateek commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2030#discussion_r110145761
  
--- Diff: 
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
 ---
@@ -128,6 +129,7 @@
 public class VmwareManagerImpl extends ManagerBase implements 
VmwareManager, VmwareStorageMount, Listener, VmwareDatacenterService, 
Configurable {
 private static final Logger s_logger = 
Logger.getLogger(VmwareManagerImpl.class);
 
+private static final long MILISECONDS_PER_MINUTE = 6;
--- End diff --

MILI typo MILLISECONDS ..


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-06 Thread ProjectMoon
Github user ProjectMoon commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110113725
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
 ---
@@ -625,15 +627,20 @@ protected ExecutionResult 
cleanupNetworkElementCommand(final IpAssocCommand cmd)
 
 // there is only one ip in this public vlan and removing 
it, so
 // remove the nic
-if (ipsCount == 1 && !ip.isAdd()) {
-removeVif = true;
+if (lastIp != null && lastIp.equalsIgnoreCase("true") && 
!ip.isAdd()) {
--- End diff --

True, but a lot of the other code is already using StringUtils or is moving 
to it. Reviewers in other PRs tend to recommend it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-06 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110112007
  
--- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
@@ -848,13 +849,37 @@ public int compare(final PublicIpAddress o1, final 
PublicIpAddress o2) {
 associatedWithNetworkId = ipAddrList.get(0).getNetworkId();
 }
 
+// for network if the ips does not have any rules, then only 
last ip
+List userIps = 
_ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+
+int ipsWithrules = 0;
+int ipsStaticNat = 0;
+for (IPAddressVO ip : userIps) {
+if ( _rulesDao.countRulesByIpIdAndState(ip.getId(), 
FirewallRule.State.Active) > 0 ) {
+ipsWithrules++;
+}
+
+// check onetoonenat and also check if the ip "add":false. 
If there are 2 PF remove 1 static nat add
+if (ip.isOneToOneNat() && ip.getRuleState() == null) {
+ipsStaticNat++;
+}
+}
+
 final IpAssocCommand cmd = new IpAssocCommand(ipsToSend);
 cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, 
_routerControlHelper.getRouterControlIp(router.getId()));
 cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, 
_routerControlHelper.getRouterIpInNetwork(associatedWithNetworkId, 
router.getId()));
 cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, 
router.getInstanceName());
 final DataCenterVO dcVo = 
_dcDao.findById(router.getDataCenterId());
 cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, 
dcVo.getNetworkType().toString());
 
+// if there 1 static nat then it will be checked for remove at 
the resource
+if (ipsWithrules == 0 && ipsStaticNat == 0 ) {
--- End diff --

If we check the ipsStaticNat=1 then we will miss the case of disabling 
static nat on  network with 1 with static nat.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-06 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r11089
  
--- Diff: server/src/com/cloud/network/router/CommandSetupHelper.java ---
@@ -848,13 +849,37 @@ public int compare(final PublicIpAddress o1, final 
PublicIpAddress o2) {
 associatedWithNetworkId = ipAddrList.get(0).getNetworkId();
 }
 
+// for network if the ips does not have any rules, then only 
last ip
+List userIps = 
_ipAddressDao.listByAssociatedNetwork(associatedWithNetworkId, null);
+
+int ipsWithrules = 0;
+int ipsStaticNat = 0;
+for (IPAddressVO ip : userIps) {
+if ( _rulesDao.countRulesByIpIdAndState(ip.getId(), 
FirewallRule.State.Active) > 0 ) {
+ipsWithrules++;
+}
+
+// check onetoonenat and also check if the ip "add":false. 
If there are 2 PF remove 1 static nat add
+if (ip.isOneToOneNat() && ip.getRuleState() == null) {
--- End diff --

In this case rule state is not set. It is null. I will improve the comment


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2030: WIP: CLOUDSTACK-9864 cleanup stale worker VMs...

2017-04-06 Thread DaanHoogland
GitHub user DaanHoogland opened a pull request:

https://github.com/apache/cloudstack/pull/2030

WIP: CLOUDSTACK-9864 cleanup stale worker VMs after job expiry time



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack snapshot-housekeeping

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2030.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2030


commit 40869570fc510fac0d2357f272e96cd4a4518176
Author: Daan Hoogland 
Date:   2017-03-30T14:35:37Z

CE-113 trace logging and rethrow instead of nesting CloudRuntimeException

commit 66d7d846352d52cc539b1dafb5e4d0f1620829a5
Author: Daan Hoogland 
Date:   2017-04-05T12:19:14Z

CE-113 configure workervm gc based on job expiry

commit 996f5834e6a0a9e4dc57d436ceeb5b89e6dc9974
Author: Daan Hoogland 
Date:   2017-04-05T15:35:41Z

CE-113 extra trace log of worker VMs




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2026: CLOUDSTACK-9861: Expire VM snapshots after co...

2017-04-06 Thread rhtyd
Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2026#discussion_r110098624
  
--- Diff: setup/db/db/schema-4920to41000.sql ---
@@ -232,3 +232,5 @@ WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size 
IS NULL) AND
 
 -- CLOUDSTACK-9827: Storage tags stored in multiple places
 DROP VIEW IF EXISTS `cloud`.`storage_tag_view`;
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 
'VMSanpshotManager', 'vmsnapshot.expire.interval', '-1', 'VM Snapshot expire 
interval in hours','-1', NULL, 'Account', 0);
--- End diff --

@abhinandanprateek Since you've used Configkey, no need to use this INSERT 
query. Also typo in the 'VMSanpshotManager'.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2029: CLOUDSTACK-9857: With this change if agent di...

2017-04-06 Thread abhinandanprateek
Github user abhinandanprateek closed the pull request at:

https://github.com/apache/cloudstack/pull/2029


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2029: CLOUDSTACK-9857: With this change if agent di...

2017-04-06 Thread abhinandanprateek
GitHub user abhinandanprateek opened a pull request:

https://github.com/apache/cloudstack/pull/2029

CLOUDSTACK-9857: With this change if agent dies the systemd will catc…

…h it properly and show process as exited

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack CLOUDSTACK-9857-2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2029.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2029


commit f5b952939b0fbffcdedc6f369e60502f771d0ac9
Author: Abhinandan Prateek 
Date:   2017-04-03T10:46:21Z

CLOUDSTACK-9857: With this change if agent dies the systemd will catch it 
properly and show process as exited




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1282: CLOUDSTACK-9200: Fixed failed to delete snaps...

2017-04-06 Thread rhtyd
Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1282#discussion_r110092518
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -245,6 +245,12 @@ public boolean deleteSnapshot(Long snapshotId) {
 return true;
 }
 
+if(snapshotVO.getState() == Snapshot.State.Allocated) {
--- End diff --

See 
https://github.com/apache/cloudstack/pull/1282/files#diff-2b08c10a0eea4bef15bece6ff38ed1f9R223


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1282: CLOUDSTACK-9200: Fixed failed to delete snaps...

2017-04-06 Thread rhtyd
Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1282#discussion_r110092478
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -245,6 +245,12 @@ public boolean deleteSnapshot(Long snapshotId) {
 return true;
 }
 
+if(snapshotVO.getState() == Snapshot.State.Allocated) {
--- End diff --

@anshul1886 the code to check and remove snapshot when they are stuck in 
Allocated state is already in line 223 above, in the same method. Why this 
redundancy, is this a synchronization issue?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1880: CLOUDSTACK-9720: [VMware] template_spool_ref ...

2017-04-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1880


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1944: CLOUDSTACK-9783: Improve metrics view perform...

2017-04-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/1944


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-05 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110082664
  
--- Diff: 
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ---
@@ -1764,9 +1765,12 @@ protected ExecutionResult 
cleanupNetworkElementCommand(final IpAssocCommand cmd)
 }
 nicNum = 
broadcastUriAllocatedToVM.get(ip.getBroadcastUri());
 
-if (numOfIps == 1 && !ip.isAdd()) {
-vifHotUnPlug(conn, routerName, ip.getVifMacAddress());
-networkUsage(routerIp, "deleteVif", "eth" + nicNum);
+if (lastIp != null && lastIp.equalsIgnoreCase("true") && 
!ip.isAdd()) {
--- End diff --

In CitrixresourceBase StringUtils is used from the  
com.cloud.utils.StringUtils. So using  StringUtils from java.lang will be 
ambiguous.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1908: CLOUDSTACK-9317: Fixed disable static nat on ...

2017-04-05 Thread jayapalu
Github user jayapalu commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1908#discussion_r110082657
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
 ---
@@ -625,15 +627,20 @@ protected ExecutionResult 
cleanupNetworkElementCommand(final IpAssocCommand cmd)
 
 // there is only one ip in this public vlan and removing 
it, so
 // remove the nic
-if (ipsCount == 1 && !ip.isAdd()) {
-removeVif = true;
+if (lastIp != null && lastIp.equalsIgnoreCase("true") && 
!ip.isAdd()) {
--- End diff --

In CitrixresourceBase StringUtils is used from the  
com.cloud.utils.StringUtils. So using  StringUtils from java.lang will be 
ambiguous.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2028: CLOUDSTACK-9853: Add support for Secondary IP...

2017-04-05 Thread wido
GitHub user wido opened a pull request:

https://github.com/apache/cloudstack/pull/2028

CLOUDSTACK-9853: Add support for Secondary IPv6 Addresses and Subnets

This commit adds support for passing IPv6 Addresses and/or Subnets as
Secondary IPs.

This is groundwork for CLOUDSTACK-9853 where IPv6 Subnets have to be
allowed in the Security Groups of Instances to we can add DHCPv6
Prefix Delegation.

Use ; instead of : for separating addresses, otherwise it would cause
problems with IPv6 Addresses.

Signed-off-by: Wido den Hollander 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/wido/cloudstack ipv6-secips

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2028.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2028


commit 05f8e5c9fd9086f1ad9fc643fa25b108acfc3f48
Author: Wido den Hollander 
Date:   2017-01-31T15:59:28Z

CLOUDSTACK-9853: Add support for Secondary IPv6 Addresses and Subnets

This commit adds support for passing IPv6 Addresses and/or Subnets as
Secondary IPs.

This is groundwork for CLOUDSTACK-9853 where IPv6 Subnets have to be
allowed in the Security Groups of Instances to we can add DHCPv6
Prefix Delegation.

Use ; instead of : for separating addresses, otherwise it would cause
problems with IPv6 Addresses.

Signed-off-by: Wido den Hollander 




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2027: Activate NioTest following changes in CLOUDST...

2017-04-05 Thread marcaurele
GitHub user marcaurele opened a pull request:

https://github.com/apache/cloudstack/pull/2027

Activate NioTest following changes in CLOUDSTACK-9348 PR #1549

The first PR #1493 re-enabled the NioTest but not the new PR #1549.

@rhtyd the test fails locally on my laptop. Is there any special 
configuration requirements?

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/exoscale/cloudstack niotest

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2027.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2027


commit 226e79c8ce0686ba3d5690ed90134934e26b635d
Author: Marc-Aurèle Brothier 
Date:   2017-04-05T10:25:17Z

Activate NioTest following changes in CLOUDSTACK-9348 PR #1549




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #876: CLOUDSTACK-8865: Adding SR doesn't create Stor...

2017-04-05 Thread SudharmaJain
Github user SudharmaJain commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/876#discussion_r109859606
  
--- Diff: 
plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/lifecycle/ElastistorPrimaryDataStoreLifeCycle.java
 ---
@@ -359,7 +359,7 @@ public boolean attachCluster(DataStore store, 
ClusterScope scope) {
 
 PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo) store;
 // Check if there is host up in this cluster
-List allHosts = 
_resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, 
primarystore.getClusterId(), primarystore.getPodId(), 
primarystore.getDataCenterId());
+List allHosts = 
_resourceMgr.listAllUpHosts(Host.Type.Routing, primarystore.getClusterId(), 
primarystore.getPodId(), primarystore.getDataCenterId());
--- End diff --

@syed We cannot send commands to the host in maintenance mode. So it is not 
possible to add an SR to those host. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...

2017-04-04 Thread kishankavala
Github user kishankavala commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1996#discussion_r109835294
  
--- Diff: server/src/com/cloud/user/AccountManager.java ---
@@ -198,4 +200,11 @@ void buildACLViewSearchCriteria(SearchCriteria s
 public static final String MESSAGE_ADD_ACCOUNT_EVENT = 
"Message.AddAccount.Event";
 
 public static final String MESSAGE_REMOVE_ACCOUNT_EVENT = 
"Message.RemoveAccount.Event";
+public static final ConfigKey UseSecretKeyInResponse = new 
ConfigKey(
+"Advanced",
+Boolean.class,
+"use.secret.key.in.response",
+"true",
--- End diff --

As per discussion in PR # 1152, default value should be false. Any failing 
tests due to this change have to be fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2014: WIP: Fix primary storage usage for vm snaphot

2017-04-04 Thread abhinandanprateek
Github user abhinandanprateek closed the pull request at:

https://github.com/apache/cloudstack/pull/2014


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2026: CLOUDSTACK-9861: Expire VM snapshots after co...

2017-04-04 Thread abhinandanprateek
GitHub user abhinandanprateek opened a pull request:

https://github.com/apache/cloudstack/pull/2026

CLOUDSTACK-9861: Expire VM snapshots after configured duration

Default value of the account level global config vmsnapshot.expire.interval 
is -1 that conforms to legacy behaviour
A positive value will expire the VM snapshots for the respective account in 
that many hours

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack ir25-2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2026.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2026


commit 1c6a30a0e65f2bc9b1d97920d1562b35f3b682ee
Author: Abhinandan Prateek 
Date:   2017-03-28T12:07:59Z

CLOUDSTACK-9861: Expire VM snapshots after configured duration
Default value of the account level global config vmsnapshot.expire.interval 
is -1 that conforms to legacy behaviour
A positive value will expire the VM snapshots for the respective account in 
that many hours




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1935: CLOUDSTACK-9764: Delete domain failure due to...

2017-04-04 Thread rafaelweingartner
Github user rafaelweingartner commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1935#discussion_r103529571
  
--- Diff: server/src/com/cloud/user/DomainManagerImpl.java ---
@@ -273,82 +284,145 @@ public boolean deleteDomain(long domainId, Boolean 
cleanup) {
 
 @Override
 public boolean deleteDomain(DomainVO domain, Boolean cleanup) {
-// mark domain as inactive
-s_logger.debug("Marking domain id=" + domain.getId() + " as " + 
Domain.State.Inactive + " before actually deleting it");
-domain.setState(Domain.State.Inactive);
-_domainDao.update(domain.getId(), domain);
-boolean rollBackState = false;
-boolean hasDedicatedResources = false;
+GlobalLock lock = getGlobalLock("AccountCleanup");
+if (lock == null) {
+s_logger.debug("Couldn't get the global lock");
+return false;
+}
+
+if (!lock.lock(30)) {
+s_logger.debug("Couldn't lock the db");
+return false;
+}
 
 try {
-long ownerId = domain.getAccountId();
-if ((cleanup != null) && cleanup.booleanValue()) {
-if (!cleanupDomain(domain.getId(), ownerId)) {
-rollBackState = true;
-CloudRuntimeException e =
-new CloudRuntimeException("Failed to clean up 
domain resources and sub domains, delete failed on domain " + domain.getName() 
+ " (id: " +
-domain.getId() + ").");
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
-}
-} else {
-//don't delete the domain if there are accounts set for 
cleanup, or non-removed networks exist, or domain has dedicated resources
-List networkIds = 
_networkDomainDao.listNetworkIdsByDomain(domain.getId());
-List accountsForCleanup = 
_accountDao.findCleanupsForRemovedAccounts(domain.getId());
-List dedicatedResources = 
_dedicatedDao.listByDomainId(domain.getId());
-if (dedicatedResources != null && 
!dedicatedResources.isEmpty()) {
-s_logger.error("There are dedicated resources for the 
domain " + domain.getId());
-hasDedicatedResources = true;
-}
-if (accountsForCleanup.isEmpty() && networkIds.isEmpty() 
&& !hasDedicatedResources) {
-_messageBus.publish(_name, 
MESSAGE_PRE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain);
-if (!_domainDao.remove(domain.getId())) {
-rollBackState = true;
-CloudRuntimeException e =
-new CloudRuntimeException("Delete failed on 
domain " + domain.getName() + " (id: " + domain.getId() +
-"); Please make sure all users and sub 
domains have been removed from the domain before deleting");
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
-}
-_messageBus.publish(_name, 
MESSAGE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain);
+// mark domain as inactive
+s_logger.debug("Marking domain id=" + domain.getId() + " as " 
+ Domain.State.Inactive + " before actually deleting it");
+domain.setState(Domain.State.Inactive);
+_domainDao.update(domain.getId(), domain);
+
+boolean rollBackState = false;
+
+try {
+long ownerId = domain.getAccountId();
+if (BooleanUtils.toBoolean(cleanup)) {
+tryCleanupDomain(domain, ownerId);
 } else {
-rollBackState = true;
-String msg = null;
-if (!accountsForCleanup.isEmpty()) {
-msg = accountsForCleanup.size() + " accounts to 
cleanup";
-} else if (!networkIds.isEmpty()) {
-msg = networkIds.size() + " non-removed networks";
-} else if (hasDedicatedResources) {
-msg = "dedicated resources.";
-}
+
removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+}
 
-CloudRuntimeException e = new 
CloudRuntimeException("Can't delete the domain yet because it has " + msg);
-e.addProxyObject(domain.getUuid(), "domainId");
-throw e;
+

[GitHub] cloudstack pull request #1935: CLOUDSTACK-9764: Delete domain failure due to...

2017-04-04 Thread rafaelweingartner
Github user rafaelweingartner commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1935#discussion_r102538324
  
--- Diff: server/src/com/cloud/user/DomainManagerImpl.java ---
@@ -109,6 +112,20 @@
 @Inject
 MessageBus _messageBus;
 
+static boolean rollBackState = false;
--- End diff --

@nvazquez I have been thinking about this variable you introduced here. I 
think it can cause problems (concurrency problems). The `DomainManagerImpl` is 
a singleton. Therefore, it should not have state variables. The `rollBackState 
` is acting as a state variable for requests that use 
`com.cloud.user.DomainManagerImpl.deleteDomain(DomainVO, Boolean)`. The problem 
is that every call should have its own context/state for `rollBackState`. 
However, this will not happen with the current implementation.

I think we should re-work the use of that variable. What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1935: CLOUDSTACK-9764: Delete domain failure due to...

2017-04-04 Thread rafaelweingartner
Github user rafaelweingartner commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1935#discussion_r103529869
  
--- Diff: server/test/com/cloud/user/DomainManagerImplTest.java ---
@@ -134,4 +164,69 @@ public void testFindDomainByIdOrPathValidId() {
 Assert.assertEquals(domain, domainManager.findDomainByIdOrPath(1L, 
"/validDomain/"));
 }
 
+@Test(expected=InvalidParameterValueException.class)
+public void testDeleteDomainNullDomain() {
+Mockito.when(_domainDao.findById(DOMAIN_ID)).thenReturn(null);
+domainManager.deleteDomain(DOMAIN_ID, testDomainCleanup);
+}
+
+@Test(expected=PermissionDeniedException.class)
+public void testDeleteDomainRootDomain() {
+
Mockito.when(_domainDao.findById(Domain.ROOT_DOMAIN)).thenReturn(domain);
+domainManager.deleteDomain(Domain.ROOT_DOMAIN, testDomainCleanup);
+}
+
+@Test
+public void testDeleteDomainNoCleanup() {
+domainManager.deleteDomain(DOMAIN_ID, testDomainCleanup);
+Mockito.verify(domainManager).deleteDomain(domain, 
testDomainCleanup);
+
Mockito.verify(domainManager).removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+Mockito.verify(domainManager).cleanupDomainOfferings(DOMAIN_ID);
+Mockito.verify(lock).unlock();
+}
+
+@Test
+public void 
testRemoveDomainWithNoAccountsForCleanupNetworksOrDedicatedResourcesRemoveDomain()
 {
+
domainManager.removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+
Mockito.verify(domainManager).publishRemoveEventsAndRemoveDomain(domain);
+}
+
+@Test(expected=CloudRuntimeException.class)
+public void 
testRemoveDomainWithNoAccountsForCleanupNetworksOrDedicatedResourcesDontRemoveDomain()
 {
+domainNetworkIds.add(2l);
+
domainManager.removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(domain);
+Mockito.verify(domainManager).failRemoveOperation(domain, 
domainAccountsForCleanup, domainNetworkIds, false);
+}
+
+@Test
+public void testPublishRemoveEventsAndRemoveDomainSuccessfulDelete() {
+domainManager.publishRemoveEventsAndRemoveDomain(domain);
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_PRE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_domainDao).remove(DOMAIN_ID);
+}
+
+@Test(expected=CloudRuntimeException.class)
+public void testPublishRemoveEventsAndRemoveDomainExceptionDelete() {
+Mockito.when(_domainDao.remove(DOMAIN_ID)).thenReturn(false);
+domainManager.publishRemoveEventsAndRemoveDomain(domain);
+Mockito.verify(_messageBus).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_PRE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_messageBus, 
Mockito.never()).publish(Mockito.anyString(), 
Matchers.eq(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT),
+Matchers.eq(PublishScope.LOCAL), Matchers.eq(domain));
+Mockito.verify(_domainDao).remove(DOMAIN_ID);
+}
+
+@Test
+public void testFailRemoveOperation() {
+try {
+domainManager.failRemoveOperation(domain, 
domainAccountsForCleanup, domainNetworkIds, true);
--- End diff --

Now that you removed the use of `rollBackState`, made the method last 
problematic to test. Therefore, you can use the `@Test(expected=...)`, instead 
of this very unusual construction here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2020: WIP: Expire VM snapshots

2017-04-04 Thread abhinandanprateek
Github user abhinandanprateek closed the pull request at:

https://github.com/apache/cloudstack/pull/2020


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1950: [4.10] CLOUDSTACK-9462: Build packages on Ubu...

2017-04-04 Thread ustcweizhou
Github user ustcweizhou commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1950#discussion_r109633875
  
--- Diff: debian/control ---
@@ -16,14 +16,15 @@ Description: A common package which contains files 
which are shared by several C
 Package: cloudstack-management
 Architecture: all
 Depends: ${misc:Depends}, ${python:Depends}, openjdk-8-jre-headless | 
java8-runtime-headless | java8-runtime, cloudstack-common (= 
${source:Version}), tomcat6 | tomcat7, sudo, jsvc, python-mysql.connector, 
libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, lsb-release
+Recommends: init-system-helpers (>= 1.14)
--- End diff --

@rhtyd Sorry I just noticed your comment.  I will remove all 3 lines
Recommends: init-system-helpers (>= 1.14)

I am not sure if it will cause any issue. Please test it.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2025: Fix error in restart network in 4.10.0.0 RC

2017-04-04 Thread ustcweizhou
GitHub user ustcweizhou opened a pull request:

https://github.com/apache/cloudstack/pull/2025

Fix error in restart network in 4.10.0.0 RC

The PR fixes the error in restart network:
2017-04-04 10:27:39,217 DEBUG [c.c.n.r.NetworkHelperImpl] 
(API-Job-Executor-2:ctx-08904854 job-29417 ctx-3405d3f2) (logid:19bbd6e6) 
Router requires upgrade. Unable to send command to router:9784, router template 
version : Cloudstack Release 4.10.0 Wed Feb 15 05:42:18 UTC 2017, minimal 
required version : 4.10.0.0

It works after changing minreq.sysvmtemplate.version from 4.10.0.0 to 4.10.0

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ustcweizhou/cloudstack 4.10-restartnetwork

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2025.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2025


commit 5018b579ab1578fa22fdb2ca1ee9218d740c1df7
Author: Wei Zhou 
Date:   2017-04-04T10:43:27Z

Fix error in restart network in 4.10.0.0 RC




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #921: CLOUDSTACK-8944 Template download possible fro...

2017-04-04 Thread yvsubhash
Github user yvsubhash closed the pull request at:

https://github.com/apache/cloudstack/pull/921


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2008: [CLOUDSTACK-9840] Fix datetime format of snap...

2017-04-03 Thread olivierlemasle
GitHub user olivierlemasle reopened a pull request:

https://github.com/apache/cloudstack/pull/2008

[CLOUDSTACK-9840] Fix datetime format of snapshots events

Include the timezone in datetime format of snapshot events, to be 
consistent with every other events.
"eventDateTime" was added by @chipchilders in commit 14ee684ce3 and was 
updated the same day to add the timezone (commit bf967eb622f) except for 
Snapshots.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Amysta/cloudstack eventDateTimeTz

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2008.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2008


commit b37ca77636feb22327d1b819657c6fd3913696fe
Author: Olivier Lemasle 
Date:   2017-03-15T15:29:44Z

Fix datetime format of snapshots events

Include the timezone in datetime format of snapshot events, to be consistent
with every other events.
"eventDateTime" was added by @chipchilders in commit 14ee684ce3 and was
updated the same day to add the timezone (commit bf967eb622f) except for
Snapshots.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2008: [CLOUDSTACK-9840] Fix datetime format of snap...

2017-04-03 Thread olivierlemasle
Github user olivierlemasle closed the pull request at:

https://github.com/apache/cloudstack/pull/2008


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2024: CLOUDSTACK-9857: With this change if agent di...

2017-04-03 Thread abhinandanprateek
GitHub user abhinandanprateek opened a pull request:

https://github.com/apache/cloudstack/pull/2024

CLOUDSTACK-9857: With this change if agent dies the systemd will catc…

…h it properly and show process as exited

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/shapeblue/cloudstack CLOUDSTACK-9857

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2024.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2024


commit 3eb633a100a71193c4999172f494f6ce2175866d
Author: Abhinandan Prateek 
Date:   2017-04-03T10:46:21Z

CLOUDSTACK-9857: With this change if agent dies the systemd will catch it 
properly and show process as exited




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #876: CLOUDSTACK-8865: Adding SR doesn't create Stor...

2017-04-01 Thread syed
Github user syed commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/876#discussion_r109299000
  
--- Diff: 
plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/lifecycle/ElastistorPrimaryDataStoreLifeCycle.java
 ---
@@ -359,7 +359,7 @@ public boolean attachCluster(DataStore store, 
ClusterScope scope) {
 
 PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo) store;
 // Check if there is host up in this cluster
-List allHosts = 
_resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, 
primarystore.getClusterId(), primarystore.getPodId(), 
primarystore.getDataCenterId());
+List allHosts = 
_resourceMgr.listAllUpHosts(Host.Type.Routing, primarystore.getClusterId(), 
primarystore.getPodId(), primarystore.getDataCenterId());
--- End diff --

What about hosts which are in maintenance? Do we expect to add an SR to 
those hosts as well?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1810: CLOUDSTACK-9647: NIC adapter type becomes e10...

2017-03-31 Thread rhtyd
Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1810#discussion_r109176624
  
--- Diff: 
server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java 
---
@@ -280,6 +286,16 @@ public boolean finalizeVirtualMachineProfile(final 
VirtualMachineProfile profile
 public boolean finalizeCommandsOnStart(final Commands cmds, final 
VirtualMachineProfile profile) {
 final DomainRouterVO domainRouterVO = 
_routerDao.findById(profile.getId());
 
+Map details = new HashMap();
+
+if(profile.getHypervisorType() == 
Hypervisor.HypervisorType.VMware){
+HypervisorGuru hvGuru = 
_hvGuruMgr.getGuru(profile.getHypervisorType());
+VirtualMachineTO vmTO = hvGuru.implement(profile);
+if(vmTO.getDetails() != null){
+details = vmTO.getDetails();
--- End diff --

Should we pass the details irrespective of the hypervisor type?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #914: BUG-ID CLOUDSTACK-8939 VM Snapshot size with m...

2017-03-31 Thread yvsubhash
Github user yvsubhash commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/914#discussion_r109123538
  
--- Diff: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
 ---
@@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection 
conn, final VolumeObjectTO v
 }
 }
 if (volumeTo.getVolumeType() == Volume.Type.ROOT) {
-final Map allVMs = VM.getAllRecords(conn);
-// add size of memory snapshot vdi
-if (allVMs != null && allVMs.size() > 0) {
-for (final VM vmr : allVMs.keySet()) {
-try {
-final String vName = vmr.getNameLabel(conn);
-if (vName != null && vName.contains(vmName) && 
vmr.getIsASnapshot(conn)) {
-final VDI memoryVDI = vmr.getSuspendVDI(conn);
-if (!isRefNull(memoryVDI)) {
-size = size + 
memoryVDI.getPhysicalUtilisation(conn);
-final VDI pMemoryVDI = 
memoryVDI.getParent(conn);
-if (!isRefNull(pMemoryVDI)) {
-size = size + 
pMemoryVDI.getPhysicalUtilisation(conn);
+VM vm = getVM(conn, vmName);
--- End diff --

@sudhansu7 exception needs to be caught at the callers otherwise it would 
end up setting zero size


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2021: CLOUDSTACK-9854: Fix test_primary_storage tes...

2017-03-31 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2021


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2022: CLOUDSTACK-9591: Fix systemvmtemplate to not ...

2017-03-30 Thread DaanHoogland
Github user DaanHoogland commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/2022#discussion_r108918688
  
--- Diff: 
vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java ---
@@ -1477,6 +1493,40 @@ public static String 
resolveHostNameInUrl(DatacenterMO dcMo, String url) {
 return url;
 }
 
+public static String removeOVFNetwork(final String ovfString)  {
+if (ovfString == null || ovfString.isEmpty()) {
+return ovfString;
+}
+try {
+final DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
+final Document doc = factory.newDocumentBuilder().parse(new 
ByteArrayInputStream(ovfString.getBytes()));
+final DocumentTraversal traversal = (DocumentTraversal) doc;
+final NodeIterator iterator = 
traversal.createNodeIterator(doc.getDocumentElement(), NodeFilter.SHOW_ELEMENT, 
null, true);
+for (Node n = iterator.nextNode(); n != null; n = 
iterator.nextNode()) {
+final Element e = (Element) n;
+if ("NetworkSection".equals(e.getTagName())) {
+if (e.getParentNode() != null) {
+e.getParentNode().removeChild(e);
+}
+} else if ("rasd:Connection".equals(e.getTagName())) {
+if (e.getParentNode() != null && 
e.getParentNode().getParentNode() != null) {
+
e.getParentNode().getParentNode().removeChild(e.getParentNode());
+}
+}
+}
+final DOMSource domSource = new DOMSource(doc);
+final StringWriter writer = new StringWriter();
+final StreamResult result = new StreamResult(writer);
+final TransformerFactory tf = TransformerFactory.newInstance();
+final Transformer transformer = tf.newTransformer();
+transformer.transform(domSource, result);
+return writer.toString();
+} catch (SAXException | IOException | ParserConfigurationException 
| TransformerException e) {
+s_logger.warn("Unexpected exception caught while removing 
network elements from OVF:", e);
--- End diff --

thanks for this.
I'd log a warn without, and a debug with the stacktrace.That way an admin 
had better control on what is seen in the logs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2023: BUG-ID: CLOUDSTACK-9808 Added system Vm upgra...

2017-03-30 Thread kishankavala
GitHub user kishankavala opened a pull request:

https://github.com/apache/cloudstack/pull/2023

BUG-ID: CLOUDSTACK-9808 Added system Vm upgrade path for LXC and OVM

`mysql> select id,unique_name,name,type,url,updated,created from 
vm_template where type='SYSTEM';

++-+---++---+-+-+
| id | unique_name | name  | type   | url   

| updated | created |

++-+---++---+-+-+
|  1 | routing-1   | SystemVM Template (XenServer) | SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-xen.vhd.bz2
| NULL| 2017-03-30 15:53:00 |
|  3 | routing-3   | SystemVM Template (KVM)   | SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-kvm.qcow2.bz2
  | NULL| 2017-03-30 15:53:00 |
|  8 | routing-8   | SystemVM Template (vSphere)   | SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-vmware.ova
 | NULL| 2017-03-30 15:53:00 |
|  9 | routing-9   | SystemVM Template (HyperV)| SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-hyperv.vhd.zip
 | NULL| 2017-03-30 15:53:00 |
| 10 | routing-10  | SystemVM Template (LXC)   | SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-kvm.qcow2.bz2
  | NULL| 2017-03-30 15:54:13 |
| 12 | routing-12  | SystemVM Template (Ovm3)  | SYSTEM | 
https://download.cloudstack.org/systemvm/4.10/systemvm64template-master-4.10.0-ovm.raw.bz2
| NULL| 2017-03-30 15:55:58 |

++-+---++---+-+-+
6 rows in set (0.00 sec)
`

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/Accelerite/cloudstack CLOUDSTACK-9808

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/2023.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2023


commit 4795cba0ec86c2e4ffd2da959414deeb15a2c532
Author: Kishan Kavala 
Date:   2017-03-30T11:45:46Z

BUG-ID: CLOUDSTACK-9808 Added system Vm upgrade path for LXC and OVM




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #2019: CLOUDSTACK-9851 travis CI build failure after...

2017-03-30 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/cloudstack/pull/2019


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


  1   2   3   4   5   6   7   8   9   10   >