weizhouapache commented on issue #3838: CS 4.11.2+ SSVM bug when scanning templates URL: https://github.com/apache/cloudstack/issues/3838#issuecomment-578810479 @bwsw my proposal is ``` diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java index bd5c591..14e5ae7 100644 --- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java +++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/template/DownloadManagerImpl.java @@ -812,6 +812,10 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager script.add("-r", rootdir); ZfsPathParser zpp = new ZfsPathParser(rootdir); script.execute(zpp); + if (script.getExitValue() != 0) { + s_logger.error("Error while executing script " + script.toString()); + throw new CloudRuntimeException("Error while executing script " + script.toString()); + } result.addAll(zpp.getPaths()); s_logger.info("found " + zpp.getPaths().size() + " volumes" + zpp.getPaths()); return result; @@ -824,6 +828,10 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager script.add("-r", rootdir); ZfsPathParser zpp = new ZfsPathParser(rootdir); script.execute(zpp); + if (script.getExitValue() != 0) { + s_logger.error("Error while executing script " + script.toString()); + throw new CloudRuntimeException("Error while executing script " + script.toString()); + } result.addAll(zpp.getPaths()); s_logger.info("found " + zpp.getPaths().size() + " templates" + zpp.getPaths()); return result; ``` I got the following errors in /var/log/cloud.log, which looks ok (there is not ListTemplatesAnswer sent to mgt server). ``` 2020-01-27 13:17:35,031 DEBUG [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Executing: /usr/local/cloud/systemvm/scripts/storage/secondary/listvmtmplt.sh -r /mnt/SecStorage/485ccf0d-3724-3575-a65e-318913593f8e/template/tmpl/ 2020-01-27 13:17:35,039 DEBUG [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Executing while with timeout : 3600000 2020-01-27 13:17:39,293 DEBUG [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Exit value is 143 2020-01-27 13:17:39,355 WARN [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Exception: /usr/local/cloud/systemvm/scripts/storage/secondary/listvmtmplt.sh -r /mnt/SecStorage/485ccf0d-3724-3575-a65e-318913593f8e/template/tmpl/ java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170) ...... 2020-01-27 13:17:39,621 INFO [cloud.agent.Agent] (AgentShutdownThread:null) Stopping the agent: Reason = sig.kill 2020-01-27 13:17:39,634 ERROR [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Exit value bbb is 143 2020-01-27 13:17:39,636 ERROR [storage.template.DownloadManagerImpl] (agentRequest-Handler-3:null) Error while executing script /usr/local/cloud/systemvm/scripts/storage/secondary/listvmtmplt.sh -r /mnt/SecStorage/485ccf0d-3724-3575-a65e-318913593f8e/template/tmpl/ 2020-01-27 13:17:39,646 WARN [cloud.agent.Agent] (agentRequest-Handler-3:null) Caught: com.cloud.utils.exception.CloudRuntimeException: Error while executing script /usr/local/cloud/systemvm/scripts/storage/secondary/listvmtmplt.sh -r /mnt/SecStorage/485ccf0d-3724-3575-a65e-318913593f8e/template/tmpl/ at org.apache.cloudstack.storage.template.DownloadManagerImpl.listTemplates(DownloadManagerImpl.java:835) at org.apache.cloudstack.storage.template.DownloadManagerImpl.gatherTemplateInfo(DownloadManagerImpl.java:851) at org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.execute(NfsSecondaryStorageResource.java:2052) at org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.executeRequest(NfsSecondaryStorageResource.java:306) ...... 2020-01-27 13:17:39,649 DEBUG [cloud.agent.Agent] (AgentShutdownThread:null) Sending shutdown to management server 2020-01-27 13:17:39,668 DEBUG [cloud.agent.Agent] (agentRequest-Handler-3:null) Seq 7-1084804560242868231: { Ans: , MgmtId: 6694243406180, via: 7, Ver: v1, Flags: 110, [{"com.cloud.agent.api.Answer":{"result":false,"details":"com.cloud.utils.exception.CloudRuntimeException: Error while executing script /usr/local/cloud/systemvm/scripts/storage/secondary/listvmtmplt.sh -r /mnt/SecStorage/485ccf0d-3724-3575-a65e-318913593f8e/template/tmpl/ \n\tat org.apache.cloudstack.storage.template.DownloadManagerImpl.listTemplates(DownloadManagerImpl.java:835)\n\tat org.apache.cloudstack.storage.template.DownloadManagerImpl.gatherTemplateInfo(DownloadManagerImpl.java:851)\n\tat org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.execute(NfsSecondaryStorageResource.java:2052)\n\tat org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.executeRequest(NfsSecondaryStorageResource.java:306)\n\tat com.cloud.agent.Agent.processRequest(Agent.java:640)\n\tat com.cloud.agent.Agent$AgentRequestHandler.doTask(Agent.java:1053)\n\tat com.cloud.utils.nio.Task.call(Task.java:83)\n\tat com.cloud.utils.nio.Task.call(Task.java:29)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n","wait":0}}] } 2020-01-27 13:17:39,693 DEBUG [utils.nio.NioConnection] (Agent-NioConnectionHandler-1:null) Location 1: Socket Socket[addr=/10.11.118.40,port=8250,localport=60900] closed on read. Probably -1 returned: Connection closed with -1 on reading size. 2020-01-27 13:17:39,741 DEBUG [utils.nio.NioConnection] (Agent-NioConnectionHandler-1:null) Closing socket Socket[addr=/10.11.118.40,port=8250,localport=60900] ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
