[GitHub] cloudstack issue #1795: CLOUDSTACK-9625:Unable to scale VM from any offering...

2017-02-26 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1795
  
Closing this PR as this is already fixed in master.


---
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 #1795: CLOUDSTACK-9625:Unable to scale VM from any o...

2017-02-26 Thread sudhansu7
Github user sudhansu7 closed the pull request at:

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


---
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 issue #892: CLOUDSTACK-8910: The reserved_capacity field increase...

2017-03-01 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/892
  
LGTM for code changes.


---
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 issue #1246: CLOUDSTACK-9165 unable to use reserved IP range in a...

2017-03-02 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1246
  
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 issue #1850: CLOUDSTACK-9694: Unable to limit the Public IPs in V...

2017-03-08 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1850
  
@koushik-das 
Added marvin test. Please review.


---
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 #2002: CLOUDSTACK-9831: Previous pod_id still remain...

2017-03-13 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9831: Previous pod_id still remains in the vm_instance table

Previous pod_id still remains in the vm_instance table after VM migration 
with migrateVirtualMachineWithVolume

{noformat}

Previous pod_id still remains in the vm_instance table after VM migration 
with migrateVirtualMachineWithVolume

Before migrateVirtualMachineWithVolume
mysql> select v.id,v.instance_name,h.name,v.pod_id as 
pod_id_from_instance_tb,h.pod_id as pod_id_from_host_tb from vm_instance v, 
host h where v.host_id=h.id and v.id=2;

--
id  instance_name   namepod_id_from_instance_tb 
pod_id_from_host_tb


--
2   i-2-2-VMtestVM  1   1


--
1 row in set (0.00 sec)

After migrateVirtualMachineWithVolume
mysql> select v.id,v.instance_name,h.name,v.pod_id as 
pod_id_from_instance_tb,h.pod_id as pod_id_from_host_tb from vm_instance v, 
host h where v.host_id=h.id and v.id=3;

-
id  instance_name   namepod_id_from_instance_tb 
pod_id_from_host_tb


-
3   i-2-3-VMtestVm1 1   2


-
1 row in set (0.00 sec)

{noformat}

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9831

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

https://github.com/apache/cloudstack/pull/2002.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 #2002


commit 7018bf13e51e9d71dcd4ab2393fa95cd6a437def
Author: Sudhansu 
Date:   2017-03-13T07:44:12Z

CLOUDSTACK-9831: Previous pod_id still remains in the vm_instance table 
after
 VM migration with migrateVirtualMachineWithVolume




---
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 issue #1797: CLOUDSTACK-9630: Cannot use listNics API as advertis...

2017-03-17 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1797
  
@pdion891 removed broadcasturi from api response. Also added marvin test .


---
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 #2012: CLOUDSTACK-9842: Unable to map root volume us...

2017-03-21 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9842: Unable to map root volume usage to VM

If a VM is cold migrated the vm_instance_id and uuid of volume is 
nullified. So there is no link between volume and vm.

With this the ROOT volume usage can not be mapped to a VM.

```
mysql>  select id,name,uuid,created,removed,state from cloud.volumes where 
name="ROOT-188" ;

+-++--+-+-+--+
| id  | name   | uuid | created 
| instance_id | state|

+-++--+-+-+--+
| 89  | ROOT-188   | NULL | 2015-08-31 
06:14:01 | NULL| Expunged |
| 96  | ROOT-188   | a32e70e7-9869-49c8-92fa-5acd45abc94e | 2015-08-31 
07:20:41 | 188 | Expunged |

+-++--+-+-+--+
2 rows in set (0.00 sec)

mysql> select * from cloud_usage.usage_volume where id in (89, 96);

+-+-++---+--+-+-+-+-+
| id  | zone_id | account_id | domain_id | disk_offering_id | template_id | 
size| created | deleted |

+-+-++---+--+-+-+-+-+
| 89 |   1 | 55 |54 | NULL |NULL | 
16106127360 | 2015-08-31 06:14:01 | 2015-08-31 07:23:32 |
| 96 |   1 | 55 |54 |   16 |NULL | 
16106127360 | 2015-08-31 07:23:32 | 2015-08-31 08:09:40 |

+-+-++---+--+-+-+-+-+
2 rows in set (0.00 sec)

mysql> select * from cloud_usage.cloud_usage where usage_id in (89, 96)\G;
*** 1. row ***
id: 48042
   zone_id: 1
account_id: 55
 domain_id: 54
   description: Volume Id: 96 usage time (DiskOffering: 16)
 usage_display: 0.768889 Hrs
usage_type: 6
 raw_usage: 0.768889188766479
vm_instance_id: NULL
   vm_name: NULL
   offering_id: 16
   template_id: NULL
  usage_id: 96
  type: NULL
  size: 16106127360
network_id: NULL
start_date: 2015-08-30 15:00:00
  end_date: 2015-08-31 14:59:59
  virtual_size: NULL
*** 2. row ***
id: 48044
   zone_id: 1
account_id: 55
 domain_id: 54
   description: Volume Id: 89 usage time
 usage_display: 1.158611 Hrs
usage_type: 6
 raw_usage: 1.15861141681671
vm_instance_id: NULL
   vm_name: NULL
   offering_id: NULL
   template_id: NULL
  usage_id: 89
  type: NULL
  size: 16106127360
network_id: NULL
start_date: 2015-08-30 15:00:00
  end_date: 2015-08-31 14:59:59
  virtual_size: NULL
2 rows in set (0.06 sec)

Usage id 48044 is for volume id  89. Volume 89 does not have any 
instance_id. 
```

Solution:
Removed code which nullifies  vm_instance_id
Also modified QueryManagerImpl to ignore volume which does not have uuid. 
This is to avoid duplicate volume listing.



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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9842

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

https://github.com/apache/cloudstack/pull/2012.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 #2012


commit 162faddcfcd0da9e2818ff01f1e984689029ceb0
Author: Sudhansu 
Date:   2015-12-18T04:27:08Z

CLOUDSTACK-9842: Unable to map root volume usage to VM

removed code which nullifies  vm_instance_id
Also modified QueryManagerImpl to ignore volume which does not have uuid. 
This is to avoid duplicate volume listing.




---
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 #2015: CLOUDSTACK-9843 : Performance improvement of ...

2017-03-23 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9843 : Performance improvement of SSHHelper

A delay of 1 sec has been introduced in SSHHelper Class. This is a fail 
safe code. Removing this will improves the performance of deployVm by 4 sec, 
createFirewallRule by 1 sec and createPortForwardingRule by 1 sec.

We have not faced any issues after removing the delay. This was introduced 
when we were using older version of Trilead library. 

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9843

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

https://github.com/apache/cloudstack/pull/2015.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 #2015


commit 05f1982c19e949e90e47d0afbf3afbdadb845b6b
Author: Sudhansu 
Date:   2017-03-21T10:49:44Z

CLOUDSTACK-9843 : Performance improvement of deployVirtualMachine, 
createFirewallRule, createPortForwardingRule

Removed 1 sec sleep in SSHHelper.




---
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 issue #2019: CLOUDSTACK-9851 travis CI build failure after merge ...

2017-03-26 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/2019
  
LGTM for code change. Most of the recent travis CI is failing for this.


---
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 issue #2002: CLOUDSTACK-9831: Previous pod_id still remains in th...

2017-03-30 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/2002
  
@serg38 
Added changes for failure case. If migration fails the old pod id will be 
restored.


---
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: CLOUDSTACK-7986 [F5 LB] Failed to execute...

2014-11-28 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-7986 [F5 LB] Failed to execute IPAssocCommand due to com.clou...

added 3 new method to strip partition information from VirtualServer, 
LBPool, VLAN api response.

With BigIP V11.x VirtualServer, LBPool, VLAN api response has been modified.
Now BigIP returns resource  name with user partition information
ex: if vlanname is vlan-100 then the get_list() will return 
/Common/vlan-100 (/Common -> Suer portition)
This method will strip the partition information and only returns a list 
with vlan name (vlan-100)

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-7986

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

https://github.com/apache/cloudstack/pull/47.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 #47


commit 7ed6909246d55c63e89a419a82af03b6080af340
Author: Sudhansu 
Date:   2014-11-28T11:01:08Z

CLOUDSTACK-7986 [F5 LB] Failed to execute IPAssocCommand due to 
com.cloud.utils.exception.ExecutionException: Exception caught in 
Networking::urn:iControl:Networking/VLAN::create()

added 3 new method to strip partition information from VirtualServer, 
LBPool, VLAN api response.

With BigIP V11.x VirtualServer, LBPool, VLAN api response has been modified.
Now BigIP returns resource  name with user partition information
ex: if vlanname is vlan-100 then the get_list() will return 
/Common/vlan-100 (/Common -> Suer portition)
This method will strip the partition information and only returns a list 
with vlan name (vlan-100)




---
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: CLOUDSTACK-7986 [F5 LB] Failed to execute...

2014-12-08 Thread sudhansu7
Github user sudhansu7 closed the pull request at:

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


---
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: CLOUDSTACK-7986 [F5 LB] Failed to execute...

2014-12-08 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/47#issuecomment-66239667
  
Thanks Rajani.


---
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: BUG-ID: CLOUDSTACK-8483 - Private templat...

2015-05-30 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

BUG-ID: CLOUDSTACK-8483 -  Private template not visible in project

added new 'projectId' parameter in createTemplate command and based current 
user, account and projectid decide the owner of the template.

Problem: Template created using createTemplte API within project context is 
not visible in project view.
Root Cause: CeateTemplate API does not have projectId parameter and hence 
it creates the template against the caller's account id. 
Solution: A new parameter 'projectId' has been added to createTemplate 
command and the ownership is decided based on current user account and 
projectid.

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-8483

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

