Bug 2023279 - Correct regexps used to fix schtasks command when the ShortDatePattern uses dots instead of / (eg. yy.M.d)
Summary: Correct regexps used to fix schtasks command when the ShortDatePattern uses d...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: virt-v2v
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Vera
URL:
Whiteboard:
Depends On: 2023277
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-15 11:28 UTC by Xiaodai Wang
Modified: 2022-05-10 13:39 UTC (History)
9 users (show)

Fixed In Version: virt-v2v-1.42.0-17.el8
Doc Type: Enhancement
Doc Text:
Clone Of: 2023277
Environment:
Last Closed: 2022-05-10 13:24:11 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-102746 0 None None None 2021-11-15 11:29:25 UTC
Red Hat Product Errata RHSA-2022:1759 0 None None None 2022-05-10 13:25:02 UTC

Description Xiaodai Wang 2021-11-15 11:28:09 UTC
+++ This bug was initially created as a clone of Bug #2023277 +++

Description of problem:
RFE: Adapt all date&time formats in firstboot script

Version-Release number of selected component (if applicable):
virt-v2v-1.45.3-3.el9.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:
1. Change the locale to "China" and the time format to 'yy.M.d'.
2. Run the powershell command by hand in a powershell console of a windows guest.
The command can be found in this commit:
https://github.com/libguestfs/virt-v2v/commit/b65711c9293415f671d35d0e2f9b55a74343da45

You could also follow the comments in bz1895323.
https://bugzilla.redhat.com/show_bug.cgi?id=1895323#c44

Actual results:
ERROR: Invalid Start Date (Date should be in "yyyy/mm/dd" format

Expected results:
The powershell commands should be success.

Additional info:
N/A

Comment 1 Richard W.M. Jones 2021-11-22 10:36:22 UTC
See: https://bugzilla.redhat.com/show_bug.cgi?id=2023277#c3

Comment 4 Vera 2021-12-14 10:03:44 UTC
Verified with the version:
virt-v2v-1.42.0-18.module+el8.6.0+13447+4b5d0856.x86_64

Steps to verify:
1. convert the VM with china locale;
# virt-v2v -i libvirt -ic vpx://root.198.169/data/10.73.199.217/?no_verify=1 -o rhv-upload -of raw -os nfs_data -oc https://dell-per740-22.lab.eng.pek2.redhat.com/ovirt-engine/api -op /v2v-ops/rhvpasswd -oo rhv-cafile=/v2v-ops/ca22.pem -oo rhv-cluster=Default -oo rhv-direct --mac 00:50:56:ac:62:28:bridge:ovirtmgmt esx7.0-win2019-x86_64-schtasks-error -it vddk -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=B5:52:1F:B4:21:09:45:24:51:32:56:F6:63:6A:93:5D:54:08:2D:78 --ip /v2v-ops/esxpw
[   0.5] Opening the source -i libvirt -ic vpx://root.198.169/data/10.73.199.217/?no_verify=1 esx7.0-win2019-x86_64-schtasks-error -it vddk  -io vddk-libdir=/root/vddk_libdir/latest -io vddk-thumbprint=B5:52:1F:B4:21:09:45:24:51:32:56:F6:63:6A:93:5D:54:08:2D:78
[   2.2] Creating an overlay to protect the source from being modified
[   3.0] Opening the overlay
[   7.5] Inspecting the overlay
[  11.9] Checking for sufficient free disk space in the guest
[  11.9] Estimating space required on target for each disk
[  11.9] Converting Windows Server 2019 Standard to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  23.9] Mapping filesystem data to avoid copying unused and blank areas
[  25.1] Closing the overlay
[  25.4] Assigning disks to buses
[  25.4] Checking if the guest needs BIOS or UEFI to boot
[  25.4] Initializing the target -o rhv-upload -oc https://dell-per740-22.lab.eng.pek2.redhat.com/ovirt-engine/api -op /v2v-ops/rhvpasswd -os nfs_data
[  26.7] Copying disk 1/1 to qemu URI json:{ "file.driver": "nbd", "file.path": "/tmp/v2vnbdkit.rBz1aV/nbdkit4.sock", "file.export": "/" } (raw)
    (100.00/100%)
[ 483.9] Creating output metadata
[ 485.9] Finishing off

2. Check powershell command in 0002-install-qemu-ga-x86_64-msi, the command has been changed as:
powershell.exe -command \"$d = (get-date).AddSeconds(120); $FormatHack = (($([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortDatePattern) -replace 'y+', 'yyyy') -replace 'M+', 'MM') -replace 'd+', 'dd'; schtasks.exe /Create /SC ONCE /ST $d.ToString('HH:mm') /SD $d.ToString($FormatHack) /RU SYSTEM /TN Firstboot-qemu-ga /TR \"C:\qemu-ga-x86_64.msi /forcerestart /qn /l+*vx C:\qemu-ga-x86_64.msi.log\""


Move the status to Verified.

Comment 6 errata-xmlrpc 2022-05-10 13:24:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:1759


Note You need to log in before you can comment on or make changes to this bug.