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

Installer test: add static DNS configuration test #3937

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

heywji
Copy link
Contributor

@heywji heywji commented Jan 7, 2024

Driver installer supports restoring DNS configurations after driver upgrade, so add a DNS checkpoint here. The previous static IP configuration test was #3860

ID: 1561

Signed-off-by: wji wji@redhat.com

@heywji
Copy link
Contributor Author

heywji commented Jan 7, 2024

Test Result:

CaseName                                 Status          StartTime       EndTime         Result     TimeElapsed
1-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-01-07 22:46:39 2024-01-07 23:01:28 PASS 888.374354
Summary:
Finshed=1, PASS=1

@heywji heywji force-pushed the add_dns_test branch 2 times, most recently from f2b2522 to ce819cf Compare January 7, 2024 16:12
@heywji
Copy link
Contributor Author

heywji commented Jan 8, 2024

Hi @leidwang @xiagao @vivianQizhu Could you please help to review it? Thanks.

@@ -96,6 +96,14 @@ def change_virtio_media(cdrom_virtio):
static_ip_address = utils_net.get_guest_ip_addr(session_serial, virtio_nic_mac, os_type='windows')
if static_ip_address != params["static_ip"]:
test.fail("Failed to setup static ip,current ip is %s" % static_ip_address)
setup_dns_cmd = params["setup_dns_cmd"] % ifname
session_serial.cmd_status(setup_dns_cmd)
static_dns_address = utils_net.get_windows_nic_attribute(session_serial, global_switch="nicconfig",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @wji

Is it possible to get the index value via the ifname/mac_address, it will be better than the hard code.
Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

@heywji I understand that the old code did not follow PEP8 perfectly, we could keep them as it is. But when we introduce new lines or touch them when fix issues let's try to improve our code style. please keep each line within 79 characters.

@heywji heywji force-pushed the add_dns_test branch 4 times, most recently from 2a75c49 to 4ce5b54 Compare January 12, 2024 02:57
@heywji
Copy link
Contributor Author

heywji commented Jan 15, 2024

Hi @leidwang, Could you help review this patch again since it gets the index value via the mac_address now?

@leidwang
Copy link
Contributor

Hi @leidwang, Could you help review this patch again since it gets the index value via the mac_address now?

LGTM, would you please provide the test results?

@heywji heywji force-pushed the add_dns_test branch 4 times, most recently from 57d1e21 to da5f7b6 Compare January 24, 2024 08:09
@heywji
Copy link
Contributor Author

heywji commented Jan 24, 2024

Test Result:

CaseName                                 Status          StartTime       EndTime         Result     TimeElapsed
1-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.q35 Finshed 2024-01-24 16:11:35 2024-01-24 16:24:22 PASS 766.635205
2-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.q35 Finshed 2024-01-24 16:24:22 2024-01-24 16:40:30 PASS 967.610786
3-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-01-24 16:40:30 2024-01-24 16:56:19 PASS 948.4478
4-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-01-24 16:56:19 2024-01-24 17:12:03 PASS 944.242369
Summary:
Finshed=4, PASS=4

@heywji
Copy link
Contributor Author

heywji commented Jan 24, 2024

Hi @leidwang @vivianQizhu, Please help me review this patch again when you are free. Thanks a lot : )

