You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "shwstppr (via GitHub)" <gi...@apache.org> on 2023/05/01 12:31:55 UTC

[GitHub] [cloudstack] shwstppr opened a new pull request, #7485: engine-storage: fix errored template becomes active

shwstppr opened a new pull request, #7485:
URL: https://github.com/apache/cloudstack/pull/7485

   ### Description
   
   Fixes #7342
   
   ### 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
   - [ ] 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] weizhouapache commented on pull request #7485: engine-storage: fix errored template becomes active

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1545418017

   > @weizhouapache it is probably taking the created date from `template_store_ref`. Will check and address separately
   
   great, thanks @shwstppr 
   
   if @Pearl1594 is ok with this PR, we can merge it.


-- 
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 a diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1187798269


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {

Review Comment:
   it seems I misunderstood the code :-D
   
   is there a scenario that template download is skipped but it is expected behaviour ? direct download ?



-- 
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 merged pull request #7485: engine-storage: fix errored template becomes active

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache merged PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485


-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1545399790

   @weizhouapache it is probably taking the created date from `template_store_ref`. Will check and address separately


-- 
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 diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1187264956


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {

Review Comment:
   @weizhouapache no.
   Server won't skip download if any of the following condition is true:
   - Template is public
   - Template is featured
   - Template belongs to system
   - Template is marked for the zone but not present in any of the zone secondary store
   
   Depending upon download status template status will be set later



-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1545265566

   > @Pearl1594 @weizhouapache are you guys okay to proceed with this?
   
   @shwstppr 
   I will verify it


-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529709221

   @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] rohityadavcloud commented on a diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1187097668


##########
engine/storage/image/src/test/java/org/apache/cloudstack/storage/image/TemplateServiceImplTest.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image;
+
+import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.Storage;
+import com.cloud.storage.VMTemplateVO;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TemplateServiceImplTest {

Review Comment:
   Excellent to see tests @shwstppr !



-- 
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] Pearl1594 commented on a diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "Pearl1594 (via GitHub)" <gi...@apache.org>.
Pearl1594 commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1187752376


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {
+            return false;
+        }
+        if (template.isFeatured()) {
+            return false;
+        }
+        if (TemplateType.SYSTEM.equals(template.getTemplateType())) {
+            return false;
+        }
+        if (zoneId != null &&  _vmTemplateStoreDao.findByTemplateZone(template.getId(), zoneId, DataStoreRole.Image) == null) {
+            s_logger.debug(String.format("Template %s is not present on any image store for the zone ID: %d, its download cannot be skipped", template.getUniqueName(), zoneId));

Review Comment:
   what if it is a direct download template? 



-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529831978

   @shwstppr 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] blueorangutan commented on pull request #7485: engine-storage: fix errored template becomes active

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529710563

   @shwstppr a Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. 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 #7485: engine-storage: fix errored template becomes active

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529776964

   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 6007


-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1530796856

   <b>Trillian test result (tid-6493)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39939 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7485-t6493-kvm-centos7.zip
   Smoke tests completed. 108 look OK, 0 have errors, 0 did not run
   Only failed and skipped 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


[GitHub] [cloudstack] shwstppr commented on pull request #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1545247677

   @Pearl1594 @weizhouapache are you guys okay to proceed with this?


-- 
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 a diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1187234971


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {

Review Comment:
   @shwstppr 
   if an error template is public or featured, will it become Active ?



-- 
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] sonarcloud[bot] commented on pull request #7485: engine-storage: fix errored template becomes active

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529741266

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=7485)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=7485&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=7485&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=7485&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=7485&resolved=false&types=CODE_SMELL)
   
   [![56.9%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/50-16px.png '56.9%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=7485&metric=new_coverage&view=list) [56.9% Coverage](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=7485&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=7485&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=7485&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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 #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#issuecomment-1529831487

   @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] shwstppr commented on a diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1188101474


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {
+            return false;
+        }
+        if (template.isFeatured()) {
+            return false;
+        }
+        if (TemplateType.SYSTEM.equals(template.getTemplateType())) {
+            return false;
+        }
+        if (zoneId != null &&  _vmTemplateStoreDao.findByTemplateZone(template.getId(), zoneId, DataStoreRole.Image) == null) {
+            s_logger.debug(String.format("Template %s is not present on any image store for the zone ID: %d, its download cannot be skipped", template.getUniqueName(), zoneId));

Review Comment:
   Direct-download templates are skipped (already) at line 496



-- 
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 diff in pull request #7485: engine-storage: fix errored template becomes active

Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #7485:
URL: https://github.com/apache/cloudstack/pull/7485#discussion_r1188101575


##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/TemplateServiceImpl.java:
##########
@@ -286,6 +286,23 @@ public void handleSysTemplateDownload(HypervisorType hostHyper, Long dcId) {
         }
     }
 
+    protected boolean isSkipTemplateStoreDownload(VMTemplateVO template, Long zoneId) {
+        if (template.isPublicTemplate()) {

Review Comment:
   Direct-download templates are skipped (already) at line 496



-- 
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