Hi Imesh, Yes the logic is correct. The issue is application runtime is still there even application is undeployed. I gues
handleApplicationRemoval is executed withing handleApplicationInstanceTerminatedEvent . Since termination of instances is failed, I guess handleApplicationInstanceTerminatedEvent is not called which makes handleApplicationRemoval is not called. Thus application is not removed. On Wed, Feb 18, 2015 at 10:59 AM, Imesh Gunaratne <im...@apache.org> wrote: > Hi Udara, > > The above condition is correct, if application runtime is not there we > cannot undeploy an application. In your scenario first we need to check the > status of the application at the time you tried to undeploy. If application > has not created at all you cannot undeploy, but you should be able to > remove. > > Thanks > > On Wed, Feb 18, 2015 at 9:42 AM, Udara Liyanage <ud...@wso2.com> wrote: > >> Hi, >> >> The following exception is seen when an application is undeployed. Please >> note that* application didn't get activated* since member not joined. >> May be due to an inconsistency caused by this error, application can not >> be removed hereafter. I get NOT_ACCEPTABLE HTTP response. Seems application >> run time is still there though application is undeployed which is not >> complete. >> What is the way to recover from this point? >> >> >> if (StratosApiV41Utils.getApplicationRuntime(applicationId) != null) { >> return Response.status(Response.Status.NOT_ACCEPTABLE).build(); >> } >> >> [2015-02-18 09:33:39,531] INFO >> {org.apache.stratos.autoscaler.services.impl.AutoscalerServiceImpl} - >> Starting to undeploy application: [application-id] single-cartridge-app >> [2015-02-18 09:33:39,532] INFO >> {org.apache.stratos.autoscaler.services.impl.AutoscalerServiceImpl} - >> Removing application signup: [application-id] single-cartridge-app >> [2015-02-18 09:33:39,564] INFO >> {org.apache.stratos.manager.components.ApplicationSignUpHandler} - >> Removing application signup: [application-id] single-cartridge-app >> [tenant-id] -1234 >> [2015-02-18 09:33:39,584] INFO >> {org.apache.stratos.manager.components.ApplicationSignUpHandler} - >> Application signup removed successfully: [application-id] >> single-cartridge-app [tenant-id] -1234 >> [2015-02-18 09:33:39,589] INFO >> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - >> Publishing Cluster terminating event for [application] >> single-cartridge-app [cluster] php1.php.domain [instance] >> single-cartridge-app-1 >> [2015-02-18 09:33:39,606] INFO >> {org.apache.stratos.cloud.controller.messaging.topology.TopologyBuilder} - >> Cluster Terminating adding status started forphp1.php.domain >> [2015-02-18 09:33:39,613] INFO >> {org.apache.stratos.autoscaler.applications.topic.ApplicationsEventPublisher} >> - Publishing Application Inactivated event for [application]: >> single-cartridge-app [instance]: single-cartridge-app-1 >> [2015-02-18 09:33:39,637] ERROR >> {org.apache.stratos.messaging.message.processor.application.ApplicationInstanceInactivatedMessageProcessor} >> - Invalid State transfer from [ Created ] to [ Inactive ] >> [2015-02-18 09:33:39,648] INFO >> {org.apache.stratos.cloud.controller.messaging.publisher.TopologyEventPublisher} >> - Publishing Cluster terminating event: [application-id] >> single-cartridge-app [cluster id] php1.php.domain [instance-id] >> single-cartridge-app-1 >> [2015-02-18 09:33:39,663] INFO >> {org.apache.stratos.autoscaler.pojo.policy.PolicyManager} - Deployment >> policy is removed successfully: [application-id] single-cartridge-app >> [2015-02-18 09:33:39,663] INFO >> {org.apache.stratos.autoscaler.services.impl.AutoscalerServiceImpl} - >> Application undeployed successfully: [application-id] single-cartridge-app >> [2015-02-18 09:33:39,672] INFO >> {org.apache.stratos.autoscaler.event.receiver.topology.AutoscalerTopologyEventReceiver} >> - [ClusterTerminatingEvent] Received: class >> org.apache.stratos.messaging.event.topology.ClusterInstanceTerminatingEvent >> [2015-02-18 09:33:39,673] WARN >> {org.apache.stratos.autoscaler.status.processor.cluster.ClusterStatusActiveProcessor} >> - No possible state change found for [type] [cluster] php1.php.domain >> [instance] >> [2015-02-18 09:33:39,673] INFO >> {org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor} - Starting >> to terminate all members in cluster [php1.php.domain] Network Partition >> [network-partition-1], Partition [partition-1] >> [2015-02-18 09:33:39,676] INFO >> {org.apache.stratos.autoscaler.client.CloudControllerClient} - Terminating >> instance via cloud controller: [member] >> php1.php.domaina499661b-98a4-41f2-b11c-0d79c956557c >> [2015-02-18 09:33:39,861] INFO >> {org.apache.stratos.cloud.controller.iaases.JcloudsIaas} - Starting to >> terminate member: [cartridge-type] php [member-id] >> php1.php.domaina499661b-98a4-41f2-b11c-0d79c956557c >> [2015-02-18 09:33:43,898] ERROR >> {org.apache.stratos.cloud.controller.services.impl.InstanceTerminator} - >> *Instance >> termination failed*! MemberContext [applicationId=single-cartridge-app, >> cartridgeType=php, clusterId=php1.php.domain, >> memberId=php1.php.domaina499661b-98a4-41f2-b11c-0d79c956557c, >> instanceId=RegionOne/a5d9a838-a2c6-45cc-bed1-5d6e6c4e6f43, >> partition=Partition [id=partition-1, description=null, isPublic=false, >> provider=openstack, partitionMin=0, partitionMax=0, properties=Properties >> [properties=[Property [name=region, value=RegionOne]]]], >> defaultPrivateIP=10.0.0.151, defaultPublicIP=192.168.17.138, >> allocatedIPs=[192.168.17.138], publicIPs=[192.168.17.138], >> privateIPs=[10.0.0.151], initTime=1424232119212, lbClusterId=null, >> networkPartitionId=network-partition-1, >> instanceMetadata=org.apache.stratos.cloud.controller.domain.InstanceMetadata@3e7ef695, >> properties=Properties [properties=[Property [name=PRIMARY, value=false], >> Property [name=MIN_COUNT, value=1]]]] >> java.lang.NullPointerException: arg[0] in >> {invocation=org.jclouds.openstack.nova.v2_0.NovaApi.public abstract >> com.google.common.base.Optional >> org.jclouds.openstack.nova.v2_0.NovaApi.getFloatingIPExtensionForZone(java.lang.String)[null], >> result={annotationParser={caller=NovaApi.getFloatingIPExtensionForZone[null]}}} >> at >> com.google.common.base.Preconditions.checkNotNull(Preconditions.java:253) >> at >> org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.apply(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java:67) >> at >> org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.apply(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java:43) >> at >> org.jclouds.rest.internal.DelegatesToInvocationFunction.propagateContextToDelegate(DelegatesToInvocationFunction.java:205) >> at >> org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:154) >> at >> org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123) >> at com.sun.proxy.$Proxy118.getFloatingIPExtensionForZone(Unknown Source) >> at >> org.apache.stratos.cloud.controller.iaases.openstack.networking.NovaNetworkingApi.releaseAddress(NovaNetworkingApi.java:239) >> at >> org.apache.stratos.cloud.controller.iaases.openstack.OpenstackIaas.releaseAddress(OpenstackIaas.java:239) >> at >> org.apache.stratos.cloud.controller.iaases.JcloudsIaas.destroyNode(JcloudsIaas.java:341) >> at >> org.apache.stratos.cloud.controller.iaases.JcloudsIaas.terminateInstance(JcloudsIaas.java:321) >> at >> org.apache.stratos.cloud.controller.services.impl.InstanceTerminator.run(InstanceTerminator.java:56) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) >> at java.lang.Thread.run(Thread.java:662) >> Exception in thread "pool-28-thread-2" >> org.apache.stratos.cloud.controller.exception.CloudControllerException: >> Instance termination failed! MemberContext >> [applicationId=single-cartridge-app, cartridgeType=php, >> clusterId=php1.php.domain, >> memberId=php1.php.domaina499661b-98a4-41f2-b11c-0d79c956557c, >> instanceId=RegionOne/a5d9a838-a2c6-45cc-bed1-5d6e6c4e6f43, >> partition=Partition [id=partition-1, description=null, isPublic=false, >> provider=openstack, partitionMin=0, partitionMax=0, properties=Properties >> [properties=[Property [name=region, value=RegionOne]]]], >> defaultPrivateIP=10.0.0.151, defaultPublicIP=192.168.17.138, >> allocatedIPs=[192.168.17.138], publicIPs=[192.168.17.138], >> privateIPs=[10.0.0.151], initTime=1424232119212, lbClusterId=null, >> networkPartitionId=network-partition-1, >> instanceMetadata=org.apache.stratos.cloud.controller.domain.InstanceMetadata@3e7ef695, >> properties=Properties [properties=[Property [name=PRIMARY, value=false], >> Property [name=MIN_COUNT, value=1]]]] >> at >> org.apache.stratos.cloud.controller.services.impl.InstanceTerminator.run(InstanceTerminator.java:63) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) >> at java.lang.Thread.run(Thread.java:662) >> Caused by: java.lang.NullPointerException: arg[0] in >> {invocation=org.jclouds.openstack.nova.v2_0.NovaApi.public abstract >> com.google.common.base.Optional >> org.jclouds.openstack.nova.v2_0.NovaApi.getFloatingIPExtensionForZone(java.lang.String)[null], >> result={annotationParser={caller=NovaApi.getFloatingIPExtensionForZone[null]}}} >> at >> com.google.common.base.Preconditions.checkNotNull(Preconditions.java:253) >> at >> org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExte >> >> -- >> >> Udara Liyanage >> Software Engineer >> WSO2, Inc.: http://wso2.com >> lean. enterprise. middleware >> >> web: http://udaraliyanage.wordpress.com >> phone: +94 71 443 6897 >> > > > > -- > Imesh Gunaratne > > Technical Lead, WSO2 > Committer & PMC Member, Apache Stratos > -- Udara Liyanage Software Engineer WSO2, Inc.: http://wso2.com lean. enterprise. middleware web: http://udaraliyanage.wordpress.com phone: +94 71 443 6897