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

virtual_disk: add new cases for starting guest with multiple driver attributes #5621

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

Conversation

meinaLi
Copy link
Contributor

@meinaLi meinaLi commented May 18, 2024

These two cases are to match the cnv scenarios: VIRT-300872 and VIRT-300727.

@meinaLi
Copy link
Contributor Author

meinaLi commented May 18, 2024

# avocado run --vt-type libvirt --test-runner=runner --vt-machine-type q35 virtual_disks.multiattributes
JOB ID     : e7fd21fb50277dbf4da607f0472388b6854388a3
JOB LOG    : /var/lib/avocado/job-results/job-2024-05-18T04.36-e7fd21f/job.log
 (1/2) type_specific.io-github-autotest-libvirt.virtual_disks.multiattributes.file_disk.start_guest: PASS (93.82 s)
 (2/2) type_specific.io-github-autotest-libvirt.virtual_disks.multiattributes.block_disk.start_guest: PASS (292.22 s)
RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2024-05-18T04.36-e7fd21f/results.html
JOB TIME   : 388.12 s

@meinaLi
Copy link
Contributor Author

meinaLi commented May 27, 2024

@chunfuwen Hi, could you help to review this virtual disk PR? Thanks.

from provider.virtual_disk import disk_base


def prepare_guest(vm, vmxml, disk_obj, params):
Copy link
Contributor

Choose a reason for hiding this comment

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

prepare_guest mix adding second disk and update system disk together, it is hard for others to read. Better separate them into two method.

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'm not sure how to split them. Because from the scenarios perspective I think it may be reasonable. Could you give me some detailed introduction if you find the better method. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split the function to two functions to add new scenarios in the future easily.

test.log.info("STEP3: login the guest and read/write.")
session = vm.wait_for_login()
if disk_type == "file":
session.cmd("mkfs.ext4 /dev/%s && mount /dev/%s /mnt" % (disk_dev, disk_dev))
Copy link
Contributor

Choose a reason for hiding this comment

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

libvirt_disk.fill_null_in_vm() implements similar function

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 test case only file disk need to format the vdb disk but not for the block disk. If we use libvirt_disk.fill_null_in_vm(), both the file disk and block disk will format which is not our expected. So I think it's inappropriate to use this function.


finally:
bkxml.sync()
libvirt.setup_or_cleanup_iscsi(is_setup=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all scenarios call libvirt.setup_or_cleanup_iscsi(is_setup=True) before , I assume

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, only block disk test uses this function. I've updated now.

…ttributes

These two cases are to match the cnv scenarios: VIRT-300872 and VIRT-300727.

Signed-off-by: Meina Li <meili@redhat.com>
Copy link
Contributor

@nanli1 nanli1 left a comment

Choose a reason for hiding this comment

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

ignore_status=False, shell=True has been used for 3 times, Suggest use virsh_dargs = {"ignore_status": False, "debug": True} if you want, Approved

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.

None yet

3 participants