-
Notifications
You must be signed in to change notification settings - Fork 1.3k
server: cannot deploy/start vm if service offering has multiple tags #5521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 1426 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
nvazquez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Manually verified
|
Ping for review @sureshanaparti @davidjumani @rhtyd |
|
Trillian test result (tid-2229)
|
| + "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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should %s be replaced with ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
%sbe replaced with?
@rhtyd
see suresh's comment above.
cloudstack/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
Lines 1208 to 1213 in fccd02b
| String sql = this.LIST_CLUSTERID_FOR_HOST_TAG; | |
| PreparedStatement pstmt = null; | |
| List<Long> result = new ArrayList(); | |
| List<String> tags = Arrays.asList(computeOfferingTags.split(this.SEPARATOR)); | |
| String subselect = getHostIdsByComputeTags(tags); | |
| sql = String.format(sql, subselect); |
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;
sureshanaparti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?