forked from kubev2v/forklift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't crash when parsing vm yaml from virt-v2v
Make sure to test pointer types for nil before using them. Because yaml unmarshalling tries to parse as much as it can and ignores extra fields in both the struct and the data stream, we can end up with a struct that successfully parses the input stream but is only partially initialized. Because we're parsing this data from another source, we need to be defensive and ensure that the data is initialized before using it. Fixes: https://issues.redhat.com/browse/MTV-1577 Signed-off-by: Jonathon Jongsma <[email protected]>
- Loading branch information
Showing
4 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# generated by virt-v2v 2.5.8fedora=40,release=1.fc40 | ||
apiVersion: kubevirt.io/v1 | ||
kind: VirtualMachine | ||
metadata: | ||
name: mnecas-win-2022 | ||
labels: | ||
libguestfs.org/virt-v2v-version: "2.5.8" | ||
libguestfs.org/genid: f2fc75e8-4961-1425-4740-fcf2bc09685a | ||
libguestfs.org/osinfo: win2k22 | ||
libguestfs.org/source: vmware | ||
spec: | ||
template: | ||
spec: | ||
domain: | ||
firmware: | ||
bootloader: | ||
resources: | ||
clock: | ||
timer: | ||
hpet: | ||
present: false | ||
hyperv: {} | ||
pit: | ||
tickPolicy: delay | ||
rtc: | ||
tickPolicy: catchup | ||
utc: {} | ||
requests: | ||
memory: 8192Mi | ||
features: | ||
cpu: | ||
sockets: 2 | ||
cores: 2 | ||
thread: 1 | ||
terminationGracePeriodSeconds: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# generated by virt-v2v 2.5.8fedora=40,release=1.fc40 | ||
apiVersion: kubevirt.io/v1 | ||
kind: VirtualMachine | ||
metadata: | ||
name: mnecas-win-2022 | ||
labels: | ||
libguestfs.org/virt-v2v-version: "2.5.8" | ||
libguestfs.org/genid: 4f3c8a7c-3464-c9b0-cf79-08325a6bf1e8 | ||
libguestfs.org/osinfo: win2k22 | ||
libguestfs.org/source: kvm | ||
spec: | ||
template: | ||
spec: | ||
domain: | ||
os: | ||
resources: | ||
clock: | ||
timer: | ||
hpet: | ||
present: false | ||
hyperv: {} | ||
pit: | ||
tickPolicy: delay | ||
rtc: | ||
tickPolicy: catchup | ||
utc: {} | ||
requests: | ||
memory: 8192Mi | ||
features: | ||
acpi: {} | ||
apic: {} | ||
cpu: | ||
sockets: 2 | ||
cores: 2 | ||
thread: 1 | ||
terminationGracePeriodSeconds: 0 |