https://github.com/apache/cloudstack/pull/334.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 #334


commit a5c256d752b19fe3eb58b448486f95bd1d2fc6bb
Author: Sudhansu 
Date:   2015-03-13T12:18:47Z

BUG-ID: CLOUDSTACK-8483 -  Private template not visible in project
added new 'projectId' parameter in createTemplate command and based current 
user, account and projectid decide the owner of the template.




---
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: BUG-ID: CLOUDSTACK-8484 - Hosts without t...

2015-05-30 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

BUG-ID: CLOUDSTACK-8484 - Hosts without tag are not listed while list…

…ing the hosts for migration for instance with tag

While preparing the suitable hosts we are accidentally removing the 
incompatible (host does not have host tag) hosts from other host list(incorrect 
use of List.retainAll).

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-8484

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

https://github.com/apache/cloudstack/pull/335.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 #335


commit fac22e3ffc3026362f77d0fc9ef36a2e7b37483d
Author: Sudhansu 
Date:   2015-03-12T12:28:31Z

BUG-ID: CLOUDSTACK-8484 - Hosts without tag are not listed while listing 
the hosts for migration for instance with tag

While preparing the suitable hosts we are accidentally removing the 
incompatible (host does not have host tag) hosts from otherhost list(incorrect 
use of List.retainAll).




---
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: CLOUDSTACK-8815 : Issues with cloudstack-...

2015-09-28 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/799#issuecomment-143724455
  
@remibergsma 

rebased against current master and  also squashed 4 commits to one. 


---
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: CLOUDSTACK-8919: Slow UI response while l...

2015-10-29 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/897#issuecomment-152273822
  
@remibergsma  @runseb 
I have below performance analysis, which I did some time back. I trying to 
find out the dbdump to do a real test. But below analysis will may help to 
understand the issue and the solution.

Clicking 'Network' tab invokes 3 api as mentioned below.
 

http://localhost:8080/client/api?command=listZones&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&networktype=Advanced&_=1436356355027
 -- 371ms
this is to enable vpc, vpnCustomerGateway menu option.
 

http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&supportedServices=SecurityGroup&listAll=true&details=min&_=1436356355424
 -- 18.97s
this is to enable securityGroups menu option. 



http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=1ddeSxQjc604bdnHJegYqkM6EgA%3D&listAll=true&page=1&pagesize=20&_=1436356374437
 -- 1.54s
to list networks
 
Second API call is taking 90% of the total response time.This api fetches 
all networks and interates over each network and for each network it makes an 
db call to fetch the services associated with the network. This is an expensive 
operation. 
 
Solution: 

