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

ci: add a qemu/arm64 VM to GH workflows #515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rchincha
Copy link
Contributor

What type of PR is this?

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #515 (0a085ef) into main (0cbd6f6) will increase coverage by 1.87%.
Report is 5 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #515      +/-   ##
==========================================
+ Coverage   11.89%   13.77%   +1.87%     
==========================================
  Files          40       40              
  Lines        5733     5671      -62     
==========================================
+ Hits          682      781      +99     
+ Misses       4929     4762     -167     
- Partials      122      128       +6     

see 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

cp /usr/share/AAVMF/AAVMF_CODE.fd .
cp /usr/share/AAVMF/AAVMF_VARS.fd .

randmac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//')
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we randomly assigning a MAC? qemu will auto allocate one for you (it is already well known and we don't really care).

-display none \
-drive if=pflash,format=raw,readonly=on,file=AAVMF_CODE.fd \
-drive if=pflash,format=raw,file=AAVMF_VARS.fd \
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0 \
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0,cache=unsafe \

No need to use sync writes since we just read data out of the VM

Comment on lines 50 to 49
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0 \
-drive file=user-data.img,format=raw \
-device virtio-blk-device,drive=hd0 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0 \
-drive file=user-data.img,format=raw \
-device virtio-blk-device,drive=hd0 \
-drive if=none,file=jammy-server-cloudimg-arm64.img,id=hd0,cache=unsafe \
-device virtio-blk-device,drive=hd0 \
-drive file=user-data.img,format=raw,media=cdrom,id=cd0 \
-device virtio-blk-device,drive=cd0 \

I think you're missing a -device to map the cdrom drive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Formatting 'jammy-snapshot.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=214748364800 backing_file=jammy-server-cloudimg-arm64.img backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16
qemu-system-aarch64: -drive file=user-data.img,format=raw,media=cdrom,id=cd0: Drive 'cd0' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?)
Error: Process completed with exit code 1.

-drive file=user-data.img,format=raw \
-device virtio-blk-device,drive=hd0 \
-netdev type=user,id=net0,hostfwd=tcp::22225-:22 \
-device virtio-net-device,netdev=net0,mac=$randmac \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-device virtio-net-device,netdev=net0,mac=$randmac \
-device virtio-net-device,netdev=net0 \

qemu will autogenerate a mac

jobs:
build-linux-arm64:
runs-on: ubuntu-22.04
steps:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if we can use the githubToken thing to save the state of the image after we do all of the steps to prep for running the VM?

# speeds up builds by storing container images in a GitHub package registry.
githubToken: ${{ github.token }}     

Wasn't sure if that's only used in that run-on-arch-action

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specific to that action iinm

@rchincha
Copy link
Contributor Author

rchincha commented Oct 4, 2023

debug1: Exit status 0

real 4m9.407s
user 0m0.080s
sys 0m0.089s

On my local machine, it takes about 4mins to make a successful connection to qemu VM.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
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.

2 participants