-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow deploy of VRs on dedicated resources #9531
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
Open
GaOrtiga
wants to merge
6
commits into
apache:main
Choose a base branch
from
scclouds:deploy_vr_dedicated_resources
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9e19ab3
allow deploy of VRs on dedicated resources
GaOrtiga 42c5625
Move configuration to Planner hierarchy
e2197f0
allow deploy when resource is dedicated to account
GaOrtiga 8b20abe
fix tests
GaOrtiga e35c299
Update engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao…
GaOrtiga 1bdb771
Update engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDao…
GaOrtiga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,13 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | |
| "LEFT JOIN dedicated_resources dr_cluster ON dr_cluster.cluster_id IS NOT NULL AND dr_cluster.cluster_id = host.cluster_id " + | ||
| "LEFT JOIN dedicated_resources dr_host ON dr_host.host_id IS NOT NULL AND dr_host.host_id = host.id "; | ||
|
|
||
| private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_INCLUDE_DEDICATED_JOIN_CLAUSE = | ||
| "JOIN host ON capacity.host_id = host.id " + | ||
| "LEFT JOIN (SELECT affinity_group.id, agvm.instance_id FROM affinity_group_vm_map agvm JOIN affinity_group ON agvm.affinity_group_id = affinity_group.id AND affinity_group.type='ExplicitDedication') AS ag ON ag.instance_id = ? " + | ||
| "LEFT JOIN dedicated_resources dr_pod ON dr_pod.pod_id IS NOT NULL AND dr_pod.pod_id = host.pod_id AND dr_pod.account_id IS NOT NULL AND dr_pod.account_id != ownerId " + | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about resources dedicated to domain ? |
||
| "LEFT JOIN dedicated_resources dr_cluster ON dr_cluster.cluster_id IS NOT NULL AND dr_cluster.cluster_id = host.cluster_id AND dr_cluster.account_id IS NOT NULL AND dr_cluster.account_id != ownerId " + | ||
| "LEFT JOIN dedicated_resources dr_host ON dr_host.host_id IS NOT NULL AND dr_host.host_id = host.id AND dr_host.account_id IS NOT NULL AND dr_host.account_id != ownerId "; | ||
|
|
||
| private static final String ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_JOIN_2 = | ||
| " AND ((ag.id IS NULL AND dr_pod.pod_id IS NULL AND dr_cluster.cluster_id IS NULL AND dr_host.host_id IS NULL) OR " + | ||
| "(dr_pod.affinity_group_id = ag.id OR dr_cluster.affinity_group_id = ag.id OR dr_host.affinity_group_id = ag.id))"; | ||
|
|
@@ -986,7 +993,7 @@ public boolean removeBy(Short capacityType, Long zoneId, Long podId, Long cluste | |
| } | ||
|
|
||
| @Override | ||
| public Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, long vmId, short capacityTypeForOrdering, boolean isZone) { | ||
| public Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, long vmId, Long ownerId, short capacityTypeForOrdering, boolean isVr, boolean allowRoutersOnDedicatedResources, boolean isZone) { | ||
| TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||
| PreparedStatement pstmt = null; | ||
| List<Long> result = new ArrayList<Long>(); | ||
|
|
@@ -998,7 +1005,12 @@ public Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long | |
| sql.append(ORDER_CLUSTERS_BY_AGGREGATE_OVERCOMMIT_CAPACITY_PART1); | ||
| } | ||
|
|
||
| sql.append(ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_JOIN_1); | ||
| if (isVr && allowRoutersOnDedicatedResources) { | ||
| sql.append(ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_INCLUDE_DEDICATED_JOIN_CLAUSE.replace("ownerId", ownerId.toString())); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not elegant I think |
||
| } else { | ||
| sql.append(ORDER_CLUSTERS_BY_AGGREGATE_CAPACITY_JOIN_1); | ||
| } | ||
|
|
||
| if (isZone) { | ||
| sql.append("WHERE capacity.capacity_state = 'Enabled' AND capacity.data_center_id = ?"); | ||
| } else { | ||
|
|
@@ -1290,5 +1302,4 @@ public float findClusterConsumption(Long clusterId, short capacityType, long com | |
| } | ||
| return 0; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this may be not required.
in my opinion, the VR should always be allowed to deploy on resource dedicated to the owner of the VR