-
Notifications
You must be signed in to change notification settings - Fork 357
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
base: main
Are you sure you want to change the base?
Conversation
@@ -22,6 +22,9 @@ PROJECT_DIR = os.path.dirname( | |||
) | |||
) | |||
|
|||
# Virtual disk location | |||
VIRT_DISK = os.path.join(PROJECT_DIR, "tmp_virt_disk.qcow2") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to what @M4rtinK says. We do the same in web ui tests.
https://github.com/rhinstaller/anaconda-webui/blob/main/test/anacondalib.py#L130
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
ea2645e
to
80e8afe
Compare
@@ -22,6 +22,9 @@ PROJECT_DIR = os.path.dirname( | |||
) | |||
) | |||
|
|||
# Virtual disk location | |||
VIRT_DISK = os.path.join(PROJECT_DIR, "tmp_virt_disk.qcow2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to what @M4rtinK says. We do the same in web ui tests.
https://github.com/rhinstaller/anaconda-webui/blob/main/test/anacondalib.py#L130
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.