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/09/28 11:57:25 UTC

[GitHub] [cloudstack] weizhouapache opened a new pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

weizhouapache opened a new pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521


   ### Description
   
   This PR fixes an issue in #4399 
   
   Steps to reproduce the issue
   (1) create service offering with multiple host tags (2 or more)
   (2) create a vm with the service offering
   
   expected result
   vm is started or 
   get error message "No suitable host found for follow compute offering tags: tag1,tag2"
   
   actual result:
   Got exception
   ```
   com.cloud.utils.exception.CloudRuntimeException: DB Exception on: select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?
   ```
   
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ********************************************************************************* -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ********************************************************************************* -->
   
   ### 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
   - [x] 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] blueorangutan commented on pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929392484






-- 
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 #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929410337


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


-- 
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 a change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718141856



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       Should `%s` be replaced with `? `




-- 
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 #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929392484


   @nvazquez 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] nvazquez commented on pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929552128


   @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] weizhouapache commented on a change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718188225



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       > Should `%s` be replaced with `? `
   
   @rhtyd 
   see suresh's comment above.
   
   https://github.com/apache/cloudstack/blob/fccd02b6ced1ebe88a7bfd606297f339e119d5c5/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java#L1208-L1213
   
   an example of final sql is (if there are 3 tags)
   ```
   select distinct cluster_id from host join 
   ( SELECT filtered.host_id, COUNT(filtered.tag) AS tag_count FROM (SELECT host_id, tag FROM host_tags GROUP BY host_id,tag) AS filtered WHERE tag IN(?,?,?) GROUP BY host_id HAVING tag_count = 3  ) AS selected_hosts 
   ON host.id = selected_hosts.host_id;
   ```




-- 
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 a change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718141856



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       Should `%s` be replaced with `? `




-- 
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 change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718188225



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       > Should `%s` be replaced with `? `
   
   @rhtyd 
   see suresh's comment above.
   
   https://github.com/apache/cloudstack/blob/fccd02b6ced1ebe88a7bfd606297f339e119d5c5/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java#L1208-L1213
   
   an example of final sql is (if there are 3 tags)
   ```
   select distinct cluster_id from host join 
   ( SELECT filtered.host_id, COUNT(filtered.tag) AS tag_count FROM (SELECT host_id, tag FROM host_tags GROUP BY host_id,tag) AS filtered WHERE tag IN(?,?,?) GROUP BY host_id HAVING tag_count = 3  ) AS selected_hosts 
   ON host.id = selected_hosts.host_id;
   ```




-- 
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 pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929751979


   Ping for review @sureshanaparti @davidjumani @rhtyd 


-- 
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 pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929392094






-- 
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] sureshanaparti commented on a change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718154216



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       @rhtyd It seems, all the tags are part of the sub-query stmt "_LIST_HOST_IDS_BY_COMPUTETAGS_" and the returned hosts from that sub-query were considered from further filtering.




-- 
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 pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929751979


   Ping for review @sureshanaparti @davidjumani @rhtyd 


-- 
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 merged pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521


   


-- 
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] sureshanaparti commented on a change in pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#discussion_r718154216



##########
File path: engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
##########
@@ -85,7 +85,7 @@
                                                              + "GROUP BY host_id "
                                                              + "HAVING tag_count = %s ";
     private static final String SEPARATOR = ",";
-    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";
+    private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join ( %s ) AS selected_hosts ON host.id = selected_hosts.host_id";

Review comment:
       @rhtyd It seems, all the tags are part of the sub-query stmt "_LIST_HOST_IDS_BY_COMPUTETAGS_" and the returned hosts from that sub-query were considered from further filtering.




-- 
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 #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929822425


   <b>Trillian test result (tid-2229)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 31149 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5521-t2229-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have errors
   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



[GitHub] [cloudstack] blueorangutan commented on pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929822425


   <b>Trillian test result (tid-2229)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 31149 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5521-t2229-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have errors
   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



[GitHub] [cloudstack] nvazquez commented on pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929392094


   @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] blueorangutan commented on pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521#issuecomment-929553580


   @nvazquez 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 merged pull request #5521: server: cannot deploy/start vm if service offering has multiple tags

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #5521:
URL: https://github.com/apache/cloudstack/pull/5521


   


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