![image006](https://cloud.githubusercontent.com/assets/1062642/10827976/dbc6e066-7e97-11e5-8aec-09e0a84c1dc2.png)
We can fetch listZones of type basic, if present then we can enable 
securityGroups menu option. For advanced zone with securitygroup service we can 
reuse first api call and can check "securitygroupsenabled" attribute in 
response. If present we will enable securityGroups menu option.
 

http://localhost:8080/client/api?command=listZones&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&networktype=Advanced&_=1436357831259
 --256ms
 

http://localhost:8080/client/api?command=listZones&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&networktype=Basic&_=1436357831901
 --11ms
 

http://localhost:8080/client/api?command=listNetworks&response=json&sessionkey=JwxpVL74Wk6ZS7MvzSw0u6%2FA9eU%3D&listAll=true&page=1&pagesize=20&_=1436357831968
 --868s
 
total : 1.19s





---
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: BUG-ID: CLOUDSTACK-8483 - Private templat...

2015-07-02 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/334#issuecomment-118006807
  
@karuturi 
When a user switches to project view the ownership changes to project 
account. So any resource created inside project view should be mapped to 
project account.



---
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: BUG-ID: CLOUDSTACK-8483 - Private templat...

2015-07-02 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/334#discussion_r33769718
  
--- Diff: 
api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java 
---
@@ -215,33 +221,39 @@ public long getEntityOwnerId() {
 if (volumeId != null) {
 Volume volume = _entityMgr.findById(Volume.class, volumeId);
 if (volume != null) {
-accountId = volume.getAccountId();
--- End diff --

I will make this 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: BUG-ID: CLOUDSTACK-8484 - Hosts without t...

2015-07-02 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/335#issuecomment-118007318
  
@remibergsma  @runseb 
This issue exists in 4.5 , hence fixed it in 4.5. this can me merged to 
master 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: BUG-ID: CLOUDSTACK-8484 - Hosts without t...

2015-07-03 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/335#issuecomment-118331438
  
@remibergsma @karuturi 
I have added marvin test for this issue.
Test result from local setup:

Sudhansus-MAC:cloudstack sudhansu$ nosetests --with-marvin 
--marvin-config=setup/dev/advanced.cfg 
./test/integration/smoke/find_hosts_for_migration.py 

 Marvin Init Started 

=== Marvin Parse Config Successful ===

=== Marvin Setting TestData Successful===

 Log Folder Path: /tmp//MarvinLogs//Jul_03_2015_17_38_01_JVMT7H. All 
logs will be available here 

=== Marvin Init Logging Successful===

 Marvin Init Successful 
===final results are now copied to: 
/tmp//MarvinLogs/find_hosts_for_migration_FKMWAR===
Sudhansus-MAC:cloudstack sudhansu$ cat 
/tmp//MarvinLogs/find_hosts_for_migration_FKMWAR/results.txt 
Test find suitable and not-suitable list of hosts for migration ... === 
TestName: test_01_find_hosts_for_migration | Status : SUCCESS ===
ok

--
Ran 1 test in 27.003s

OK
Sudhansus-MAC:cloudstack sudhansu$ cat 
/tmp//MarvinLogs/find_hosts_for_migration_FKMWAR/failed_plus_exceptions.txt 

Sudhansus-MAC:cloudstack sudhansu$ cat 
/tmp//MarvinLogs/find_hosts_for_migration_FKMWAR/runinfo.txt | grep -i 
'Suitable Hosts'
2015-07-03 17:38:18,171 - DEBUG - Suitable Hosts: set([])
2015-07-03 17:38:18,171 - DEBUG - Not suitable Hosts: 
set([{cpuwithoverprovisioning : u'32000.0', version : u'4.5.2-SNAPSHOT', 
memorytotal : 8589934592, jobstatus : 0, zoneid : 
u'7a83176c-4ae7-49cc-88ff-a794716e74f9', cpunumber : 4, managementserverid : 
4278190080, cpuallocated : u'0%', memoryused : 0, id : 
u'b1b25f17-18f7-4b4d-a8e1-a353ebf33660', cpuused : u'0%', suitableformigration 
: False, clusterid : u'c138587b-c149-4819-9d30-d4fa9d6d5da4', capabilities : 
u'hvm', state : u'Up', memoryallocated : 1879048192, networkkbswrite : 16384, 
cpuspeed : 8000, type : u'Routing', events : u'Ping; StartAgentRebalance; 
ShutdownRequested; ManagementServerDown; HostDown; AgentDisconnected; 
PingTimeout; Remove; AgentConnected', zonename : u'Sandbox-simulator', podid : 
u'b0b72cfb-db0a-4e9c-a9da-84854d8c4a1f', clustertype : u'CloudManaged', hahost 
: False, lastpinged : u'1970-01-17T11:01:01+0530', ipaddress : u'172.16.15.21', 
disconnected : u'2015-07-03T14:32:16+0530', name : u'SimulatedAgent.3
 481871b-7626-450a-b2c1-ab4e6a2e5965', networkkbsread : 32768, created : 
u'2015-07-03T13:39:27+0530', clustername : u'C0', hypervisor : u'Simulator', 
islocalstorageactive : False, resourcestate : u'Enabled', requiresStorageMotion 
: False, podname : u'POD0'}])



---
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: CLOUDSTACK-8815 : Issues with cloudstack-...

2015-09-10 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-8815 : Issues with cloudstack-management init script



When a management server is halted or rebooted, the cloudstack-management 
init script does not successfully kill the associated java process. There will 
always be an error about "Cannot find PID file". The script should be reworked 
so that there are no errors and java is killed correctly.

This appears to be due to the script using the basename of the script:

NAME="$(basename $0)"

To look for the pid file:

if [ -f /var/run/$
{NAME}

.pid ]; then

This does work correctly if the script is run directly (basename will be 
"cloudstack-management", so "cloudstack-management.pid" file is found). However 
when a server is halted or rebooted, the script is not run directly but via the 
symlinks in /etc/rc.d/rc0.d/ and /etc/rc.d/rc0.d/, respectively. The symlinks 
are named "K20cloudstack-management" so the script looks for a pid file named 
"K20cloudstack-management.pid" which does not exist.

screenshots:

Before fix: 
![screen shot 2015-09-10 at 12 33 08 
am](https://cloud.githubusercontent.com/assets/1062642/9791113/207412f0-57f7-11e5-8d21-b7ef383747bd.png)

After fix:
![screen shot 2015-09-10 at 5 46 50 
pm](https://cloud.githubusercontent.com/assets/1062642/9791136/31c9ca90-57f7-11e5-98c5-9ad18f25788b.png)


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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-8815

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

https://github.com/apache/cloudstack/pull/799.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 #799


commit 45ebfb0d2f81a55c0f9ab89abfd0cb1de0c7b57c
Author: Sudhansu 
Date:   2015-09-10T14:29:51Z

CLOUDSTACK-8815 : Issues with cloudstack-management init script

instead of using basename use target 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: CLOUDSTACK-8815 : Issues with cloudstack-...

2015-09-21 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/799#issuecomment-141945369
  
@bhaisaab  For CentOS 7 we have we cloud-management.service and 
cloud-management.config  files. I don't see any other .rc file for 
cloud-management service. 

cloud-management.service
[Unit]
Description=CloudStack Management Server
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/sbin/tomcat-sysd start
ExecStop=/usr/sbin/tomcat-sysd stop
SuccessExitStatus=143
User=cloud
Group=cloud
EnvironmentFile=/etc/sysconfig/cloudstack-management

[Install]
WantedBy=multi-user.target

cloud-management.config :
# Required for a tocmat cloned service
SERVICE_NAME=cloudstack-management

# Where your java installation lives
#JAVA_HOME="/usr/lib/jvm/java"

@remibergsma 

I scanned through the packaging folder and found another  instance 
(cloud-ipallocator.rc) where the basename is directly used for referring PID 
file and fixed the same.  Below is the grep result before and after the fix.

Before:
Sudhansus-MAC:packaging sudhansu$ grep 'basename' */*.rc
centos63/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
centos63/cloud-ipallocator.rc:SHORTNAME=`basename $0`
centos63/cloud-management.rc:NAME="$(basename $(readlink -f $0))"
centos7/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
centos7/cloud-ipallocator.rc:SHORTNAME=`basename $0`
fedora20/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
fedora20/cloud-ipallocator.rc:SHORTNAME=`basename $0`
fedora20/cloud-management.rc:NAME="$(basename $(readlink -f $0))"
fedora21/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
fedora21/cloud-ipallocator.rc:SHORTNAME=`basename $0`
fedora21/cloud-management.rc:NAME="$(basename $(readlink -f $0))"

After:
Sudhansus-MAC:packaging sudhansu$ grep 'basename' */*.rc
centos63/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
centos63/cloud-ipallocator.rc:SHORTNAME="$(basename $(readlink -f $0))"
centos63/cloud-management.rc:NAME="$(basename $(readlink -f $0))"
centos7/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
centos7/cloud-ipallocator.rc:SHORTNAME="$(basename $(readlink -f $0))"
fedora20/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
fedora20/cloud-ipallocator.rc:SHORTNAME="$(basename $(readlink -f $0))"
fedora20/cloud-management.rc:NAME="$(basename $(readlink -f $0))"
fedora21/cloud-agent.rc:SHORTNAME=$(basename $0 | sed -e 
's/^[SK][0-9][0-9]//')
fedora21/cloud-ipallocator.rc:SHORTNAME="$(basename $(readlink -f $0))"
fedora21/cloud-management.rc:NAME="$(basename $(readlink -f $0))"





---
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: CLOUDSTACK-8917 : Instance tab takes long...

2015-09-28 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-8917 : Instance tab takes long time to load with 12K Vms

modified sql that is used for retrieving vm count .

In load test environment listVirtualmachine takes 8-11 sec to load. This 
environment has around 12k active VMs. Total number of rows is 190K.

Performance bottleneck in listVirtualmachine command is fetching the count 
and distinct vms.
{noformat}
// search vm details by ids
Pair, Integer> uniqueVmPair = 
_userVmJoinDao.searchAndCount(sc, searchFilter);
Integer count = uniqueVmPair.second();
{noformat}
 
 This takes 95% of the total time.

To fetch the count and distinct vms we are using below sqls.
 
 Query 1: 
{noformat}
SELECT DISTINCT(user_vm_view.id) FROM user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL  ORDER BY user_vm_view.id ASC  LIMIT 0, 20
 {noformat}

 Query 2: 

select count(distinct id) from user_vm_view WHERE user_vm_view.account_type 
!= 5  AND user_vm_view.display_vm = 1  AND user_vm_view.removed IS NULL


Query 2 is a problematic query. 

If we rewrite the query as mentioned below then it will be ~2x faster.

select count(*) from (select distinct id from user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL) as temp;


Mysql Test result:

With 134 active Vms (total rows 349)
mysql> select count(*) from vm_instance;
+--+
| count(*) |
+--+
|  349 |
+--+
1 row in set (0.00 sec)
mysql> select count(*) from user_vm_view;
+--+
| count(*) |
+--+
|  135 |
+--+
1 row in set (0.02 sec)
mysql> select count(distinct id) from user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL;
++
| count(distinct id) |
++
|134 |
++
1 row in set (0.02 sec)

mysql> select count(*) from (select distinct id from user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL) as temp;
+--+
| count(*) |
+--+
|  134 |
+--+
1 row in set (0.01 sec)


With 14326 active Vms (total rows 195660)

mysql> select count(*) from vm_instance;
+--+
| count(*) |
+--+
|   195660 |
+--+
1 row in set (0.04 sec)
mysql> select count(*) from user_vm_view;
+--+
| count(*) |
+--+
|41313 |
+--+
1 row in set (4.55 sec)
mysql> select count(distinct id) from user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL;
++
| count(distinct id) |
++
|  14326 |
++
1 row in set (7.39 sec)

mysql> select count(*) from (select distinct id from user_vm_view WHERE 
user_vm_view.account_type != 5  AND user_vm_view.display_vm = 1  AND 
user_vm_view.removed IS NULL) as temp;
+--+
| count(*) |
+--+
|14326 |
+--+
1 row in set (2.08 sec)


UI test Results:
Before:
![screen shot 2015-09-28 at 2 19 55 
pm](https://cloud.githubusercontent.com/assets/1062642/10133848/66af7c40-65fe-11e5-9ef5-ec6489c0fc06.png)

After
![screen shot 2015-09-28 at 2 33 38 
pm](https://cloud.githubusercontent.com/assets/1062642/10133852/6f512c9a-65fe-11e5-9ea1-890cf84d02b4.png)





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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-8917

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

https://github.com/apache/cloudstack/pull/894.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 #894


commit c28a58a8ff4ddde7b86e151ffee35ad26645e584
Author: Sudhansu 
Date:   2015-09-28T10:54:26Z

CLOUDSTACK-8917 : Instance tab takes long time to load with 12K active VM 
(total vms: 190K)

modified sql that is used for retrieving vm count .




---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-12 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/1516#issuecomment-218960848
  
@rhtyd 
Jenkin build is failing for cloud-util tests.
Below is the snippet. Could you please check this.

---
 T E S T S
---
Running org.apache.cloudstack.utils.volume.VirtualMachineDiskInfoTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.51 sec - 
in org.apache.cloudstack.utils.volume.VirtualMachineDiskInfoTest
Running org.apache.cloudstack.utils.imagestore.ImageStoreUtilTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.345 sec - 
in org.apache.cloudstack.utils.imagestore.ImageStoreUtilTest
Running org.apache.cloudstack.utils.process.ProcessTest
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 301.191 sec 
<<< FAILURE! - in org.apache.cloudstack.utils.process.ProcessTest
testProcessRunner(org.apache.cloudstack.utils.process.ProcessTest)  Time 
elapsed: 300.103 sec  <<< FAILURE!
java.lang.AssertionError: expected:<-1> but was:<0>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at 
org.apache.cloudstack.utils.process.ProcessTest.testProcessRunner(ProcessTest.java:43)



---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-18 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/1516#issuecomment-219995275
  
@swill  Thanks for the review. I have updated the test. Now its green. 
finally.


---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-18 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63715139
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+self.assertEqual(
+capacity_state[1][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[1][0])
+
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type = 3 order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertNotEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+return capacity_state[0][0]
+
+
+class TestHosts(cloudstackTestCase):
+
+"""
+Testing Hosts
+"""
+@classmethod
+def setUpClass(cls):
+cls.testClient = super(TestHosts, cls).getClsTestClient()
+cls.testdata = cls.testClient.getParsedTestDataConfig()
+cls.apiclient = cls.testClient.getApiClient()
+cls.dbclient = cls.testClient.getDbConnection()
+cls._cleanup = []
+
+# get zone, domain etc
+cls.zone = Zone(get_zone(cls.apiclient, 
cls.testClient.getZoneForTests()).__dic

[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-18 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63731204
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+self.assertEqual(
+capacity_state[1][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[1][0])
+
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type = 3 order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertNotEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+return capacity_state[0][0]
+
+
+class TestHosts(cloudstackTestCase):
+
+"""
+Testing Hosts
+"""
+@classmethod
+def setUpClass(cls):
+cls.testClient = super(TestHosts, cls).getClsTestClient()
+cls.testdata = cls.testClient.getParsedTestDataConfig()
+cls.apiclient = cls.testClient.getApiClient()
+cls.dbclient = cls.testClient.getDbConnection()
+cls._cleanup = []
+
+# get zone, domain etc
+cls.zone = Zone(get_zone(cls.apiclient, 
cls.testClient.getZoneForTests()).__dic

[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-19 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63893791
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+self.assertEqual(
+capacity_state[1][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[1][0])
+
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type = 3 order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertNotEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+return capacity_state[0][0]
+
+
+class TestHosts(cloudstackTestCase):
+
+"""
+Testing Hosts
+"""
+@classmethod
+def setUpClass(cls):
+cls.testClient = super(TestHosts, cls).getClsTestClient()
+cls.testdata = cls.testClient.getParsedTestDataConfig()
+cls.apiclient = cls.testClient.getApiClient()
+cls.dbclient = cls.testClient.getDbConnection()
+cls._cleanup = []
+
+# get zone, domain etc
+cls.zone = Zone(get_zone(cls.apiclient, 
cls.testClient.getZoneForTests()).__dic

[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-19 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63893826
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+self.assertEqual(
+capacity_state[1][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[1][0])
+
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type = 3 order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertNotEqual(
+capacity_state[0][0],
+host_state +
+"d",
+"Invalid db query response for capacity_state %s" %
+capacity_state[0][0])
+return capacity_state[0][0]
+
+
+class TestHosts(cloudstackTestCase):
+
+"""
+Testing Hosts
+"""
+@classmethod
+def setUpClass(cls):
+cls.testClient = super(TestHosts, cls).getClsTestClient()
+cls.testdata = cls.testClient.getParsedTestDataConfig()
+cls.apiclient = cls.testClient.getApiClient()
+cls.dbclient = cls.testClient.getDbConnection()
+cls._cleanup = []
+
+# get zone, domain etc
+cls.zone = Zone(get_zone(cls.apiclient, 
cls.testClient.getZoneForTests()).__dic

[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-19 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63894357
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
--- End diff --

This check is not required. The check_db will only be invoked if there is a 
host_db_id, storage_pool_db_id and capacity check =3. 
In my last check in I have added checks for this.


---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-19 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r63895181
  
--- Diff: test/integration/component/maint/test_capacity_host_delete.py ---
@@ -0,0 +1,195 @@
+# 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   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.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import Host, Cluster, Zone, Pod
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, list_hosts, get_pod
+
+from nose.plugins.attrib import attr
+
+import time
+import logging
+# These tests need to be run separately and not in parallel with other 
tests.
+# Because it disables the host
+# host_id column of op_host_capacity refers to host_id or a storage pool id
+#
+# This test is to make sure that Disable host only disables the capacities 
of type
+# CPU and MEMORY
+#
+# TEST:
+# Base Condition: There exists a host and storage pool with same id
+#
+# Steps:
+# 1. Find a host and storage pool having same id
+# 2. Disable the host
+# 3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host
+#is disabled
+# 4. verify that the STORAGE(3) capacity in op_host_capacity for storage 
pool with id
+#same as above host is not disabled
+#
+
+def update_host(apiclient, state, host_id):
+"""
+Function to Enable/Disable Host
+"""
+host_status = Host.update(
+apiclient,
+id=host_id,
+allocationstate=state
+)
+return host_status.resourcestate
+
+
+def check_db(self, host_state):
+"""
+Function to check capacity_state in op_host_capacity table
+"""
+capacity_state = self.dbclient.execute(
+"select capacity_state from op_host_capacity where host_id='%s' 
and capacity_type in (0,1) order by capacity_type asc;" %
+self.host_db_id[0][0])
+self.assertEqual(
+capacity_state[0][0],
--- End diff --

In my last check in I have added checks for this.

Actually we don't have to add these checks for inner list. The array is 
generated from mysql cursor. So either its empty (if no rows found)  or it has 
a value in [0][0].



---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-22 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9366: Capacity of one zone-wide primary storage ignored

Disable and Remove Host operation disables the primary storage capacity.

Steps to replicate:
Base Condition: There exists a host and storage pool with same id
Steps:
1. Find a host and storage pool having same id
2. Disable the host
3. verify that the CPU(1) and MEMORY(0) capacity in op_host_capacity for 
above host is disabled
4. verify that the STORAGE(3) capacity in op_host_capacity for storage pool 
with id same as above host is also disabled

RCA:
'host_id' column in 'op_host_capacity' table used for storing both storage 
pool id (for STORAGE capacity) and host id (MEMORY and CPU). While removing a 
HOST we also disable the capacity associated with host.

Ideally while disabling capacity we should only disable MEMORY and CPU 
capacity, but we are not doing so.

Code Path:
ResourceManagerImpl.doDeleteHost() -> 
ResourceManagerImpl.resourceStateTransitTo() -> 
CapacityDaoImpl.updateCapacityState(null, null, null, host.getId(), 
capacityState.toString())

updateCapacityState is updating disabling all entries which matches the 
host_id. This will also disable a entry having storage pool id same as that of 
host id.

Changes:
introduced new capacityType parameter in updateCapacityState method and 
necessary changes to add capacity_type clause in sql
also fixed incorrect sql builder logic (unused code path for which it is 
never surfaced )
Added marvin test to  check host and storagepool capacity when host is 
disabled

Test Result:
```
mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 
0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' , 
 total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' 
ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc 
where host_id=3;

+-++---++---+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE 
POOL |

+-++---++---+
|   3 | Enabled| MEMORY| 8589934592 | HOST  
|
|   3 | Enabled| CPU   |  32000 | HOST  
|
|   3 | Enabled| STORAGE   |  219902322 | STORAGE POOL  
|

+-++---++---+

9 rows in set (0.00 sec)

Disable Host 3 from UI.

mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 
0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' , 
 total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' 
ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc 
where host_id=3;

+-++---++---+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE 
POOL |

+-++---++---+
|   3 | Disabled   | MEMORY| 8589934592 | HOST  
|
|   3 | Disabled   | CPU   |  32000 | HOST  
|
|   3 | Disabled   | STORAGE   |  219902322 | STORAGE POOL  
|

+-++---++---+

After Fix:

mysql> select ohc.host_id, ohc.`capacity_state`,  case capacity_type  when 
0 then  'MEMORY'  when 1 then  'CPU'  ELSE  'STORAGE'  END as 'capacity_type' , 
 total_capacity, case capacity_type  when 0 then  'HOST'  when 1 then  'HOST' 
ELSE  'STORAGE POOL' END as 'HOST/STORAGE POOL'  from op_host_capacity ohc 
where host_id=3;

+-++---++---+
| host_id | capacity_state | capacity_type | total_capacity | HOST/STORAGE 
POOL |

+-++---++---+
|   3 | Enabled| MEMORY| 8589934592 | HOST  
|
|   3 | Enabled| CPU   |  32000 | HOST  
|
|   3 | Enabled| STORAGE   |  219902322 | STORAGE POOL  
|

+-++---++---+
3 rows in set (0.01 sec)

Disable Host 3 from U

[GitHub] cloudstack pull request: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-24 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1516#discussion_r60844257
  
--- Diff: engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java ---
@@ -962,35 +962,58 @@ public boolean removeBy(Short capacityType, Long 
zoneId, Long podId, Long cluste
 }
 
 @Override
-public void updateCapacityState(Long dcId, Long podId, Long clusterId, 
Long hostId, String capacityState) {
+public void updateCapacityState(Long dcId, Long podId, Long clusterId, 
Long hostId, String capacityState, short[] capacityType) {
 TransactionLegacy txn = TransactionLegacy.currentTxn();
 StringBuilder sql = new StringBuilder(UPDATE_CAPACITY_STATE);
 List resourceIdList = new ArrayList();
+StringBuilder where = new StringBuilder();
 
 if (dcId != null) {
-sql.append(" data_center_id = ?");
+where.append(" data_center_id = ? ");
 resourceIdList.add(dcId);
 }
 if (podId != null) {
-sql.append(" pod_id = ?");
+where.append((where.length() > 0) ? " and pod_id = ? " : " 
pod_id = ? ");
 resourceIdList.add(podId);
 }
 if (clusterId != null) {
-sql.append(" cluster_id = ?");
+where.append((where.length() > 0) ? " and cluster_id = ? " : " 
cluster_id = ? ");
 resourceIdList.add(clusterId);
 }
 if (hostId != null) {
-sql.append(" host_id = ?");
+where.append((where.length() > 0) ? " and host_id = ? " : " 
host_id = ? ");
 resourceIdList.add(hostId);
 }
 
+if (capacityType != null) {
+where.append((where.length() > 0) ? " and capacity_type in " : 
" capacity_type in ");
+
+StringBuilder builder = new StringBuilder();
+for( int i = 0 ; i < capacityType.length; i++ ) {
+if(i==0){
+builder.append(" (? ");
+}else{
+builder.append(" ,? ");
+}
+}
+builder.append(" ) ");
--- End diff --

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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-04-24 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/1516#issuecomment-213954430
  
@DaanHoogland  
Thanks for the review. I have made necessary changes. I think in t=your 
test setup op_host_capacity does not have capacity details, for which the test 
is failing. In my latest commit , I have added checks to ensure 
op_host_capacity is having required data before picking the host for test.



---
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: CLOUDSTACK-9366: Capacity of one zone-wid...

2016-05-05 Thread sudhansu7
Github user sudhansu7 commented on the pull request:

https://github.com/apache/cloudstack/pull/1516#issuecomment-217105794
  
@rhtyd @swill 
The branch has been re-based against master and also squashed multiple 
commits to a single.


---
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 #1763: CLOUDSTACK-9594: API "list templates template...

2016-11-11 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9594: API "list templates templatefilter=all" reveals all

API "list templates templatefilter=all" reveals all templates.
Using a "list templates templatefilter=all" API call any domain admin can 
see all templates of all domains in ACS. Information returned includes the 
account and domain of the template's owner.

The template data shows what that VM is using and any hints from the label. 
This would give an advantage in what attack vectors to use. The account and 
domain can possibly be used in brute force attack to guess the password and 
login information.

Test Scenario:

created two accounts in different domain.
{noformat}
mysql> select account_id,username,api_key from user where id in (4,5);

++---++
| account_id | username  | api_key  
  |

++---++
|  4 | sudadmin1 | 
3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg
 |
|  5 | sudadmin  | 
N5uHVOrg1Ek1F1a_5OXTz4WpLG3ewHqcbPUSBjQ-2CTJdxmUe2go0S8fyqH4Np0scYiehYg2KqthZXCWEyKx1A
 |

++---++
2 rows in set (0.00 sec)

mysql> select account_name,domain_id from account where id in (4,5);
+--+---+
| account_name | domain_id |
+--+---+
| sudadmin | 2 |
| sudadmin1| 3 |
+--+---+
2 rows in set (0.00 sec)
{noformat}

User sudadmin registered a private template named 'Debian'.


http://10.147.59.107:8080/client/api?apikey=N5uHVOrg1Ek1F1a_5OXTz4WpLG3ewHqcbPUSBjQ-2CTJdxmUe2go0S8fyqH4Np0scYiehYg2KqthZXCWEyKx1A&command=listTemplates&templatefilter=self&signature=ODt7zEWCLL20z1FT%2FIkd1molRaM%3D

listTemplate with "templatefilter=self", lists the newly registered 
template.

{noformat}

1

51026d32-60ee-4e25-8ffd-3fa3c57fc14c
Debian
Debian
false
2016-11-10T17:18:00-0500
true
false
VHD
false
false
38c1fc84-a687-11e6-a8c8-06f65453
Debian GNU/Linux 7(64-bit)
sudadmin
25fa5b74-d4c2-4bad-8e3a-ceffcd10985e
z1
Download Complete
262144
USER
XenServer
SUDDOMAIN
a350c00d-4048-4876-ae09-74ad4b7bb28c
false
e87a6d7291b999c92baa9623c9c3c207
{hypervisortoolsversion=xenserver61}
false
false


{noformat}

User: sudadmin1
listTemplate with "templatefilter=self" does not list any template.


http://10.147.59.107:8080/client/api?apikey=3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg&command=listTemplates&templatefilter=self&signature=RfKsdg3RxDkqJotbTlHU2RdbdPA%3D

{noformat}

{noformat}

NO TEMPLATES

**listTemplate with "templatefilter=all" lists all templates** 



http://10.147.59.107:8080/client/api?apikey=3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg&command=listTemplates&templatefilter=all&signature=l5tubfyABT67d1jY702dvtZODbc%3D


Result:

{noformat}

3

38451a02-a687-11e6-a8c8-06f65453
CentOS 5.6(64-bit) no GUI (XenServer)
CentOS 5.6(64-bit) no GUI (XenServer)
true



51026d32-60ee-4e25-8ffd-3fa3c57fc14c
Debian
Debian
false
2016-11-10T17:18:00-0500
true
false
VHD
false
false
38c1fc84-a687-11e6-a8c8-06f65453
Debian GNU/Linux 7(64-bit)
**sudadmin**
25fa5b74-d4c2-4bad-8e3a-ceffcd10985e
z1
262144
USER
XenServer
SUDDOMAIN
a350c00d-4048-4876-ae09-74ad4b7bb28c
false
e87a6d7291b9

[GitHub] cloudstack pull request #1795: CLOUDSTACK-9625:Unable to scale VM from any o...

2016-11-28 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9625:Unable to scale VM from any offering to a dynamic offering

1.create a custom service offering.
2.stop the running vm
3.scale the vm offering from small to custom offering by providing 
(customcpunumber=4,customcpuspeed=512,custommemory=256)

tried with other values as well.

actual result:
scaleVirtualMachine fails with error and its says enter valid value cpu 
core and value should be in between 1 to 2147483647 even though we enter 
cpucore as 4

test/integration/component/test_dynamic_compute_offering.py  also faling.

Test scale running VM from dynamic offering to dynamic offering ... === 
TestName: test_change_so_running_vm_dynamic_to_dynamic_1_ADMIN_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale running VM from dynamic offering to dynamic offering ... === 
TestName: test_change_so_running_vm_dynamic_to_dynamic_2_USER_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale running VM from dynamic offering to static offering ... === 
TestName: test_change_so_running_vm_dynamic_to_static_1_ADMIN_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale running VM from dynamic offering to static offering ... === 
TestName: test_change_so_running_vm_dynamic_to_static_2_USER_ACCOUNT | Status : 
FAILED ===
FAIL
Test scale running VM from static offering to dynamic offering ... === 
TestName: test_change_so_running_vm_static_to_dynamic_1_ADMIN_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale running VM from static offering to dynamic offering ... === 
TestName: test_change_so_running_vm_static_to_dynamic_2_USER_ACCOUNT | Status : 
FAILED ===
FAIL
Test scale running VM from static offering to static offering ... === 
TestName: test_change_so_running_vm_static_to_static_1_ADMIN_ACCOUNT | Status : 
FAILED ===
FAIL
Test scale running VM from static offering to static offering ... === 
TestName: test_change_so_running_vm_static_to_static_2_USER_ACCOUNT | Status : 
FAILED ===
FAIL
Test scale stopped VM from dynamic offering to dynamic offering ... === 
TestName: test_change_so_stopped_vm_dynamic_to_dynamic_1_ADMIN_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale stopped VM from dynamic offering to dynamic offering ... === 
TestName: test_change_so_stopped_vm_dynamic_to_dynamic_2_USER_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale stopped VM from dynamic offering to static offering ... === 
TestName: test_change_so_stopped_vm_dynamic_to_static_1_ADMIN_ACCOUNT | Status 
: SUCCESS ===
ok
Test scale stopped VM from dynamic offering to static offering ... === 
TestName: test_change_so_stopped_vm_dynamic_to_static_2_USER_ACCOUNT | Status : 
SUCCESS ===
ok
Test scale stopped VM from static offering to dynamic offering ... === 
TestName: test_change_so_stopped_vm_static_to_dynamic_1_ADMIN_ACCOUNT | Status 
: FAILED ===
FAIL
Test scale stopped VM from static offering to dynamic offering ... === 
TestName: test_change_so_stopped_vm_static_to_dynamic_2_USER_ACCOUNT | Status : 
FAILED ===
FAIL
Test scale stopped VM from static offering to static offering ... === 
TestName: test_change_so_stopped_vm_static_to_static_1_ADMIN_ACCOUNT | Status : 
SUCCESS ===
ok
Test scale stopped VM from static offering to static offering ... === 
TestName: test_change_so_stopped_vm_static_to_static_2_USER_ACCOUNT | Status : 
SUCCESS ===


Root Cause:
ParamUnpackWorker creates a Map\\>, which 
should be converted to a  Map\. 




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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9625

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

https://github.com/apache/cloudstack/pull/1795.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 #1795


commit e97dda6da3a0222619c044c17c99ff7a577f902f
Author: Sudhansu 
Date:   2016-11-28T18:20:00Z

CLOUDSTACK-9625: Unable to scale VM from any offering to a dynamic offering




---
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 #1796: CLOUDSTACK-9626: Instance fails to start afte...

2016-11-28 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9626: Instance fails to start after unsuccesful compute

offering upgrade.

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9626

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

https://github.com/apache/cloudstack/pull/1796.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 #1796


commit 43cac6202c558b8b0f7a02901817997603bf621d
Author: Sudhansu 
Date:   2016-11-29T05:18:04Z

CLOUDSTACK-9626: Instance fails to start after unsuccesful compute
offering upgrade.




---
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 #1797: CLOUDSTACK-9630: Cannot use listNics API as a...

2016-11-29 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9630: Cannot use listNics API as advertised



listNics API for a VM, "type" was not returned within API response.

EXPECTED BEHAVIOR
==
The listNics API response return type of NIC (type), as specified in 
https://cloudstack.apache.org/api/apidocs-4.8/user/listNics.html

ACTUAL BEHAVIOR
==
The listNics API response does not return type of NIC.

(local) 🐵 > list nics 
virtualmachineid=a69edaf5-8f21-41ff-8c05-263dc4bd5354
count = 1
nic:
id = 211e0d46-6b94-4425-99f7-e8e9efea2472
deviceid = 0
gateway = 10.1.1.1
ipaddress = 10.1.1.45
isdefault = True
macaddress = 02:00:06:f6:00:01
netmask = 255.255.255.0
networkid = c08fddf1-fd77-4810-a062-ea9d03c5c7e6
virtualmachineid = a69edaf5-8f21-41ff-8c05-263dc4bd5354

Solution:
added "type" details for listNics API response.

After Fix:

(local) 🐵 > list nics 
virtualmachineid=a69edaf5-8f21-41ff-8c05-263dc4bd5354 
count = 1
nic:
id = 211e0d46-6b94-4425-99f7-e8e9efea2472
broadcasturi = vlan://743
deviceid = 0
gateway = 10.1.1.1
ipaddress = 10.1.1.45
isdefault = True
isolationuri = vlan://743
macaddress = 02:00:06:f6:00:01
netmask = 255.255.255.0
networkid = c08fddf1-fd77-4810-a062-ea9d03c5c7e6
traffictype = Guest
**type = Isolated**
virtualmachineid = a69edaf5-8f21-41ff-8c05-263dc4bd5354

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9630

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

https://github.com/apache/cloudstack/pull/1797.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 #1797


commit f5e6136265580af069879bcb5b9cb86646f79ea9
Author: Sudhansu 
Date:   2016-11-29T08:44:24Z

CLOUDSTACK-9630: Cannot use listNics API as advertised

added "type" details for listNics API response.




---
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 #1797: CLOUDSTACK-9630: Cannot use listNics API as a...

2016-11-29 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1797#discussion_r90009164
  
--- Diff: server/src/com/cloud/api/ApiResponseHelper.java ---
@@ -3461,10 +3470,21 @@ public NicResponse createNicResponse(Nic result) {
 response.setNetmask(result.getIPv4Netmask());
 response.setMacAddress(result.getMacAddress());
 
+if (result.getBroadcastUri() != null) {
+response.setBroadcastUri(result.getBroadcastUri().toString());
--- End diff --

@ustcweizhou As per api doc these info should be part of response. Even 
listVirtualMachines with details=nics 

`command=listVirtualMachines&details=nics&id=6eea5ceb-e943-4ef3-9f40-4671364d03ab&response=json`
 provides these details.



---
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 issue #1763: CLOUDSTACK-9594: API "list templates templatefilter=...

2016-12-01 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1763
  
@rhtyd @jburwell 

I think the fix for CLOUDSTACK-9376 will not address below scenario. I will 
test this and confirm. 

1. templatefilter=all or isofilter=all is applicable only to admin
and domain admin.
2. With templatefilter=all or isofilter=all below are the visiblity
of templates in system.
a. admin should be able to see all templates/iso in system.
b. domain admin should be able to see all public template and
templates under its domain tree (including sub domain).
c. domain admin in a project context should be able to see all public
 templates and templates registered as project account and templates
 which are shared(using updateTemplatePermission api) with project account.



---
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 #1805: CLOUDSTACK-9637: Template create from snapsho...

2016-12-01 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9637: Template create from snapshot does not populate vm_t…


**ISSUE**

Template create from snapshot does not populate vm_template_details

**REPRO STEPS**
==
1. Register a template A and specify property:
Root disk controller: scsi
NIC adapter type: E1000
Keyboard type: us

2. Create a vm instance from template A

3. Take volume snapshot for vm instance

4. Delete VM instance

5. Switch to "Storage->Snapshots", convert snapshot to a template B

6. Observe template B does not inherit property from template A, the table 
vm_template_details is empty


**SOLUTION**: Retrieve and add source template details to VMTemplateVO.

`Before Fix:

mysql> select id,name,source_template_id from vm_template where id=202; 
+-+++
| id  | name   | source_template_id |
+-+++
| 202 | Debian |   NULL |
+-+++
1 row in set (0.00 sec)

mysql> select * from vm_template_details where template_id=202; 
++-++---+-+
| id | template_id | name   | value | display |
++-++---+-+
|  1 | 202 | keyboard   | us|   1 |
|  2 | 202 | nicAdapter | E1000 |   1 |
|  3 | 202 | rootDiskController | scsi  |   1 |
++-++---+-+
3 rows in set (0.00 sec)

mysql> select id,name,source_template_id from vm_template where 
source_template_id=202;
+-+++
| id  | name   | source_template_id |
+-+++
| 203 | derived-debian |202 |
+-+++
1 row in set (0.00 sec)

mysql> select * from vm_template_details where template_id=203;
Empty set (0.00 sec)


After Fix:

mysql> select id,name,source_template_id from vm_template where 
source_template_id=202;
+-+--++
| id  | name | source_template_id |
+-+--++
| 203 | derived-debian   |202 |
| 204 | debian-derived-after-fix |202 |
+-+--++
2 rows in set (0.00 sec)

mysql> select * from vm_template_details where template_id=204;
++-++---+-+
| id | template_id | name   | value | display |
++-++---+-+
|  4 | 204 | keyboard   | us|   1 |
|  5 | 204 | nicAdapter | E1000 |   1 |
|  6 | 204 | rootDiskController | scsi  |   1 |
++-++---+-+
3 rows in set (0.00 sec)`

**Marvin Test :** test_template_from_snapshot_with_template_details.py

**Result:**
test_01_create_template_snampshot 
(integration.component.test_template_from_snapshot_with_template_details.TestCreateTemplate)
 ... === TestName: test_01_create_template_snampshot | Status : SUCCESS ===
ok

--
Ran 1 test in 864.523s

OK

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

    $ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9637

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

https://github.com/apache/cloudstack/pull/1805.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 #1805


commit 9da5a6afe30838ddc82847d15a9bebf4cb4bcb7f
Author: Sudhansu 
Date:   2016-12-01T18:38:12Z

CLOUDSTACK-9637: Template create from snapshot does not populate 
vm_template_details

Summary: Retrieve and add source template details to VMTemplateVO.




---
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 issue #1796: CLOUDSTACK-9626: Instance fails to start after unsuc...

2016-12-02 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1796
  
@rhtyd modified the base branch to 4.9.


---
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...

2016-12-02 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9647: NIC adapter type becomes e1000 , even after changing…

**Issue:**
NIC adapter type becomes e1000 , even after changing the global parameter 
"vmware.systemvm.nic.device.type" to vmxnet3.

**Description**

Repro steps:-

-> Set global parameter "vmware.systemvm.nic.device.type" to vmxnet3.
-> Created a VPC network and deployed a VM using the same network.
-> Checked the router details and found that for private network , it was 
showing nic adapter type as VMXNET3 and for other networks (public and guest) 
it was showing as E1000.
-> Rebooted the VPC network and checked it again, it was same as earlier.

/vmfs/volumes/3e5dffc5-9b91346e/r-2805-VM # grep virtualDev r-2805-VM.vmx
pciBridge4.virtualDev = "pcieRootPort"
pciBridge5.virtualDev = "pcieRootPort"
pciBridge6.virtualDev = "pcieRootPort"
pciBridge7.virtualDev = "pcieRootPort"
scsi0.virtualDev = "lsilogic"
ethernet0.virtualDev = "vmxnet3"
ethernet1.virtualDev = "e1000"
ethernet2.virtualDev = "e1000"
ethernet3.virtualDev = "e1000"

**Root Cause:**

While preparing PlugNicCommand for VPC Network, NIC adapter type is not 
used.

PlugNicCommand:

"com.cloud.agent.api.PlugNicCommand": {
"nic": {
"deviceId": 1,
"networkRateMbps": 200,
"defaultNic": true,
"pxeDisable": true,
"nicUuid": "9ae41bb1-dc22-4489-95f4-2c2659c99486",
"uuid": "4ffdfb14-7d47-4ffd-b7fb-85f171c349ff",
"ip": "10.104.92.161",
"netmask": "255.255.254.0",
"gateway": "10.104.92.1",
"mac": "06:f8:de:00:00:14",
"broadcastType": "Vlan",
"type": "Public",
"broadcastUri": "vlan://untagged",
"isolationUri": "vlan://untagged",
"isSecurityGroupEnabled": false
},
"instanceName": "r-2784-VM",
"vmType": "DomainRouter",
"wait": 0
}

Code Snippet:

public class VpcVirtualNetworkApplianceManagerImpl extends 
VirtualNetworkApplianceManagerImpl implements VpcVirtualNetworkApplianceManager 
{

...
...

 @Override
 public boolean finalizeCommandsOnStart(Commands cmds, 
VirtualMachineProfile profile) {


...
...
//3) PREPARE PLUG NIC COMMANDS
try {
//add VPC router to public networks
...
..

   final PlugNicCommand plugNicCmd = new 
PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, publicNic.getNetworkId(), 
publicNic.getBroadcastUri().toString()),
domainRouterVO.getInstanceName(), 
domainRouterVO.getType());


...
...

//add VPC router to guest networks
for (Pair nicNtwk : guestNics) {
Nic guestNic = nicNtwk.first();
//plug guest nic
final PlugNicCommand plugNicCmd = new 
PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, guestNic.getNetworkId(), 
null), domainRouterVO.getInstanceName(), domainRouterVO.getType());
cmds.addCommand(plugNicCmd);

...
   }
...
...
}

**Solution:**
Fetch and add NIC adapter type to PlugNicCommand. Refer attached 
ES-4150-patch.diff for more details.

Command After fix:

   {
 "com.cloud.agent.api.PlugNicCommand":{
"nic":{
   "deviceId":2,
   "networkRateMbps":200,
   "defaultNic":false,
   "pxeDisable":true,
   "nicUuid":"06c1b9dc-9061-4bbf-8ad3-60baa3ee3e9a",
   "uuid":"381fc075-4035-40c3-a09c-84baf6f1a0b2",
   "ip":"10.147.100.10",
   "netmask":"255.255.255.0",
   "gateway":"10.147.100.1",
   "mac":"06

[GitHub] cloudstack pull request #1811: CLOUDSTACK-9649: In the management server log...

2016-12-02 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9649: In the management server log there is an error


ISSUE

In the management server log there is an error

2016-10-01 00:07:31,670 ERROR [c.c.h.v.r.VmwareResource] 
(DirectAgent-417:ctx-e8c89b3f strmg-esx-01, cmd: GetRouterAlertsCommand) 
(logid:7beb3819) Command failed due to Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922 

In case of basic zone and VMWare ESXi host, the NIC 2 always gets 0.0.0.0 
as IP address. Looks like we are generating an error for connecting through 
this invalid IP.

2016-10-01 04:37:31,680 DEBUG [c.c.a.m.AgentManagerImpl] 
(RouterStatusMonitor-1:ctx-8880f9c8) (logid:946838b8) Details from executing 
class com.cloud.agent.api.routing.GetRouterAlertsCommand: Command failed due to 
Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922

2016-10-01 04:37:31,680 WARN  [c.c.n.r.VirtualNetworkApplianceManagerImpl] 
(RouterStatusMonitor-1:ctx-8880f9c8) (logid:946838b8) Unable to get alerts from 
router r-4-VM Command failed due to Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922

2016-10-01 04:37:31,682 DEBUG [c.c.n.ExternalDeviceUsageManagerImpl] 
(ExternalNetworkMonitor-1:ctx-913c7bae) (logid:1b926a60) External devices stats 
collector is running...

Root Cause:
As Link local is not used in basic zone mode (vmware). 0.0.0.0 is just 
shown as a placeholder address. In getRouterAlerts before sending 
GetRouterAlertsCommand added check for ip and skip the command if ip is 
'0.0.0.0'.


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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9649

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

https://github.com/apache/cloudstack/pull/1811.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 #1811


commit c3f082eb785a35017156251a2d13b5735060fe9a
Author: Sudhansu 
Date:   2016-12-02T10:19:08Z

CLOUDSTACK-9649: In the management server log there is an error
 related to 0.0.0.0 IP address

Added guest ip of VR as control ip for a Basic zone with VMware.




---
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...

2016-12-04 Thread sudhansu7
Github user sudhansu7 commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/914#discussion_r90809764
  
--- 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 --

@yvsubhash  getVm() raises CloudRuntimeException if Vm is not found. 

Scenario:

Deploy a vm and ensure its in running state.
Take a VM snapshot ( either disk or disk + memory ) for VM.
After snapshot operation is sucessful , destroy the VM.

Observation :

VM destroy Fails with reason VM with name: i-2-7-VM does not exist.
SNapshot moves to Expunging state , and VM moves to stopped state.

Solution : Place your changes within a try.. catch block



---
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 issue #1763: CLOUDSTACK-9594: API "list templates templatefilter=...

2016-12-06 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1763
  
@abhinandanprateek 
Below is test scenario and result. I have also reverted the changes 
introduced in CLOUDSTACK-9376.

Test Scenario:

Domain: SUDDOMAIN
Domain Admin: sudadmin
Registered a template Debian.
```
{
"account": "sudadmin",
"checksum": "e87a6d7291b999c92baa9623c9c3c207",
"created": "2016-11-10T17:18:00-0500",
"crossZones": false,
"details": {
"hypervisortoolsversion": "xenserver61"
},
"displaytext": "Debian",
"domain": "SUDDOMAIN",
"domainid": "a350c00d-4048-4876-ae09-74ad4b7bb28c",
"format": "VHD",
"hypervisor": "XenServer",
"id": "51026d32-60ee-4e25-8ffd-3fa3c57fc14c",
"isdynamicallyscalable": false,
"isextractable": false,
"isfeatured": false,
"ispublic": false,
"isready": true,
"name": "Debian",
"ostypeid": "38c1fc84-a687-11e6-a8c8-06f65453",
"ostypename": "Debian GNU/Linux 7(64-bit)",
"passwordenabled": false,
"size": 262144,
"sshkeyenabled": false,
"tags": [],
"templatetype": "USER",
"zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
"zonename": "z1"
}
```

Domain: SUDDOMAIN1
Domain Admin user: sudadmin1

No template resigtered.

normal user: suduser1
Registed a template 'debian-user'
```
{
"account": "suduser1",
"checksum": "b118393ea4a86c494669d915d8a788cf",
"created": "2016-12-06T16:20:57-0500",
"crossZones": false,
"details": {
"hypervisortoolsversion": "xenserver61"
},
"displaytext": "debian-user",
"domain": "SUDDOMAIN1",
"domainid": "204c25e0-307e-4cf9-974c-e6aca6cc5257",
"format": "VHD",
"hypervisor": "XenServer",
"id": "696fcbf5-5644-44a2-a0b4-88d131bb70cb",
"isdynamicallyscalable": false,
"isextractable": false,
"isfeatured": false,
"ispublic": false,
"isready": true,
"name": "debian-user",
"ostypeid": "38c1fc84-a687-11e6-a8c8-06f65453",
"ostypename": "Debian GNU/Linux 7(64-bit)",
"passwordenabled": false,
"size": 262144,
"sshkeyenabled": false,
"tags": [],
"templatetype": "USER",
"zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
"zonename": "z1"
}
```

API results:

With (CLOUDSTACK-9376) for 4.5+. commit 0cb60a7:


http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=self&_=1481042783138

{"listtemplatesresponse":{}}

Result: Domain admin does not have any templates and so no results.


http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=all&_=1481042783138


{"listtemplatesresponse":{"uuidList":[],"errorcode":431,"cserrorcode":4350,"errortext":"Filter
 all can be specified by admin only"}}

Result: with templatefilter=all we are getting above error respose as 
expected. But with this domain admin does not have any visibility of templates 
resgistered under his domain.

With the current fix:


http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=all&_=1481045782311
```
{
"listtemplatesresponse": {
"count": 2,
"template": [
{
"account": "system",
"checksum": "905cec8

[GitHub] cloudstack issue #1811: CLOUDSTACK-9649: In the management server log there ...

2016-12-07 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1811
  
@borisstoyanov 
This appears in general in Basic Zone with VMware Host.
The exception is raised in 'RouterStatusMonitor-' thread. 



---
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 issue #1797: CLOUDSTACK-9630: Cannot use listNics API as advertis...

2016-12-09 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1797
  
@jburwell  I have modified the base branch to 4.9 . Also added a marvin 
test to check nic details. 


---
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 #1844: CLOUDSTACK-9668 : disksizeallocated of Primar...

2016-12-21 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9668 : disksizeallocated of PrimaryStorage is different fr…

…om the total size of a volume

update capacity if current allocated is different from used bytes in DB.



Disksizeallocated of PrimaryStorage is different from the total size of a 
volume.

steps to reproduce:
1. create another primary storage( apart from default) with storage tag 
(say tag1)
2. create a disk offering with storage tag as that step1.
3. create a data disk with above disk offering.
4. attach the disk to vm.
5. when capacity checker thread runs it will update the used_capacity. Note 
down the op_host_capacity details for pool created in step1.
6. detach the disk and destroy the volume.
7. when capacity checker thread runs it will not update the used_capacity 
to 0.

Root Cause: If all volumes have been removed from storage_pool then 
capacity checker does not update the op_host_capacity.
Resolution: Update capacity if current allocated is different from used 
bytes in DB.

```

public void createCapacityEntry(StoragePoolVO storagePool, short 
capacityType, long allocated) {
..
..
..

} else {
CapacityVO capacity = capacities.get(0);
if (capacity.getTotalCapacity() != totalOverProvCapacity || 
**allocated != 0L** || capacity.getCapacityState() != capacityState) { 
   
..
}
}

..
.
```



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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9668

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

https://github.com/apache/cloudstack/pull/1844.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 #1844


commit a8ba7c47787afa660327edca5604b1a82ab70aa8
Author: Sudhansu 
Date:   2016-12-21T08:37:47Z

CLOUDSTACK-9668 : disksizeallocated of PrimaryStorage is different from the 
total size of a volume

update capacity if current allocated is different from used bytes in DB.




---
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 #1849: CLOUDSTACK-9690: Scale CentOS7 VM fails with ...

2016-12-21 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9690: Scale CentOS7 VM fails with error

Scale CentOS7 VM fails with error "Cannot scale up the vm because of memory 
constraint violation"

When creating VM from CentOS 7 template on the XenServer with dynamically 
scaling enabled, instance starts with base specified memory instead of memory * 
4 as static limit.

As the result, attempt to scale VM throws error in MS log:
```
java.lang.RuntimeException: Job failed due to exception Unable to scale vm 
due to Catch exception com.cloud.utils.exception.CloudRuntimeException when 
scaling VM:i-24-3976-VM due to com.cloud.utils.exception.CloudRuntimeException: 
Cannot scale up the vm because of memory constraint violation: 0 <= 
memory-static-min(2147483648) <= memory-dynamic-min(8589934592) <= 
memory-dynamic-max(8589934592) <= memory-static-max(2147483648)
```
REPO STEPS
=

1. Enable dynamic scaling in Global settings
2. Register an CentOS 7 tempplate(with tools) and tick dynamic scaling
3. Deploy VM with this template
4. Start the VM and try to change service offering

EXPECTED RESULT: VM should start with static limit 4x and 
scale up when offering is changed
ACTUAL RESULT: VM starts with maximum static limit of  and 
doesn't scale up with error in ms log :
Cannot scale up the vm because of memory constraint violation:


Root Cause: Xensever guest OS memory values are missing for 'CentOS 7'.

Solution: Add Xensever guest OS memory values for 'CentOS 7'. But this 
needs patching and restart of management server. In this fix the hardcoded 
values are moved from Java files to database.

1. Removed XenServerGuestOsMemoryMap from CitrixHelper.java
This java file was holding a static in memory map named 
XenServerGuestOsMemoryMap. This was the source for xenserver dynamic memory 
values(max and min). These values were moved to guest_os_details table.

2. DAO layer was modified to access these values.
3. VirtualMachineTo object was modified to populate the dynamic memory 
values.
4. addGuestOs and UpdateGuestOS api has been modified to update memory 
values.

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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9690

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

https://github.com/apache/cloudstack/pull/1849.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 #1849


commit 60021defea46b8ef8a87660070b4ad6c1c73af79
Author: Sudhansu 
Date:   2016-12-21T17:41:12Z

CLOUDSTACK-9690: Scale CentOS7 VM fails with error

1. Removed XenServerGuestOsMemoryMap from CitrixHelper.java
This java file was holding a static in memory map named 
XenServerGuestOsMemoryMap. This was the source for xenserver dynamic memory 
values(max and min). These values were moved to guest_os_details table.

2. DAO layer was modified to access these values.
3. VirtualMachineTo object was modified to populate the dynamic memory 
values.
4. addGuestOs and UpdateGuestOS api has been modified to update memory 
values.




---
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 #1850: CLOUDSTACK-9694: Unable to limit the Public I...

2016-12-21 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9694: Unable to limit the Public IPs in VPC



Unable to limit the Public IPs in VPC.
In VPC network, while acquiring the IP addresses, in the resource_count 
table, count for the domain is getting increased. However, when the resource 
count is updated at Domain level, resource count is getting reverted to only 
non-vpc ip count.

Steps to Reproduce:

1. Create a VPC
2. Create a VPC tier.
3. Check resource_count table and note the ip address count. (say 1)
4. Keep acquiring the IP addresses, (say 4 IP addresses). Now new ip 
address count resource_count table is 5.
5. update the resource count at domain level.
6. the resource_count is updated back 1

Root Cause: Update resource count command recalculates the resource count. 
While computing public IP we are not considering the ips allocated to VPC.

ResourceLimitManagerImpl.java -> calculatePublicIpForAccount() -> 
IPAddressDaoImpl.countAllocatedIPsForAccount()

Currently we have below query builder. Which does not consider vpc_id 
column.
```
AllocatedIpCountForAccount = createSearchBuilder(Long.class);
AllocatedIpCountForAccount.select(null, Func.COUNT, 
AllocatedIpCountForAccount.entity().getAddress());
AllocatedIpCountForAccount.and("account", 
AllocatedIpCountForAccount.entity().getAllocatedToAccountId(), Op.EQ);
AllocatedIpCountForAccount.and("allocated", 
AllocatedIpCountForAccount.entity().getAllocatedTime(), Op.NNULL);
AllocatedIpCountForAccount.and("network", 
AllocatedIpCountForAccount.entity().getAssociatedWithNetworkId(), Op.NNULL);
AllocatedIpCountForAccount.done();
```
it generates below sql query
```
SELECT COUNT(user_ip_address.public_ip_address) FROM user_ip_address WHERE 
user_ip_address.account_id = 6  AND user_ip_address.allocated IS NOT NULL  AND 
user_ip_address.network_id IS NOT NULL  AND user_ip_address.removed IS NULL
```
Fix:
Add vpc_id check in query.
```
AllocatedIpCountForAccount = createSearchBuilder(Long.class);
AllocatedIpCountForAccount.select(null, Func.COUNT, 
AllocatedIpCountForAccount.entity().getAddress());
AllocatedIpCountForAccount.and("account", 
AllocatedIpCountForAccount.entity().getAllocatedToAccountId(), Op.EQ);
AllocatedIpCountForAccount.and("allocated", 
AllocatedIpCountForAccount.entity().getAllocatedTime(), Op.NNULL);
AllocatedIpCountForAccount.and().op("network", 
AllocatedIpCountForAccount.entity().getAssociatedWithNetworkId(), Op.NNULL);
AllocatedIpCountForAccount.or("vpc", 
AllocatedIpCountForAccount.entity().getVpcId(), Op.NNULL);
AllocatedIpCountForAccount.cp();
AllocatedIpCountForAccount.done();
```
SQL:
```
SELECT COUNT(user_ip_address.public_ip_address) FROM user_ip_address WHERE 
user_ip_address.account_id = 6  AND user_ip_address.allocated IS NOT NULL  AND 
( user_ip_address.network_id IS NOT NULL or user_ip_address.vpc_id IS NOT NULL) 
AND user_ip_address.removed IS NULL
```


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

$ git pull https://github.com/sudhansu7/cloudstack CLOUDSTACK-9694

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

https://github.com/apache/cloudstack/pull/1850.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 #1850


commit 24837f655033583388bb608f63039f8e341c16d3
Author: Sudhansu 
Date:   2016-12-21T18:24:01Z

CLOUDSTACK-9694: Unable to limit the Public IPs in VPC

Added missing clause to check for vpc_id




---
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 issue #1849: CLOUDSTACK-9690: Scale CentOS7 VM fails with error

2016-12-22 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1849
  
@rhtyd Thanks for the Review. I have amended the code as per your 
suggestion.


---
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 #1869: CLOUDSTACK-9701: When host is disabled/remove...

2016-12-26 Thread sudhansu7
GitHub user sudhansu7 opened a pull request:

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

CLOUDSTACK-9701: When host is disabled/removed, capacity_type for loc…

…al storage in op_host_capacity is still enabled

Description
=
When a host is disabled or removed, local storage related capacity data for 
the corresponding local storage of the host is still in enabled state.
This may not directly impact deploy VM functionality (for example) but it 
does show incorrect capacity calculations.

Steps
=

1. Enable local storage for zone
2. Disable host or remove host (after adding it to maintenance mode)
3. Check op_host_capacity (capacity_state=9)

In either of the cases, the local storage related capacity is still enabled 
for the host.


```
mysql> select id, name, uuid, status,resource_state, type, removed from 
host where type = 'Routing';

+++--+++-+-+
| id | name   | uuid | status | 
resource_state | type| removed |

+++--+++-+-+
|  1 | xenserver-nvjxksqs | 16a922d0-7b4c-4c84-baad-5bd91542181c | Up | 
Disabled   | Routing | NULL|
|  4 | xenserver-hnkwhblp | 0e0f161a-7cf5-4e44-8bcc-a25ba7d798e5 | Up | 
Enabled| Routing | NULL|

+++--+++-+-+
2 rows in set (0.00 sec)

mysql> select host_id, used_capacity, reserved_capacity, total_capacity, 
capacity_type, capacity_state from op_host_capacity where capacity_type=9;

+-+---+---++---++
| host_id | used_capacity | reserved_capacity | total_capacity | 
capacity_type | capacity_state |

+-+---+---++---++
|   3 |   4194304 | 0 |   491505319936 |
 9 | Enabled|
|   4 |   4194304 | 0 |   491505319936 |
 9 | Enabled|

+-+---+---++---++
2 rows in set (0.00 sec)

mysql> select id, name, removed, pool_type, capacity_bytes from 
storage_pool where id in (3,4);

++--+-+---++
| id | name | removed | pool_type | 
capacity_bytes |

++--+-+---++
|  3 | xenserver-nvjxksqs Local Storage | NULL| LVM   |   
491505319936 |
|  4 | xenserver-hnkwhblp Local Storage | NULL| LVM   |   
491505319936 |

++--+-+---++

mysql> select host_id, used_capacity, reserved_capacity, total_capacity, 
capacity_type, capacity_state from op_host_capacity where capacity_type in 
(0,1,3,9);

+-+---+---++---++
| host_id | used_capacity | reserved_capacity | total_capacity | 
capacity_type | capacity_state |

+-+---+---++---++
|   1 |1342177280 | 0 |15721585024 |
 0 | Disabled   |
|   1 |  1000 | 0 |  12400 |
 1 | Disabled   |
|   1 |  11995288 | 0 | 11804569632768 |
 3 | Enabled|
|   4 |2013265920 | 0 |15721585024 |
 0 | Enabled|
|   4 |  2600 | 0 |  12400 |
 1 | Enabled|
|   2 | 0 | 0 | 11804569632768 |
 3 | Enabled|
|   3 |   4194304 | 0 |   491505319936 |
 9 | Disabled   |
|   4 |   4194304 | 0 |   491505319936 |
 9 | Enabled|

+-+---+---++---++
8 rows in set (0.00 sec)


```

After fix:
```
mysql> select host_id, used_capacity, reserved_capacity, total_capacity, 
capacity_type, capacity_state from op_host_capacity where capacity_type in 
(0,1,3,9);

+-+---+---++---++
| host_id | used_capacity | reserved_capacity | total_capacity | 
capac

[GitHub] cloudstack issue #1797: CLOUDSTACK-9630: Cannot use listNics API as advertis...

2017-01-24 Thread sudhansu7
Github user sudhansu7 commented on the issue:

https://github.com/apache/cloudstack/pull/1797
  
@pdion891 
The first listNic example is incorrect code. Which has been fixed in this 
PR.  You can use listVirtualMachine command to see the nic response. 

As per code there is no restriction on broadcasturi. If broadcasturi is not 
null then it will part of vm response. 
So the ListNic should also behave the same way.

'''
if (details.contains(VMDetails.all) || details.contains(VMDetails.nics)) {
long nic_id = userVm.getNicId();
if (nic_id > 0) {
NicResponse nicResponse = new NicResponse();
nicResponse.setId(userVm.getNicUuid());
nicResponse.setIpaddress(userVm.getIpAddress());
nicResponse.setGateway(userVm.getGateway());
nicResponse.setNetmask(userVm.getNetmask());
nicResponse.setNetworkid(userVm.getNetworkUuid());
nicResponse.setNetworkName(userVm.getNetworkName());
nicResponse.setMacAddress(userVm.getMacAddress());
nicResponse.setIp6Address(userVm.getIp6Address());
nicResponse.setIp6Gateway(userVm.getIp6Gateway());
nicResponse.setIp6Cidr(userVm.getIp6Cidr());
if (userVm.getBroadcastUri() != null) {

nicResponse.setBroadcastUri(userVm.getBroadcastUri().toString());
}
if (userVm.getIsolationUri() != null) {

nicResponse.setIsolationUri(userVm.getIsolationUri().toString());
}
if (userVm.getTrafficType() != null) {

nicResponse.setTrafficType(userVm.getTrafficType().toString());
}
if (userVm.getGuestType() != null) {
nicResponse.setType(userVm.getGuestType().toString());
}
nicResponse.setIsDefault(userVm.isDefaultNic());
List secondaryIps = 
ApiDBUtils.findNicSecondaryIps(userVm.getNicId());
if (secondaryIps != null) {
List ipList = new 
ArrayList();
for (NicSecondaryIpVO ip : secondaryIps) {
NicSecondaryIpResponse ipRes = new 
NicSecondaryIpResponse();
ipRes.setId(ip.getUuid());
ipRes.setIpAddr(ip.getIp4Address());
ipList.add(ipRes);
}
nicResponse.setSecondaryIps(ipList);
}
nicResponse.setObjectName("nic");
userVmResponse.addNic(nicResponse);
}
}
'''
Is there any 


---
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.
---