Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices exist #846

Merged
merged 1 commit into from May 26, 2016

Conversation

kishankavala
Copy link
Contributor

external network device usage monitor thread that runs every 5mins by default (based on global config external.network.stats.interval) and runs coalesce query to acquire a lock. When there are no external devices exist, there is no need to run usage collection.
Added test case to verify that usage collection task is not run when there are no External LB or External FW

@asfbot
Copy link

asfbot commented Sep 18, 2015

cloudstack-pull-rats #648 SUCCESS
This pull request looks good

@asfbot
Copy link

asfbot commented Sep 18, 2015

cloudstack-pull-analysis #596 SUCCESS
This pull request looks good

@wilderrodrigues
Copy link
Contributor

Ping @remibergsma @borisroman

@kishankavala added a unit test to cover his change. I went through the code and haven't found any issue.

The if block if(_hostDao.listByType(Host.Type.ExternalFirewall).isEmpty() && _hostDao.listByType(Host.Type.ExternalLoadBalancer).isEmpty()){ added to ExternalDeviceUsageManagerImpl make sense and are covered.

Please give it a go with the integration tests we have.

Cheers,
Wilder

@@ -342,6 +342,12 @@ public ExternalDeviceNetworkUsageTask() {

@Override
protected void runInContext() {
//Check if there are any external deivces
//Skip external device usage collection if none exist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kishankavala Could you please change from "deivces" to "devices"?

Also, you can use this commented lines as a Javadoc block describing the runInContext() method (if you think it would improve your code).

That typo is just a detail, your code seems ok.

@rajesh-battala
Copy link
Contributor

I have gone through the code. patch LGTM.

@swill
Copy link
Contributor

swill commented Apr 21, 2016

I need one more LGTM. I will add this to my CI queue. Thx...

@GabrielBrascher
Copy link
Member

GabrielBrascher commented Apr 21, 2016

Although I pointed a typo in a comment line (nothing serious), the code LGTM.

@swill
Copy link
Contributor

swill commented Apr 21, 2016

Thank you @GabrielBrascher. @kishankavala would you mind fixing that typo? I will try to get this run though CI soon...

public List<HostVO> listByType(Host.Type type) {
SearchCriteria<HostVO> sc = TypeSearch.create();
sc.setParameters("type", type);
return listBy(sc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the listByType consumers are not doing != null checks, we can fix it by doing it here and returning a Collections.emptyList(); this way the methods ensures that no null is returned

Please fix the NPE case, otherwise LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd
listBy(sc) in GenericDao base returns an empty ArrayList if there is no matching data.
listByType doesn't return null

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough

@rohityadavcloud
Copy link
Member

@kishankavala please rebase against latest master and push -f, update on status of your PR

I've left a NPE check, we should merge it once you fix that. Thanks.

tag:easypr

cc @swill

@swill
Copy link
Contributor

swill commented May 20, 2016

@kishankavala please rebase this PR as we have merge conflicts. Thanks...

@kishankavala
Copy link
Contributor Author

@swill rebased with latest master
@GabrielBrascher fixed the typo

@rohityadavcloud
Copy link
Member

LGTM

@swill
Copy link
Contributor

swill commented May 25, 2016

CI RESULTS

Tests Run: 85
  Skipped: 0
   Failed: 2
   Errors: 1
 Duration: 10h 41m 55s

Summary of the problem(s):

ERROR: Test to verify access to loadbalancer haproxy admin stats page
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_internal_lb.py", line 854, in tearDown
    raise Exception("Cleanup failed with %s" % e)
Exception: Cleanup failed with Job failed: {jobprocstatus : 0, created : u'2016-05-24T12:24:25+0200', jobresult : {errorcode : 530, errortext : u'Failed to delete network'}, cmd : u'org.apache.cloudstack.api.command.user.network.DeleteNetworkCmd', userid : u'a5538db6-2168-11e6-932f-5254001daa61', jobstatus : 2, jobid : u'8e7ebb93-fb36-4842-8e2d-5cefea2ff80a', jobresultcode : 530, jobresulttype : u'object', jobinstancetype : u'Network', accountid : u'a5537331-2168-11e6-932f-5254001daa61'}
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_network_F00C21/results.txt
FAIL: test_02_vpc_privategw_static_routes (integration.smoke.test_privategw_acl.TestPrivateGwACL)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_privategw_acl.py", line 262, in test_02_vpc_privategw_static_routes
    self.performVPCTests(vpc_off)
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_privategw_acl.py", line 325, in performVPCTests
    privateGw_1 = self.createPvtGw(vpc_1, "10.0.3.100", "10.0.3.101", acl1.id, vlan_1)
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_privategw_acl.py", line 595, in createPvtGw
    self.fail("Failed to create Private Gateway ==> %s" % e)
AssertionError: Failed to create Private Gateway ==> Execute cmd: createprivategateway failed, due to: errorCode: 431, errorText:Network with vlan vlan://100 already exists in zone 1
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_network_F00C21/results.txt
FAIL: Test destroy(expunge) Virtual Machine
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_vm_life_cycle.py", line 646, in test_09_expunge_vm
    self.assertEqual(list_vm_response,None,"Check Expunged virtual machine is in listVirtualMachines response")
AssertionError: Check Expunged virtual machine is in listVirtualMachines response
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_vpc_routers_J2J0PP/results.txt

Associated Uploads

/tmp/MarvinLogs/DeployDataCenter__May_24_2016_06_36_18_ATGDYK:

/tmp/MarvinLogs/test_network_F00C21:

/tmp/MarvinLogs/test_vpc_routers_J2J0PP:

Uploads will be available until 2016-07-25 02:00:00 +0200 CEST

Comment created by upr comment.

@swill
Copy link
Contributor

swill commented May 26, 2016

CI RESULTS

Tests Run: 82
  Skipped: 0
   Failed: 0
   Errors: 3
 Duration: 8h 33m 42s

Summary of the problem(s):

ERROR: test suite for <class 'integration.smoke.test_vpc_vpn.TestRVPCSite2SiteVpn'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 209, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 292, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 315, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/util.py", line 471, in try_run
    return func()
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_vpc_vpn.py", line 835, in setUpClass
    cls.template.download(cls.apiclient)
  File "/usr/lib/python2.7/site-packages/marvin/lib/base.py", line 1350, in download
    elif 'Downloaded' in template.status:
TypeError: argument of type 'NoneType' is not iterable
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_network_VKMDK0/results.txt
ERROR: test suite for <class 'integration.smoke.test_vpc_vpn.TestVpcRemoteAccessVpn'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 209, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 292, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 315, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/util.py", line 471, in try_run
    return func()
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_vpc_vpn.py", line 293, in setUpClass
    cls.template.download(cls.apiclient)
  File "/usr/lib/python2.7/site-packages/marvin/lib/base.py", line 1350, in download
    elif 'Downloaded' in template.status:
TypeError: argument of type 'NoneType' is not iterable
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_network_VKMDK0/results.txt
ERROR: test suite for <class 'integration.smoke.test_vpc_vpn.TestVpcSite2SiteVpn'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 209, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 292, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/suite.py", line 315, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose-1.3.7-py2.7.egg/nose/util.py", line 471, in try_run
    return func()
  File "/data/git/cs1/cloudstack/test/integration/smoke/test_vpc_vpn.py", line 472, in setUpClass
    cls.template.download(cls.apiclient)
  File "/usr/lib/python2.7/site-packages/marvin/lib/base.py", line 1350, in download
    elif 'Downloaded' in template.status:
TypeError: argument of type 'NoneType' is not iterable
----------------------------------------------------------------------
Additional details in: /tmp/MarvinLogs/test_network_VKMDK0/results.txt

Associated Uploads

/tmp/MarvinLogs/DeployDataCenter__May_25_2016_19_10_57_8DI3FD:

/tmp/MarvinLogs/test_network_VKMDK0:

/tmp/MarvinLogs/test_vpc_routers_PXO5U1:

Uploads will be available until 2016-07-26 02:00:00 +0200 CEST

Comment created by upr comment.

@swill
Copy link
Contributor

swill commented May 26, 2016

This is a cleaner run because this issue is a known issue. I think this one is ready now...

@asfgit asfgit merged commit c12d836 into apache:master May 26, 2016
asfgit pushed a commit that referenced this pull request May 26, 2016
Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices existexternal network device usage monitor thread that runs every 5mins by default (based on global config external.network.stats.interval) and runs coalesce query to acquire a lock. When there are no external devices exist, there is no need to run usage collection.
Added test case to verify that usage collection task is not run when there are no External LB or External FW

* pr/846:
  Bug-ID: CLOUDSTACK-8870: Skip external device usage collection if no external devices exist

Signed-off-by: Will Stevens <williamstevens@gmail.com>
@rajesh-battala
Copy link
Contributor

code/patch LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants