Skip to content

Commit

Permalink
-o kubevirt: Create a VirtualMachine instead of a VirtualMachineInstance
Browse files Browse the repository at this point in the history
VMs converted by virt-v2v are pets not cattle so we want to create
permanent non-running machines.  (They may later or even soon
afterwards be started up by some other tool, at which point they also
become Instances.)  Therefore use a different kind and slightly
restructure the yaml around this.

Thanks: Lee Yarwood
  • Loading branch information
rwmjones committed Jul 4, 2024
1 parent 0b8b409 commit ac24a9b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 62 deletions.
4 changes: 2 additions & 2 deletions output/create_kubevirt_yaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ let create_kubevirt_yaml source inspect
let body = [
"#", String generated_by;
"apiVersion", String "kubevirt.io/v1";
"kind", String "VirtualMachineInstance";
"kind", String "VirtualMachine";
"metadata", Assoc !metadata;
"spec", Assoc !spec;
"spec", Assoc ["template", Assoc ["spec", Assoc !spec]];
] in

(* Return the YAML document. *)
Expand Down
44 changes: 23 additions & 21 deletions tests/test-v2v-o-kubevirt-fedora.yaml.expected
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
---
# generated by virt-v2v
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
kind: VirtualMachine
metadata:
name: test
labels:
libguestfs.org/virt-v2v-version:
libguestfs.org/osinfo: fedora14
libguestfs.org/source: test
spec:
domain:
os:
firmware: bios
resources:
requests:
memory: 1024Mi
features:
cpu:
cores: 1
devices:
useVirtioTransitional: true
disks:
- disk:
bus: virtio
template:
spec:
domain:
os:
firmware: bios
resources:
requests:
memory: 1024Mi
features:
cpu:
cores: 1
devices:
useVirtioTransitional: true
disks:
- disk:
bus: virtio
name: disk-0
volumes:
- hostDisk:
path: test-sda
type: Disk
name: disk-0
volumes:
- hostDisk:
path: test-sda
type: Disk
name: disk-0
terminationGracePeriodSeconds: 0
terminationGracePeriodSeconds: 0
80 changes: 41 additions & 39 deletions tests/test-v2v-o-kubevirt-windows.yaml.expected
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
---
# generated by virt-v2v
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstance
kind: VirtualMachine
metadata:
name: test
labels:
libguestfs.org/virt-v2v-version:
libguestfs.org/osinfo: win7
libguestfs.org/source: test
spec:
domain:
os:
firmware: bios
resources:
clock:
timer:
hpet:
present: false
hyperv: {}
pit:
tickPolicy: delay
rtc:
tickPolicy: catchup
utc: {}
requests:
memory: 1024Mi
features:
cpu:
cores: 1
devices:
rng: {}
disks:
- disk:
bus: virtio
template:
spec:
domain:
os:
firmware: bios
resources:
clock:
timer:
hpet:
present: false
hyperv: {}
pit:
tickPolicy: delay
rtc:
tickPolicy: catchup
utc: {}
requests:
memory: 1024Mi
features:
cpu:
cores: 1
devices:
rng: {}
disks:
- disk:
bus: virtio
name: disk-0
interfaces:
- name: net_default
masquerade: {}
macAddress: 00:11:22:33:44:55
model: virtio
volumes:
- hostDisk:
path: test-sda
type: Disk
name: disk-0
interfaces:
- name: net_default
masquerade: {}
macAddress: 00:11:22:33:44:55
model: virtio
volumes:
- hostDisk:
path: test-sda
type: Disk
name: disk-0
networks:
- networkName: default
name: net_default
terminationGracePeriodSeconds: 0
networks:
- networkName: default
name: net_default
terminationGracePeriodSeconds: 0

0 comments on commit ac24a9b

Please sign in to comment.