You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by cloudsadhu <gi...@git.apache.org> on 2015/08/13 14:03:09 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

GitHub user cloudsadhu opened a pull request:

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

    CLOUDSTACK-8731-checking usage event for delete volume

    @summary: Test volume delete event generation in error state condition ... === TestName: test_volume_delete_event_errorState | Status : SUCCESS ===
    ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 490.221s
    
    OK


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

    $ git pull https://github.com/cloudsadhu/cloudstack cs

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

    https://github.com/apache/cloudstack/pull/691.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 #691
    
----
commit 84c6d7fcb62dbb0886345bd9d14a0bdb980f61b5
Author: sadhu <sa...@sadhu.com>
Date:   2015-08-13T11:36:04Z

    CLOUDSTACK-8731-checking usage event for delete volume

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073739
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    +                    hypervisor=self.hypervisor
    +                )
    +            else:
    +                try:
    +                    hosts = list_hosts(
    +                        self.apiclient,
    +                        zoneid=router.zoneid,
    +                        type='Routing',
    +                        state='Up',
    +                        id=router.hostid
    +                    )
    +
    +                    self.assertEqual(
    --- End diff --
    
    use validateList here


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

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by bhaisaab <gi...@git.apache.org>.
Github user bhaisaab commented on the pull request:

    https://github.com/apache/cloudstack/pull/691#issuecomment-134917634
  
    LGTM. @cloudsadhu  are you improving it based on @ksowmya 's comment?


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

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073818
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    +                    hypervisor=self.hypervisor
    +                )
    +            else:
    +                try:
    +                    hosts = list_hosts(
    +                        self.apiclient,
    +                        zoneid=router.zoneid,
    +                        type='Routing',
    +                        state='Up',
    +                        id=router.hostid
    +                    )
    +
    +                    self.assertEqual(
    +                        isinstance(hosts, list),
    +                        True,
    +                        "Check list host returns a valid list"
    +                    )
    +
    +                    host = hosts[0]
    +                    result = get_process_status(
    +                        host.ipaddress,
    +                        22, "root", "xenroot", router.linklocalip,
    +                        "iptables -I INPUT 1 -j DROP"
    --- End diff --
    
    Delete this rule once the test is done so that it won't have impact on the other tests.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by cloudsadhu <gi...@git.apache.org>.
Github user cloudsadhu commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38084154
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    +                    hypervisor=self.hypervisor
    +                )
    +            else:
    +                try:
    +                    hosts = list_hosts(
    +                        self.apiclient,
    +                        zoneid=router.zoneid,
    +                        type='Routing',
    +                        state='Up',
    +                        id=router.hostid
    +                    )
    +
    +                    self.assertEqual(
    +                        isinstance(hosts, list),
    +                        True,
    +                        "Check list host returns a valid list"
    +                    )
    +
    +                    host = hosts[0]
    +                    result = get_process_status(
    +                        host.ipaddress,
    +                        22, "root", "xenroot", router.linklocalip,
    +                        "iptables -I INPUT 1 -j DROP"
    +                    )
    +
    --- End diff --
    
    Thanks for the review comment and its good suggestion, to get the credential from configuration.so i have added the code accordingly. 
     host = hosts[0]
                        result = get_process_status(
                            host.ipaddress,
                            22, self.services["host"]["username"], self.services["host"]["password"], router.linklocalip,
                            "iptables -I INPUT 1 -j DROP"
                        )
    
    
    but for this comment : this is a double hop to router from the host instead of management serve -- regarding this  added code  to access  router based on hypervisor type( management server for vmawre and host  for xen/kvm hypervisor ).  so i feel it justify the purpose.
    
    
    
    



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073673
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    --- End diff --
    
    use validateList instead of this assertEqual method.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:

    https://github.com/apache/cloudstack/pull/691#issuecomment-139788478
  
    @cloudsadhu Any update on this? If you process the review comments we can merge it soon. Let me know if you need help.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by ksowmya <gi...@git.apache.org>.
Github user ksowmya commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r37381189
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    +                    hypervisor=self.hypervisor
    +                )
    +            else:
    +                try:
    +                    hosts = list_hosts(
    +                        self.apiclient,
    +                        zoneid=router.zoneid,
    +                        type='Routing',
    +                        state='Up',
    +                        id=router.hostid
    +                    )
    +
    +                    self.assertEqual(
    +                        isinstance(hosts, list),
    +                        True,
    +                        "Check list host returns a valid list"
    +                    )
    +
    +                    host = hosts[0]
    +                    result = get_process_status(
    +                        host.ipaddress,
    +                        22, "root", "xenroot", router.linklocalip,
    +                        "iptables -I INPUT 1 -j DROP"
    +                    )
    +
    --- End diff --
    
    I believe this is a double hop to router from the host instead of management server. Do you think you can use get_host_credentials for getting host password instead of hard coding?
    Otherwise LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by cloudsadhu <gi...@git.apache.org>.
