Skip to content
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

CP-51988: Fix functions not work for remote_pool repo #6095

Open
wants to merge 2 commits into
base: feature/easier-pool-join
Choose a base branch
from

Conversation

BengangY
Copy link
Contributor

@BengangY BengangY commented Oct 30, 2024

  1. remote_pool repo doesn't support periodic sync updates.
  2. Periodic sync updates should be auto-disabled when calling set_repositories and add_repository for remote_pool repo.
  3. Update UT.

@BengangY BengangY marked this pull request as ready for review October 30, 2024 09:46
ocaml/xapi/xapi_pool.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_errors.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_errors.ml Outdated Show resolved Hide resolved
ocaml/xapi/xapi_pool.ml Outdated Show resolved Hide resolved
ocaml/idl/datamodel_errors.ml Outdated Show resolved Hide resolved
@xueqingz
Copy link
Contributor

xueqingz commented Nov 4, 2024

Java SDK build failed on:

    /**
     * If the bundle repository or remote_pool repository is enabled, it should be the only one enabled repository of the pool.
     */
    public static class RepoShouldBeSingleEnabled extends XenAPIException {
        public final String repo-type;

        /**
         * Create a new RepoShouldBeSingleEnabled
         */
        public RepoShouldBeSingleEnabled(String repo-type) {
            super("If the bundle repository or remote_pool repository is enabled, it should be the only one enabled repository of the pool.");
            this.repo-type = repo-type;
        }
    }

Consider change the name "repo-type" to "repo_type" ?

ocaml/idl/datamodel_errors.ml Outdated Show resolved Hide resolved
@BengangY
Copy link
Contributor Author

BengangY commented Nov 4, 2024

Java SDK build failed on:

    /**
     * If the bundle repository or remote_pool repository is enabled, it should be the only one enabled repository of the pool.
     */
    public static class RepoShouldBeSingleEnabled extends XenAPIException {
        public final String repo-type;

        /**
         * Create a new RepoShouldBeSingleEnabled
         */
        public RepoShouldBeSingleEnabled(String repo-type) {
            super("If the bundle repository or remote_pool repository is enabled, it should be the only one enabled repository of the pool.");
            this.repo-type = repo-type;
        }
    }

Consider change the name "repo-type" to "repo_type" ?

Updated to "repo_type" and it passed now.

@BengangY BengangY requested a review from lindig November 4, 2024 13:19
add_error "BUNDLE_REPO_SHOULD_BE_SINGLE_ENABLED"
let can_not_periodic_sync_updates = add_error "CAN_NOT_PERIODIC_SYNC_UPDATES"

let repo_should_be_single_enabled = add_error "REPO_SHOULD_BE_SINGLE_ENABLED"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording is a bit odd. Does this mean that only one repo should be enabled? "repo should be single enabled" is not grammatical and ambiguous. "repo should be the single one enabled" could be something I would guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that only one repo should be enabled?
If the bundle repository or remote_pool repository is enabled, it should be the only one enabled repository of the pool. Or else, multiple repos (only remote) can be enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe MULTIPLE_REPOS_ENABLED as an error is clear? It implies that only one should be enabled.

Copy link
Contributor Author

@BengangY BengangY Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe MULTIPLE_REPOS_ENABLED as an error is clear? It implies that only one should be enabled.

It sounds better. But there is another similar error multiple_update_repositories_enabled.

Copy link
Contributor

@gangj gangj Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree renaming it to repo_should_be_the_single_one_enabled would be clearer.

( repo_should_be_single_enabled
, [
Record_util.repo_origin_to_string `bundle
; Record_util.repo_origin_to_string `remote_pool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No remote_pool type of repo is set here

Server_error
( repo_should_be_single_enabled
, [
Record_util.repo_origin_to_string `bundle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No bundle type of repo is set here.

( repo_should_be_single_enabled
, [
Record_util.repo_origin_to_string `bundle
; Record_util.repo_origin_to_string `remote_pool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No remote_pool type of repo is set.

Server_error
( repo_should_be_single_enabled
, [
Record_util.repo_origin_to_string `bundle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No bundle type of repo is set

1. `remote_pool` repo doesn't support periodic sync updates.
2. Periodic sync updates should be auto-disabled when calling `set_repositories`
   and `add_repository` for `remote_pool` repo.
3. If `remote_pool` repository is enabled, it should be the single one
   enabled.

Signed-off-by: Bengang Yuan <[email protected]>
@@ -551,3 +551,11 @@ let vm_placement_policy_of_string a =
`anti_affinity
| s ->
record_failure "Invalid VM placement policy, got %s" s

let repo_origin_to_string = function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this and we can rely on the auto-generated function now. See the comment on top of this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants