fix(storage pool): rely on operation when api extension is present#1899
Draft
kimanhou wants to merge 1 commit intocanonical:mainfrom
Draft
fix(storage pool): rely on operation when api extension is present#1899kimanhou wants to merge 1 commit intocanonical:mainfrom
kimanhou wants to merge 1 commit intocanonical:mainfrom
Conversation
0586491 to
c69fad4
Compare
edlerd
reviewed
Mar 25, 2026
Comment on lines
151
to
178
| export const createClusteredPool = async ( | ||
| pool: LxdStoragePool, | ||
| clusterMembers: LxdClusterMember[], | ||
| sourcePerClusterMember?: ClusterSpecificValues, | ||
| zfsPoolNamePerClusterMember?: ClusterSpecificValues, | ||
| sizePerClusterMember?: ClusterSpecificValues, | ||
| ): Promise<void> => { | ||
| ): Promise<LxdOperationResponse> => { | ||
| const { memberPoolPayload, clusterPoolPayload } = | ||
| getClusterAndMemberPoolPayload(pool); | ||
| return Promise.allSettled( | ||
| clusterMembers.map(async (item) => { | ||
| const clusteredMemberPool = { | ||
| ...memberPoolPayload, | ||
| config: { | ||
| ...memberPoolPayload.config, | ||
| source: sourcePerClusterMember?.[item.server_name], | ||
| size: sizePerClusterMember?.[item.server_name], | ||
| "zfs.pool_name": zfsPoolNamePerClusterMember?.[item.server_name], | ||
| }, | ||
| }; | ||
| return createPool(clusteredMemberPool, item.server_name); | ||
| }), | ||
| ) | ||
| .then(handleSettledResult) | ||
| .then(async () => { | ||
| return createPool(clusterPoolPayload); | ||
| }); | ||
| }; |
Collaborator
There was a problem hiding this comment.
I think this is way harder with the extension. Because we have to wait until all operations of the cluster member pools are finished before we do the createPool(clusterPoolPayload) call.
So the createPool(clusterPoolPayload) call has to await all operations for each cluster member to finish.
Contributor
Author
There was a problem hiding this comment.
I implemented a new waitForOperation function that polls /1.0/operations/{id} endpoint and then the final API call once all operations are in success status.
c69fad4 to
e43bd5a
Compare
Signed-off-by: Kim Anh Nguyen <4783194+kimanhou@users.noreply.github.com>
e43bd5a to
1a96687
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Done
storage_and_network_operationsis presentcreatePool,updatePool,updateClusteredPool,renameStoragePoolanddeleteStoragePool.Follow up of canonical/lxd#17955
QA
Screenshots