Skip to content

Add Docker-based compatibility test kit for external validation - #431

Open
glehmann wants to merge 3 commits into
masterfrom
gln/docker-compat-tests-zqyw
Open

Add Docker-based compatibility test kit for external validation#431
glehmann wants to merge 3 commits into
masterfrom
gln/docker-compat-tests-zqyw

Conversation

@glehmann

@glehmann glehmann commented Mar 13, 2026

Copy link
Copy Markdown
Member

Introduces a containerized test kit that enables external teams to easily validate xcp-ng compatibility on their own hardware without complex setup requirements.
The compat_kit module provides a straightforward, self-contained environment for running compatibility tests, lowering the barrier to entry for third-party validation.

This PR is part of a tree containing 3 PRs:

  1. master
  2. Use passlib in place of legacycrypt #396master
  3. "Add Docker-based compatibility test kit for external validation" (this PR) → Use passlib in place of legacycrypt #396
  4. Introduce TOML-based configuration to replace data.py #491Use passlib in place of legacycrypt #396

@glehmann
glehmann requested a review from a team as a code owner March 13, 2026 22:26
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch from d40d6e1 to a04eb08 Compare March 20, 2026 12:53
@glehmann
glehmann force-pushed the gln/passlib-integration-kuyq branch from 33fec9a to 54e648b Compare March 20, 2026 12:53
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch 9 times, most recently from 071af66 to d195fe7 Compare March 23, 2026 21:05
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch from d195fe7 to eebadce Compare April 7, 2026 05:44
@glehmann
glehmann force-pushed the gln/passlib-integration-kuyq branch from 54e648b to a3afb27 Compare April 7, 2026 05:44
@glehmann
glehmann force-pushed the gln/passlib-integration-kuyq branch from a3afb27 to 9daefa6 Compare April 17, 2026 09:00
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch from eebadce to 815e691 Compare April 17, 2026 09:00
@glehmann
glehmann force-pushed the gln/passlib-integration-kuyq branch from 9daefa6 to bc754e8 Compare April 17, 2026 15:03
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch 2 times, most recently from 2619b93 to 4018ea6 Compare April 21, 2026 12:47
@glehmann
glehmann requested a review from a team as a code owner April 21, 2026 12:47
@glehmann
glehmann force-pushed the gln/passlib-integration-kuyq branch from bc754e8 to 789db8a Compare April 21, 2026 12:47
@glehmann
glehmann changed the base branch from gln/passlib-integration-kuyq to gln/generic-command-results-nlwv April 21, 2026 12:47
Comment thread compat_kit/entrypoint.py Outdated
Comment thread compat_kit/entrypoint.py Outdated
@olivierh-pro
olivierh-pro requested a review from a team April 29, 2026 09:12
@glehmann
glehmann force-pushed the gln/generic-command-results-nlwv branch from c1989ab to 55de4c6 Compare May 11, 2026 15:41
Comment thread .github/workflows/docker.yml
Comment thread .github/workflows/docker.yml Outdated
contents: read
packages: write # Required to push packages to GHCR
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpicking: pining hash is a good practice, but I tent to add versions in comments then can track what should be updated (or maybe dependabot can figure this out)

Comment thread .github/workflows/docker.yml
Comment thread .github/workflows/docker.yml
Comment thread .github/workflows/docker.yml
Comment thread compat_kit/Dockerfile
curl \
git \
iputils \
netcat \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
netcat \
netcat \
make \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why make? I don't think we need it in the image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well there are a makefile helper in repo, i thought we could use it to collect tasks that can be useful for developers (like the setup steps in the docker files)