Github user cloudsadhu closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073806
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    --- End diff --
    
    Delete this rule once the test is done so that it won't have impact on the other tests.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073620
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    --- End diff --
    
    Try to convert it to lower case and compare it with "basic"


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by cloudsadhu <gi...@git.apache.org>.
Github user cloudsadhu commented on the pull request:

    https://github.com/apache/cloudstack/pull/691#issuecomment-179025093
  
    for same issue Another PR created and checked in master so closing this PR request.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8731-checking usage event for ...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/691#discussion_r38073932
  
    --- Diff: test/integration/component/test_persistent_networks.py ---
    @@ -1459,6 +1459,135 @@ def test_delete_account(self):
     
             return
     
    +    def test_volume_delete_event_errorState(self):
    +        """
    +        @summary: Test volume delete event generation in error state condition
    +        @Steps:
    +
    +        Step1: Create  a network using network created in Step1
    +        Step2: Verifying that  network creation is successful
    +        Step3: Login to Virtual router and add iptable  rule to block insertion of vm rules
    +        Step6: deploy a vm using network created in step2
    +        Step7: check the Vm status for failure
    +        Step8: destroy and expunge the vm
    +        Step9: list the generated events for volume delete event.
    +        """
    +
    +        # Listing all the networks available
    +
    +        account = Account.create(
    +            self.api_client,
    +            self.services["account"],
    +            domainid=self.domain.id)
    +
    +        network = Network.create(
    +            self.apiclient,
    +            self.services["isolated_network"],
    +            networkofferingid=self.isolated_persistent_network_offering.id,
    +            accountid=self.account.name,
    +            domainid=self.domain.id,
    +            zoneid=self.zone.id)
    +
    +        response = verifyNetworkState(
    +            self.apiclient,
    +            network.id,
    +            "implemented")
    +        exceptionOccured = response[0]
    +        isNetworkInDesiredState = response[1]
    +        exceptionMessage = response[2]
    +
    +        if (exceptionOccured or (not isNetworkInDesiredState)):
    +            self.fail(exceptionMessage)
    +        self.assertIsNotNone(
    +            network.vlan,
    +            "vlan must not be null for persistent network")
    +        try:
    +            if self.zone.networktype == "Basic":
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    listall="true"
    +                )
    +            else:
    +                list_router_response = list_routers(
    +                    self.apiclient,
    +                    account=self.account.name,
    +                    domainid=self.account.domainid
    +                )
    +            self.assertEqual(
    +                isinstance(list_router_response, list),
    +                True,
    +                "Check list response returns a valid list"
    +            )
    +            router = list_router_response[0]
    +
    +            self.debug("Router ID: %s, state: %s" % (router.id, router.state))
    +
    +            self.assertEqual(
    +                router.state,
    +                'Running',
    +                "Check list router response for router state"
    +            )
    +            self.hypervisor = self.testClient.getHypervisorInfo()
    +            if self.hypervisor.lower() in ('vmware', 'hyperv'):
    +                result = get_process_status(
    +                    self.apiclient.connection.mgtSvr,
    +                    22,
    +                    self.apiclient.connection.user,
    +                    self.apiclient.connection.passwd,
    +                    router.linklocalip,
    +                    "iptables -I INPUT 1 -j DROP",
    +                    hypervisor=self.hypervisor
    +                )
    +            else:
    +                try:
    +                    hosts = list_hosts(
    +                        self.apiclient,
    +                        zoneid=router.zoneid,
    +                        type='Routing',
    +                        state='Up',
    +                        id=router.hostid
    +                    )
    +
    +                    self.assertEqual(
    +                        isinstance(hosts, list),
    +                        True,
    +                        "Check list host returns a valid list"
    +                    )
    +
    +                    host = hosts[0]
    +                    result = get_process_status(
    +                        host.ipaddress,
    +                        22, "root", "xenroot", router.linklocalip,
    +                        "iptables -I INPUT 1 -j DROP"
    +                    )
    +
    +                except Exception as e:
    +                    raise Exception("Exception raised in accessing/running the command on hosts  : %s " % e)
    +
    +        except Exception as e:
    +            raise Exception("Exception raised in getting hostcredentials: %s " % e)
    +
    +        with self.assertRaises(Exception) as context:
    +            virtual_machine = VirtualMachine.create(
    +                self.apiclient,
    +                self.services["virtual_machine"],
    +                networkids=[
    +                    network.id],
    +                serviceofferingid=self.service_offering.id,
    +                accountid=self.account.name,
    +                domainid=self.domain.id)
    +        #self.assertTrue('This is broken' in context.exception)
    +        account.delete(self.api_client)
    +        qresultset = self.dbclient.execute(
    --- End diff --
    
    Try to use listevents API instead of db query if possible


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