@@ -128,6 +136,14 @@ def change_virtio_media(cdrom_virtio):
static_ip_address = utils_net.get_guest_ip_addr(session_serial, virtio_nic_mac, os_type='windows')
if static_ip_address != params["static_ip"]:
test.fail("Static ip is lost after upgrade driver,current ip is %s" % static_ip_address)
setup_dns_cmd = params["setup_dns_cmd"] % ifname
session_serial.cmd_status(setup_dns_cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @heywji

IMO, we should not set dns again, just check if previous dns setting is valid.

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.

Hi @leidwang, I tried that. If I don't set it, I will get "c:\windows\system32".

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be another problem.
Back to our test case, the checkpoint is to check if the static dns can be saved after upgrading the driver. If we set the DNS again after upgrading the driver, then our checkpoint will not be tested at all, which is meaningless.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@leidwang You are right. I will change my code and find the root cause.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am fixing a similar bug, not sure if the error you hit is same with me, I will send you the patch.You can try to run your patch with my fix first.

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 have already solved this problem.
There are two issues contained here, so let me explain.
The first one about 'c:\\windows\\system32' comes from your patch-related problem.
The second problem is a runtime error. The root cause of this problem comes from the fact that the developers fixed this problem in virtio-win-1.9.36-0.el9_3.iso, and I was using a lower version before. So that, it is normal that the DNS information is not found.

It works now. Thanks leidong.

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 short, I was using the wrong iso. Sorry :(

@heywji
Copy link
Contributor Author

heywji commented Feb 26, 2024

Test Result:

1-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-26 16:56:55 2024-02-26 17:24:39 PASS 1664.016673
2-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-26 17:24:39 2024-02-26 17:51:37 PASS 1617.687452
Summary:
Finshed=2, PASS=2

@heywji
Copy link
Contributor Author

heywji commented Feb 26, 2024

Hi @leidwang, Could you please help to review this again when you are free?

Thanks in advance.

@heywji heywji force-pushed the add_dns_test branch 2 times, most recently from 3df5811 to a6321b5 Compare February 27, 2024 03:24
@heywji
Copy link
Contributor Author

heywji commented Feb 27, 2024

I just pushed the wrong branch, but it is normal now.

Copy link
Contributor

@leidwang leidwang left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment on lines 139 to 144
static_dns_address = utils_net.get_windows_nic_attribute(session_serial, global_switch="nicconfig",
key="MACAddress", value=f"{virtio_nic_mac}",
target="DNSServerSearchOrder")
static_dns_address = static_dns_address.strip('{}').strip('"')
if static_dns_address != params["static_dns"]:
test.fail("Static dns is lost after upgrade driver,current dns is %s" % static_dns_address)
Copy link
Contributor

Choose a reason for hiding this comment

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

@heywji Shall we consider package these lines into a function as you repeat exactly the same lines twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK! I will change it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @vivianQizhu, I have put these lines into a function. Could you please check them again?

Test Result: Pass

Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2022.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35: PASS (955.86 s)

@heywji heywji force-pushed the add_dns_test branch 4 times, most recently from 8fdca88 to 0406768 Compare February 27, 2024 09:17
@heywji heywji force-pushed the add_dns_test branch 3 times, most recently from e4b690d to 902a123 Compare February 27, 2024 09:39
Comment on lines 108 to 110
static_ip_address = utils_net.get_guest_ip_addr(session_serial, virtio_nic_mac, os_type='windows')
if static_ip_address != params["static_ip"]:
test.fail("Failed to setup static ip,current ip is %s" % static_ip_address)
Copy link
Contributor

Choose a reason for hiding this comment

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

@heywji These lines also could be included into the 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.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Test Result: pass

Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win10.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35: PASS (960.66 s)

@heywji heywji force-pushed the add_dns_test branch 3 times, most recently from f94bbb4 to 1e1c801 Compare February 28, 2024 03:07
@heywji
Copy link
Contributor Author

heywji commented Feb 28, 2024

Test Result:

CaseName                                 Status          StartTime       EndTime         Result     TimeElapsed
01-Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_threads.q35 Finshed 2024-02-28 16:56:07 2024-02-28 17:27:52 PASS 1905.263458
02-repeat1.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 17:27:53 2024-02-28 17:48:43 PASS 1249.919158
03-repeat2.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 17:48:44 2024-02-28 18:09:31 PASS 1246.935041
04-repeat3.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 18:09:31 2024-02-28 18:30:32 PASS 1260.926943
05-repeat4.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 18:30:33 2024-02-28 18:51:26 PASS 1253.629489
06-repeat5.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 18:51:27 2024-02-28 19:12:42 PASS 1275.458846
07-repeat6.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 19:12:43 2024-02-28 19:33:51 PASS 1268.227964
08-repeat7.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 19:33:52 2024-02-28 19:54:57 PASS 1265.19864
09-repeat8.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 19:54:58 2024-02-28 20:16:28 PASS 1290.261734
10-repeat9.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 20:16:29 2024-02-28 20:38:14 PASS 1305.708692
11-repeat10.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-02-28 20:38:15 2024-02-28 20:59:44 PASS 1288.697793
Summary:
Finshed=11, PASS=11

Driver installer supports restoring DNS configurations after driver
upgrade, so add a DNS checkpoint here.

Reference: The previous static IP configuration test was autotest#3860
Signed-off-by: wji <wji@redhat.com>
@vivianQizhu
Copy link
Contributor

@heywji Latest test result please. Thanks.

@heywji
Copy link
Contributor Author

heywji commented Mar 1, 2024

Test Result: PASS

01-repeat1.Host_RHEL.m9.u4.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.win_virtio_driver_install_by_installer.driver_update.from_old_installer.q35 Finshed 2024-03-01 14:30:32 2024-03-01 14:53:08 PASS 1356.027594

@vivianQizhu vivianQizhu merged commit 7a5cae1 into autotest:master Mar 1, 2024
6 checks passed
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.

3 participants