Comment thread compat_kit/entrypoint.py
Comment thread compat_kit/entrypoint.py
Comment thread compat_kit/entrypoint.py Outdated
if num_hosts != 1:
raise ValueError(
f"Pool constraint violated: Master host's pool contains {num_hosts} host(s), "
f"but only 1 host was provided. The pool must contain only the specified hosts. "

@rzr rzr Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
f"but only 1 host was provided. The pool must contain only the specified hosts. "
f"but only 1 host was provided. The pool must contain only the specified host. "

unclear to me, is it "only one host expected in pool" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The pool must contain only the hosts provided by the user, or the script would fail.
I'll try to reformulate

Comment thread compat_kit/entrypoint.py Outdated
if num_hosts != 1:
raise ValueError(
f"Pool constraint violated: Master host's pool contains {num_hosts} host(s), "
f"but only the master host should be present before joining the second host. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
f"but only the master host should be present before joining the second host. "
f"but only the master host should be present before the second host is joining the pool. "

Comment thread compat_kit/entrypoint.py
sys.stdout.buffer.write(line)
sys.stdout.buffer.flush()

# 2. Strip the codes and write the clean text to the file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: Wouldn't it be better to make color output optional in the first place ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For what use case?

Comment thread compat_kit/entrypoint.py
run_pytest(2, test_args, "test_kit_2.log")


def set_hvm_fep(enabled: bool) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would set default to True

Comment thread compat_kit/entrypoint.py
logging.warning(f"Failed to disable hvm_fep and reboot: {e}")


def print_summary() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: would add default param to make colors/utf-8 optional

Comment thread compat_kit/entrypoint.py Outdated
Comment on lines +607 to +610
sys.exit(1)
except Exception as e:
logging.error(f"Error: {e}", exc_info=True)
sys.exit(1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would use a different exit code

Comment thread compat_kit/entrypoint.py

def main() -> None:
"""Parse arguments and run the compatibility test kit."""
default_vm_url = "https://nextcloud.vates.tech/index.php/s/MmEjo8qYo7Ccs2B/download"

@rzr rzr Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it public ? if not this has to be changed to something stable over time. or it has to be generated on the fly (With a script? ie vagrant?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes it is. I agree we should use something stable—ideally on the same GH repository—but we don't have it yet

Comment thread compat_kit/entrypoint.py Outdated
parser.add_argument('--master-host', help="IP or hostname of the pool master")
parser.add_argument("--second-host", help="IP or hostname of the second host (optional, for pool tests)")
parser.add_argument("--password", help="SSH root password (if not provided, will be prompted)")
parser.add_argument("--log-dir", default="/app/logs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would rather use a relative path (in HOME?) to allow out of docker use.

Comment thread compat_kit/id_ed25519
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----

@rzr rzr Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we put this in a secret ? maybe not if images have to be shared, I would generate it on the fly (like vm?) if possible, or add a comment that/why it is intentional and there is no security impact

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This must match the key in the VM image. I would prefer to generate it on the fly, but I don't think we have a way to start a VM and specify an authorized ssh key for now, as we would with cloudinit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yea i figured this out, I would just add a comment with a reference to the image (and explicitly state it's not secure) file can be also renamed with unsecure suffix.

Comment thread compat_kit/README.md Outdated
Comment thread compat_kit/README.md

## Security Notes

The test VM is configured with a known access key and is **strictly reserved for testing purposes only**.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
The test VM is configured with a known access key and is **strictly reserved for testing purposes only**.
The test VM is configured with a known access key and is **strictly reserved for testing purposes only**.
Test VM should not be exposed to untrusted networks.

@rzr rzr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, I work prefer that we have a re-producible vm instead of a fixed asset. Has this been considered ? there is a risk it could be blocked in user's infra.

@glehmann

Copy link
Copy Markdown
Member Author

lgtm, I work prefer that we have a re-producible vm instead of a fixed asset. Has this been considered ? there is a risk it could be blocked in user's infra.

It's been considered, but not done yet, as it's a significant increase in complexity

@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch from 8d6a533 to 519e972 Compare July 10, 2026 11:55
@glehmann
glehmann requested a review from rzr July 10, 2026 11:58
Introduces a containerized test kit that enables external teams to
easily validate xcp-ng compatibility on their own hardware without
complex setup requirements.
The compat_kit module provides a straightforward, self-contained
environment for running compatibility tests, lowering the barrier to
entry for third-party validation.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
When importing a VM from an HTTPS URL, xe vm-import fails because it
doesn't properly support HTTPS URLs. This change downloads the image to a
temporary file on the host before importing it.

HTTP URLs remain unchanged and continue to use the url= parameter directly,
avoiding unnecessary local storage of potentially large images.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
@glehmann
glehmann force-pushed the gln/docker-compat-tests-zqyw branch from 519e972 to 04d74e1 Compare August 18, 2026 09:50
Comment thread compat_kit/id_ed25519
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
-----BEGIN OPENSSH PRIVATE KEY-----
This key is unsecure, it should be only used to connect to prebuild-demo vm images.
-----BEGIN OPENSSH PRIVATE KEY-----

@rzr rzr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please consider the key comment (we never know) we could create a issue for removal or this key when a better solution is in place.

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.

6 participants