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

Replace WMIC with powershell cmd #4034

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

Conversation

leidwang
Copy link
Contributor

@leidwang leidwang commented Nov 29, 2024

From Win11-24H2, WMIC is an optional feature for Windows, And it will be fully removed in the future.So replace the related cmd

ID: 3268

@leidwang leidwang force-pushed the wmic_replacement branch 2 times, most recently from 97073f0 to 194ab37 Compare November 29, 2024 12:59
@leidwang leidwang force-pushed the wmic_replacement branch 2 times, most recently from 1c9d9ea to 7c4813a Compare December 24, 2024 03:11
@leidwang leidwang marked this pull request as ready for review December 31, 2024 01:43
@leidwang leidwang force-pushed the wmic_replacement branch 5 times, most recently from ae6028c to 9f86791 Compare January 8, 2025 01:51
From Win11-24H2, WMIC is an optional feature for Windows,
And it will be fully removed in the future.So replace the
related cmd

Signed-off-by: Leidong Wang <leidwang@redhat.com>
@leidwang
Copy link
Contributor Author

leidwang commented Jan 8, 2025

Hi @xiagao @heywji Would you please help test this MR with our acceptance test, thanks.

@heywji
Copy link
Contributor

heywji commented Jan 15, 2025

Test 271 acceptance with win2022,win11,win1032 and win2016 guests, this patch worked.

@leidwang
Copy link
Contributor Author

Hi @XueqiangWei @nanliu-r @fbq815 Would you please help test this MR, it is mainly for wmic repalcement.Thanks.

@xiagao
Copy link
Contributor

xiagao commented Jan 16, 2025

Acceptance test looks good.
LGTM.

@mcasquer
Copy link
Contributor

balloon_hotplug test cases now passed in Win2025

 (1/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.q35: STARTED
 (1/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.q35: PASS (50028.55 s)
 (2/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_reboot.q35: STARTED
 (2/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_reboot.q35: PASS (939.88 s)
 (3/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_system_reset.q35: STARTED
 (3/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_system_reset.q35: PASS (871.67 s)
 (4/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_shutdown_after_unplug.q35: STARTED
 (4/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_shutdown_after_unplug.q35: PASS (497.14 s)
 (5/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_shutdown_after_plug.q35: STARTED
 (5/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_shutdown_after_plug.q35: PASS (473.43 s)
 (6/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_migrate.migrate_after_hotplug.q35: STARTED
 (6/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_migrate.migrate_after_hotplug.q35: PASS (601.20 s)
 (7/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_migrate.migrate_after_unplug.q35: STARTED
 (7/7) Host_RHEL.m9.u6.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.balloon_hotplug.with_migrate.migrate_after_unplug.q35: PASS (694.86 s)
RESULTS    : PASS 7 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0

Copy link
Contributor

@mcasquer mcasquer left a comment

Choose a reason for hiding this comment

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

LGTM

@leidwang
Copy link
Contributor Author

Hi @yanan-fu @YongxueHong Would you please help review this MR?Thanks.

return out if out else []
c_name, c_value = cond.split("=")
cmd = (
'powershell -command "Get-CimInstance -ClassName Win32_LogicalDisk | Where-Object {$_.%s -like %s}'
Copy link
Contributor

@mcasquer mcasquer Jan 24, 2025

Choose a reason for hiding this comment

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

The disk needs to be under single quotes, same you've done in utils_netperf.py and replace the existing ones by double quotes

Suggested change
'powershell -command "Get-CimInstance -ClassName Win32_LogicalDisk | Where-Object {$_.%s -like %s}'
"powershell -command \"Get-CimInstance -ClassName Win32_LogicalDisk | Where-Object {$_.%s -like '%s'}"

return mapping
return {}
cmd = (
'powershell -command "Get-CimInstance -ClassName Win32_Diskdrive | Where-Object {$_.SerialNumber -eq %s}'
Copy link
Contributor

@mcasquer mcasquer Jan 24, 2025

Choose a reason for hiding this comment

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

Same as above

Suggested change
'powershell -command "Get-CimInstance -ClassName Win32_Diskdrive | Where-Object {$_.SerialNumber -eq %s}'
"powershell -command \"Get-CimInstance -ClassName Win32_Diskdrive | Where-Object {$_.SerialNumber -eq '%s'}"

results.append(vals[0])
else:
results.append(dict(zip(keys, vals)))
return results if results else []
Copy link
Contributor

@mcasquer mcasquer Jan 24, 2025

Choose a reason for hiding this comment

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

@leidwang
Another comment here, this implementation seems to no longer return a map, so this will probably break all the calls to this function.

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.

4 participants