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

Utils: Update testing scripts #6038

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

Conversation

elkoniu
Copy link
Contributor

@elkoniu elkoniu commented Dec 8, 2024

Testing script 'update_iso' is using virt-install to test the built ISO. With every run virt-install will create new virtual drive in ~/.local/share/libvirt/images. With 20G size of each it may lead to filling up host HDD pretty fast.

This commit configures virt-install to reuse the same disk image located in the main project directory. This way it saves the space and makes it easy to remove if needed.

@elkoniu elkoniu requested a review from M4rtinK December 8, 2024 20:21
@github-actions github-actions bot added the f42 Fedora 42 label Dec 8, 2024
@@ -22,6 +22,9 @@ PROJECT_DIR = os.path.dirname(
)
)

# Virtual disk location
VIRT_DISK = os.path.join(PROJECT_DIR, "tmp_virt_disk.qcow2")
Copy link
Contributor

Choose a reason for hiding this comment

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

This would put the image in the root of the git repo, gitignore does not contain it, so it would be problematic for people who do git add -u

Should not the disk just be removed when the VM is deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my cases it was not removed. Also we are using qemu:///session domain so the disc images will be nested in ~/.local/share/libvirt/images which is not an obvious location.

I will update gitignore to include qcow2 files.

Copy link
Contributor

Choose a reason for hiding this comment

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

how did you delete the VM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was using ./scripts/testing/update_iso -b inst.sshd -k ../ks.cfg -v which at the ends call virt-install with the newly created ISO image.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could also maybe use the python tempfile functionality to get a directory that will end up deleted once the virt-install call terminates ?

https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory

That should create the disk image in hopefully appropriate temporary location & then delete the image.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Just beware, it will be default create the dir in /tmp that could be tricky if you don't have enough RAM.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, but it should be possible to change the dir where tempfile creates this to /var/tmp (located on normal storage) to be sure. :) Also nice we are already using this elsewhere. :)

Testing script 'update_iso' is using virt-install to test the built ISO.
With every run virt-install will create new virtual drive in
~/.local/share/libvirt/images. With 20G size of each it may lead to
filling up host HDD pretty fast.

This commit configures virt-install to reuse the same disk image
located in the main project directory. This way it saves the space
and makes it easy to remove if needed.
@elkoniu elkoniu force-pushed the update-virt-runtime-options branch from ea2645e to 80e8afe Compare December 9, 2024 09:04
@@ -22,6 +22,9 @@ PROJECT_DIR = os.path.dirname(
)
)

# Virtual disk location
VIRT_DISK = os.path.join(PROJECT_DIR, "tmp_virt_disk.qcow2")
Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f42 Fedora 42
Development

Successfully merging this pull request may close these issues.

4 participants