You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/17 17:53:24 UTC
[GitHub] [cloudstack] shwstppr opened a new pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
shwstppr opened a new pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329
### Description
`listHostsMetrics` API could fail in case of zero CPU with Double to String conversion.
Fixes #5300
Failure could also be seen in case of some locales, #4733
Backports #4900
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900527732
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian. SL-JID 895
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900550893
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901034017
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez commented on a change in pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
nvazquez commented on a change in pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#discussion_r690864996
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
Review comment:
Can we add some unit tests for it?
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
+ DecimalFormat decimalFormat = new DecimalFormat("#.##");
+ try {
+ return decimalFormat.parse(cpu).doubleValue();
+ } catch (ParseException e) {
+ throw new CloudRuntimeException(e);
Review comment:
What about logging the exception and handling the exception? Either here or in the usage of this function. For example, the character in the PR description can cause the API to still fail:
````
"cpuallocated": "∞%",
"cpuallocatedpercentage": "∞%",
"cpuallocatedvalue": 500,
"cpuallocatedwithoverprovisioning": "∞%",
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901034596
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901068387
@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901034017
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] shwstppr commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900510968
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900550893
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900511279
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900511279
@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] shwstppr commented on a change in pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#discussion_r690959912
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
Review comment:
Added test
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
+ DecimalFormat decimalFormat = new DecimalFormat("#.##");
+ try {
+ return decimalFormat.parse(cpu).doubleValue();
+ } catch (ParseException e) {
+ throw new CloudRuntimeException(e);
Review comment:
@nvazquez as the ParseException is thrown as CloudRuntimeException, it will get logged:
```
INFO [c.c.a.ApiServer] (qtp357350214-317:ctx-828b25d5) (logid:77b09f95) Timezone offset from UTC is: 0.0
ERROR [c.c.a.ApiServer] (qtp357350214-32:ctx-f4aa35d7 ctx-d7301148) (logid:b4fa39eb) unhandled exception executing api command: [Ljava.lang.String;@1a6da41c
com.cloud.utils.exception.CloudRuntimeException: Unparseable number: "abc"
at org.apache.cloudstack.response.HostMetricsResponse.parseCPU(HostMetricsResponse.java:228)
at org.apache.cloudstack.response.HostMetricsResponse.setCpuUsed(HostMetricsResponse.java:125)
at org.apache.cloudstack.metrics.MetricsServiceImpl.listHostMetrics(MetricsServiceImpl.java:284)
at org.apache.cloudstack.api.ListHostsMetricsCmd.execute(ListHostsMetricsCmd.java:50)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:156)
at com.cloud.api.ApiServer.queueCommand(ApiServer.java:764)
at com.cloud.api.ApiServer.handleRequest(ApiServer.java:588)
at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:321)
at com.cloud.api.ApiServlet$1.run(ApiServlet.java:134)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:131)
at com.cloud.api.ApiServlet.doGet(ApiServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1386)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:500)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.text.ParseException: Unparseable number: "abc"
at java.base/java.text.NumberFormat.parse(NumberFormat.java:431)
at org.apache.cloudstack.response.HostMetricsResponse.parseCPU(HostMetricsResponse.java:226)
at org.apache.cloudstack.response.HostMetricsResponse.setCpuUsed(HostMetricsResponse.java:125)
... 51 more
```
And API will fail in this case:
```
(local) 🐝 > list hostsmetrics id=fc75a8b3-263d-4231-8635-45715edea15a
🙈 Error: (HTTP 530, error code 0) Unparseable number: "abc"
```
PR description shows API output. With the change (similar to main branch), `listHostsMetrics` API won't fail when there is 0 cpu for host or locale issue and it will just report `∞%` or `NaN Ghz` as values.
Change for not showing these invalid values can considered in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez merged pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
nvazquez merged pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd closed pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
rhtyd closed pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901051292
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian. SL-JID 907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] shwstppr commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900510968
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rhtyd closed pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
rhtyd closed pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] weizhouapache commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901067783
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900551120
@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] shwstppr commented on a change in pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#discussion_r690959912
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
Review comment:
Added test
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
+ DecimalFormat decimalFormat = new DecimalFormat("#.##");
+ try {
+ return decimalFormat.parse(cpu).doubleValue();
+ } catch (ParseException e) {
+ throw new CloudRuntimeException(e);
Review comment:
@nvazquez as the ParseException is thrown as CloudRuntimeException, it will get logged:
```
INFO [c.c.a.ApiServer] (qtp357350214-317:ctx-828b25d5) (logid:77b09f95) Timezone offset from UTC is: 0.0
ERROR [c.c.a.ApiServer] (qtp357350214-32:ctx-f4aa35d7 ctx-d7301148) (logid:b4fa39eb) unhandled exception executing api command: [Ljava.lang.String;@1a6da41c
com.cloud.utils.exception.CloudRuntimeException: Unparseable number: "abc"
at org.apache.cloudstack.response.HostMetricsResponse.parseCPU(HostMetricsResponse.java:228)
at org.apache.cloudstack.response.HostMetricsResponse.setCpuUsed(HostMetricsResponse.java:125)
at org.apache.cloudstack.metrics.MetricsServiceImpl.listHostMetrics(MetricsServiceImpl.java:284)
at org.apache.cloudstack.api.ListHostsMetricsCmd.execute(ListHostsMetricsCmd.java:50)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:156)
at com.cloud.api.ApiServer.queueCommand(ApiServer.java:764)
at com.cloud.api.ApiServer.handleRequest(ApiServer.java:588)
at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:321)
at com.cloud.api.ApiServlet$1.run(ApiServlet.java:134)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:131)
at com.cloud.api.ApiServlet.doGet(ApiServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1386)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:500)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.text.ParseException: Unparseable number: "abc"
at java.base/java.text.NumberFormat.parse(NumberFormat.java:431)
at org.apache.cloudstack.response.HostMetricsResponse.parseCPU(HostMetricsResponse.java:226)
at org.apache.cloudstack.response.HostMetricsResponse.setCpuUsed(HostMetricsResponse.java:125)
... 51 more
```
And API will fail in this case:
```
(local) 🐝 > list hostsmetrics id=fc75a8b3-263d-4231-8635-45715edea15a
🙈 Error: (HTTP 530, error code 0) Unparseable number: "abc"
```
PR description shows API output. With the change (similar to main branch), `listHostsMetrics` API won't fail when there is 0 cpu for host or locale issue and it will just report `∞%` or `NaN Ghz` as values.
Change for not showing these invalid values can considered in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-901505538
<b>Trillian test result (tid-1695)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 39989 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5329-t1695-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Smoke tests completed. 86 look OK, 1 have error(s)
Only failed tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_10_attachAndDetach_iso | `Error` | 12.45 | test_vm_life_cycle.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] nvazquez commented on a change in pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
nvazquez commented on a change in pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#discussion_r690864996
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
Review comment:
Can we add some unit tests for it?
##########
File path: plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -212,4 +216,13 @@ public void setMemoryAllocatedDisableThreshold(final Long memAllocated, final Lo
}
}
+ private Double parseCPU(String cpu) {
+ DecimalFormat decimalFormat = new DecimalFormat("#.##");
+ try {
+ return decimalFormat.parse(cpu).doubleValue();
+ } catch (ParseException e) {
+ throw new CloudRuntimeException(e);
Review comment:
What about logging the exception and handling the exception? Either here or in the usage of this function. For example, the character in the PR description can cause the API to still fail:
````
"cpuallocated": "∞%",
"cpuallocatedpercentage": "∞%",
"cpuallocatedvalue": 500,
"cpuallocatedwithoverprovisioning": "∞%",
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #5329: metrics: fix hostsmetricsresponse for zero cpu, locale
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5329:
URL: https://github.com/apache/cloudstack/pull/5329#issuecomment-900799413
<b>Trillian test result (tid-1683)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 32072 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5329-t1683-kvm-centos7.zip
Smoke tests completed. 87 look OK, 0 have error(s)
Only failed tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org