Introduce a function to check whether disk is read-only
@@ -138,3 +138,9 @@ func HasKernelBootContainerImage(vmi *v1.VirtualMachineInstance) bool {
func HasHugePages(vmi *v1.VirtualMachineInstance) bool {
return vmi.Spec.Domain.Memory != nil && vmi.Spec.Domain.Memory.Hugepages != nil
}
+
+func IsReadOnlyDisk(disk *v1.Disk) bool {
+ isReadOnlyCDRom := disk.CDRom != nil && (disk.CDRom.ReadOnly == nil || *disk.CDRom.ReadOnly == true)
+
+ return isReadOnlyCDRom
+}
