From f955adcf7005f09b698a1ddc273132492d8daba3 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 29 Jan 2021 10:06:32 +0100 Subject: Add Libvirt 7.0.0 RelaxNG schema files for QEMU --- src/main/resources/libvirt/rng/basictypes.rng | 637 ++ src/main/resources/libvirt/rng/capability.rng | 519 ++ src/main/resources/libvirt/rng/cpu.rng | 12 + src/main/resources/libvirt/rng/cputypes.rng | 420 ++ src/main/resources/libvirt/rng/domain.rng | 21 + src/main/resources/libvirt/rng/domainbackup.rng | 300 + src/main/resources/libvirt/rng/domaincaps.rng | 294 + .../resources/libvirt/rng/domaincheckpoint.rng | 94 + src/main/resources/libvirt/rng/domaincommon.rng | 7270 ++++++++++++++++++++ src/main/resources/libvirt/rng/domainsnapshot.rng | 228 + src/main/resources/libvirt/rng/interface.rng | 434 ++ src/main/resources/libvirt/rng/network.rng | 450 ++ src/main/resources/libvirt/rng/networkcommon.rng | 294 + src/main/resources/libvirt/rng/networkport.rng | 160 + src/main/resources/libvirt/rng/nodedev.rng | 765 ++ src/main/resources/libvirt/rng/nwfilter.rng | 986 +++ src/main/resources/libvirt/rng/nwfilter_params.rng | 32 + src/main/resources/libvirt/rng/nwfilterbinding.rng | 49 + src/main/resources/libvirt/rng/secret.rng | 94 + src/main/resources/libvirt/rng/storagecommon.rng | 238 + src/main/resources/libvirt/rng/storagepool.rng | 788 +++ src/main/resources/libvirt/rng/storagepoolcaps.rng | 88 + src/main/resources/libvirt/rng/storagevol.rng | 235 + 23 files changed, 14408 insertions(+) create mode 100644 src/main/resources/libvirt/rng/basictypes.rng create mode 100644 src/main/resources/libvirt/rng/capability.rng create mode 100644 src/main/resources/libvirt/rng/cpu.rng create mode 100644 src/main/resources/libvirt/rng/cputypes.rng create mode 100644 src/main/resources/libvirt/rng/domain.rng create mode 100644 src/main/resources/libvirt/rng/domainbackup.rng create mode 100644 src/main/resources/libvirt/rng/domaincaps.rng create mode 100644 src/main/resources/libvirt/rng/domaincheckpoint.rng create mode 100644 src/main/resources/libvirt/rng/domaincommon.rng create mode 100644 src/main/resources/libvirt/rng/domainsnapshot.rng create mode 100644 src/main/resources/libvirt/rng/interface.rng create mode 100644 src/main/resources/libvirt/rng/network.rng create mode 100644 src/main/resources/libvirt/rng/networkcommon.rng create mode 100644 src/main/resources/libvirt/rng/networkport.rng create mode 100644 src/main/resources/libvirt/rng/nodedev.rng create mode 100644 src/main/resources/libvirt/rng/nwfilter.rng create mode 100644 src/main/resources/libvirt/rng/nwfilter_params.rng create mode 100644 src/main/resources/libvirt/rng/nwfilterbinding.rng create mode 100644 src/main/resources/libvirt/rng/secret.rng create mode 100644 src/main/resources/libvirt/rng/storagecommon.rng create mode 100644 src/main/resources/libvirt/rng/storagepool.rng create mode 100644 src/main/resources/libvirt/rng/storagepoolcaps.rng create mode 100644 src/main/resources/libvirt/rng/storagevol.rng (limited to 'src/main/resources') diff --git a/src/main/resources/libvirt/rng/basictypes.rng b/src/main/resources/libvirt/rng/basictypes.rng new file mode 100644 index 0000000..a221ff6 --- /dev/null +++ b/src/main/resources/libvirt/rng/basictypes.rng @@ -0,0 +1,637 @@ + + + + + + + + [0-9]+ + + + + + [0-9]+ + + + + + + (0x)?[0-9a-f]+ + + + + + + [0-9]+ + + + + + + [0-7]+ + + + + + + + 0x[0-9a-fA-F]{1,2} + + + 0 + 255 + + + + + + + (0x)?[0-9a-fA-F]{1,4} + + + 0 + 65535 + + + + + + + 0x[0-9a-fA-F]{1,6} + + + 0 + 16777215 + + + + + + + (0x)?[0-9a-fA-F]{1,8} + + + 0 + 4294967295 + + + + + + + + [a-fA-F0-9]{32} + + + [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} + + + + + + + 10 + 255 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5} + + + + + [a-fA-F0-9][13579bBdDfF](:[a-fA-F0-9]{2}){5} + + + + + [a-fA-F0-9]{2}(:[a-fA-F0-9]{2}){5} + + + + + + + + + + + + + + + + + + + + + + + + + + + + [0]{1,2}:[0]{0,1}[1]:[0]{1,2}:[0]{0,1}[a-fA-F1-9](:[a-fA-F0-9]{1,2}){4}(:[a-fA-F0-9]{1,2}){6,8} + + + + + + + [0]{1,2}:[0]{0,1}[2](:[a-fA-F0-9]{1,2}){4}(:[a-fA-F0-9]{1,2}){1,124} + + + + + + + [0]{1,2}:[0]{0,1}[3]:[0]{1,2}:[0]{0,1}[a-fA-F1-9](:[a-fA-F0-9]{1,2}){6,8} + + + + + + + [0]{1,2}:[0]{0,1}[4](:[a-fA-F0-9]{1,2}){16} + + + + + + + + + + + + + + + + + (((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])) + + + + + + + +(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)|(::) + + + + + + + + + + + + + 32 + + + + + + 128 + + + + + + + + + + + + + + [^\n]+ + + + + + + [^/\n]+ + + + + + + [a-zA-Z0-9_\+\-]+ + + + + + + [a-zA-Z0-9\.\-]+ + + + + + + [a-zA-Z0-9_\.\-\\:/]+ + + + + + + [a-zA-Z0-9_\-]+ + + + + + + .+ + + + + + + .+ + + + + + + (/|[a-zA-Z]:\\).+ + + + + + + \[[^\]]+\] .+ + + + + + + /.* + + + + + + ([bB]([yY][tT][eE][sS]?)?)|([kKmMgGtTpPeE]([iI]?[bB])?) + + + + + + + + + + + + + + + + + + + + + (0x)?[0-1]?[0-9a-fA-F] + + + 0 + 31 + + + + + + + (0x)?[0-7] + + + 0 + 7 + + + + + + + (0x)?[0-9a-fA-F]{16} + + + + + + + 0x[0-9a-eA-E][0-9a-fA-F]? + + + 0x[fF][0-9a-eA-E]? + + + 0 + 254 + + + + + + (0x)?[0-3] + + + + + + 0x[0-9a-fA-F]{1,4} + + + 0 + 65535 + + + + + + + ([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))* + + + + + + + [^/]+ + + + . + .. + + + + + + + + aarch64 + alpha + armv6l + armv7l + cris + i686 + ia64 + lm32 + m68k + microblaze + microblazeel + mips + mipsel + mips64 + mips64el + openrisc + parisc + parisc64 + ppc + ppc64 + ppc64le + ppcemb + riscv32 + riscv64 + s390 + s390x + sh4 + sh4eb + sparc + sparc64 + unicore32 + x86_64 + xtensa + xtensaeb + + + + + + -1 + 65535 + + + + + + + + + + + scsi_host + + + + + + + + + + + + + + + + + + + + + + + + + + + fc_host + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0x[a-fA-F0-9]{1,4} + + + + + + + 0x[a-fA-F0-9] + + + + + + + + + + + + + + + + + unknown + notpresent + down + lowerlayerdown + testing + dormant + up + + + + + + + + + + yes + no + + + + + + on + off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + seconds + minutes + hours + + + + diff --git a/src/main/resources/libvirt/rng/capability.rng b/src/main/resources/libvirt/rng/capability.rng new file mode 100644 index 0000000..91a046e --- /dev/null +++ b/src/main/resources/libvirt/rng/capability.rng @@ -0,0 +1,519 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vpxmigr + tcp + rdma + vzmigr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + both + code + data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (llc_|mbm_)[a-zA-Z0-9\-_]+ + + + + + + + + + + + + + + + + + xen + linux + hvm + exe + uml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 31 + 32 + 64 + + + + + + + + + + + + + + + + + + + + + + + + + qemu + kqemu + kvm + xen + uml + lxc + openvz + test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/cpu.rng b/src/main/resources/libvirt/rng/cpu.rng new file mode 100644 index 0000000..d1eb674 --- /dev/null +++ b/src/main/resources/libvirt/rng/cpu.rng @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/cputypes.rng b/src/main/resources/libvirt/rng/cputypes.rng new file mode 100644 index 0000000..f66bc62 --- /dev/null +++ b/src/main/resources/libvirt/rng/cputypes.rng @@ -0,0 +1,420 @@ + + + + + + + + custom + host-model + host-passthrough + + + + + + + + minimum + exact + strict + + + + + + + + none + partial + full + + + + + + + + + + allow + forbid + + + + + + + [^,]{12} + + + + + + + + + + + + + + + + + + + + + force + require + optional + disable + forbid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + shared + private + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + none + direct + full + + + + + none + writeback + writethrough + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + access + read + write + + + + + + + + + + + + + + + + + + + access + read + write + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9\-_\.]+ + + + + + + + + + 1 + 2 + 3 + + + + + + emulate + passthrough + disable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9\-_]+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/domain.rng b/src/main/resources/libvirt/rng/domain.rng new file mode 100644 index 0000000..b93bbed --- /dev/null +++ b/src/main/resources/libvirt/rng/domain.rng @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/domainbackup.rng b/src/main/resources/libvirt/rng/domainbackup.rng new file mode 100644 index 0000000..c03455a --- /dev/null +++ b/src/main/resources/libvirt/rng/domainbackup.rng @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + luks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + push + + + + + + + pull + + + + + + + yes + no + + + + + + + + tcp + + + + + + + + + + + + + + + + + unix + + + + + + + + + + + + + + + + + + + + + full + + + + + incremental + + + + + + + + + + + + + + + + + + + + + + + + + qcow2 + + + + + + + + + + yes + + + + + + + + + + + + + + + + + + no + + + + + + file + + + + + + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + no + + + + + + + file + + + + + + + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/domaincaps.rng b/src/main/resources/libvirt/rng/domaincaps.rng new file mode 100644 index 0000000..0dbffb2 --- /dev/null +++ b/src/main/resources/libvirt/rng/domaincaps.rng @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + host-passthrough + + + + + + + + + + + + host-model + + + + + + + + + + + + + + + + + + custom + + + + + + + yes + no + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/domaincheckpoint.rng b/src/main/resources/libvirt/rng/domaincheckpoint.rng new file mode 100644 index 0000000..a1c8b0b --- /dev/null +++ b/src/main/resources/libvirt/rng/domaincheckpoint.rng @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + no + + + + + bitmap + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9_\-][a-zA-Z0-9_\-.]* + + + + diff --git a/src/main/resources/libvirt/rng/domaincommon.rng b/src/main/resources/libvirt/rng/domaincommon.rng new file mode 100644 index 0000000..7dc419b --- /dev/null +++ b/src/main/resources/libvirt/rng/domaincommon.rng @@ -0,0 +1,7270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 0[0-7]{3}|[0-7]{1,3} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dynamic + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + + static + + + + + + + + + + + + + + + + + + + + + none + + + + no + + + + + + + + + + + + + + + + + + no + + + + + yes + + + + + + yes + + + + + + + + + + + + + + + qemu + kqemu + kvm + xen + lxc + uml + openvz + test + vmware + hyperv + vbox + phyp + vz + bhyve + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bios + efi + + + + + + + + + + yes + no + + + + + + + yes + no + + + + + + + rom + pflash + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i686 + x86_64 + ia64 + + + + + + + xenpv + xenfv + xenpvh + + + + + xen + linux + xenpvh + + + + + + + + + + + + + + [a-zA-Z0-9_\.\-]+ + + + + hvm + + + + + + + + + + + + exe + + + + + + + + + + + + + + + + + [a-zA-Z_]+[a-zA-Z0-9_]* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + aes + dea + + + + + + + + + + + + + + sev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cmt + mbmt + mbml + cpu_cycles + instructions + cache_references + cache_misses + branch_instructions + branch_misses + bus_cycles + stalled_cycles_frontend + stalled_cycles_backend + ref_cpu_cycles + cpu_clock + task_clock + page_faults + context_switches + cpu_migrations + page_faults_min + page_faults_maj + alignment_faults + emulation_faults + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file + anonymous + memfd + + + + + + + + + shared + private + + + + + + + + + immediate + ondemand + + + + + + + + + + + + + + + + + + + static + auto + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + both + code + data + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + batch + idle + + + + + + + fifo + rr + + + + + + + + + + + + + + + + + + + strict + preferred + interleave + + + + + + + + static + + + + + + + + + + auto + + + + + + + + + + + + strict + preferred + interleave + + + + + + + + + + + + + + + + + + + + + + + + + + + localtime + utc + + + + + + + reset + + + + + + + timezone + + + + + + + + + + variable + + + + + + + + + + utc + localtime + + + + + + + + + + + + + + + + + + platform + rtc + + + + + + boot + guest + wall + + + + + + + + + + tsc + + + + + + + + + + + + + auto + native + emulate + paravirt + smpsafe + + + + + + + + hpet + pit + armvtimer + + + + + + + + + + kvmclock + hypervclock + + + + + + + + + + + + + + + + + + + delay + merge + discard + + + + + + catchup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hd + fd + cdrom + network + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [ -~]{0,8} + + + + + + + + [ -~]{0,16} + + + + + + + + + no + internal + external + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mandatory + requisite + optional + + + + + + + + + + + + + floppy + disk + cdrom + + + + + + + + + + + lun + + + + + + + + + + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + storage + + + + + + + + + + + + + + + + + + + + + + file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dir + + + + + + + + + + + + + + + + + + + + + + + + + + + + tcp + rdma + + + + + + + + + + + + + + + + + + unix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rbd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iscsi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [!#$%&'*+\-.0-9A-Z\^_`a-z|~]+ + + + + "?[!#$%&'()*+\-./0-9:>=<?@A-Z\^_`\[\]a-z|~]+"? + + + + + + + + + + + + + https + + + + + + + + + + + + + + + + + + + + + + + + + + + + http + + + + + + + + + + + + + + + + + + + + + + + + + ftps + + + + + + + + + + + + + + + + + + + + + + sheepdog + ftp + tftp + + + + + + + + + + + + + + + + + + nbd + + + + + + + + + + + + + + + + + + + + + + + gluster + + + + + + + + + + + + + + + + + + + vxhs + + + + + + + + + + + + + + + + + + + + nfs + + + + + + + + + + + + + network + + + + + + + + + + + + + + + + + + volume + + + + + + + + + + + + + + host + direct + + + + + + + + + + + + + + + + + + + + + nvme + + + + + + pci + + + + + + + + + + + + + + + + + + + + + + + + + + + (ioemu:)?(fd|hd|sd|vd|xvd|ubd)[a-zA-Z0-9_]+ + + + + + + + + + + + ide + fdc + scsi + virtio + xen + usb + uml + sata + sd + + + + + + + open + closed + + + + + + + + + + + + + + + + + + + + + + + + + auto + none + lba + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + aio + + + + + + + + + default + none + writeback + writethrough + directsync + unsafe + + + + + + + stop + report + ignore + enospace + + + + + + + stop + report + ignore + + + + + + + threads + native + io_uring + + + + + + + + + + + + + + + + + + + + + + unmap + ignore + + + + + + + + + + + + off + on + unmap + + + + + + + + + + + + + + + + + + + + + + + fdc + sata + ccid + + + + + + + scsi + + + + + auto + buslogic + lsilogic + lsisas1068 + vmpvscsi + ibmvscsi + virtio-scsi + lsisas1078 + virtio-transitional + virtio-non-transitional + ncr53c90 + dc390 + am53c974 + + + + + + + + usb + + + + + piix3-uhci + piix4-uhci + ehci + ich9-ehci1 + ich9-uhci1 + ich9-uhci2 + ich9-uhci3 + vt82c686b-uhci + pci-ohci + nec-xhci + none + qusb1 + qusb2 + qemu-xhci + + + + + + + + + + + + + + + + ide + + + + + piix3 + piix4 + ich6 + + + + + + + + isa + + + + + + pci + + + + + + + spapr-pci-host-bridge + + pci-bridge + + i82801b11-bridge + + pcie-pci-bridge + + ioh3420 + pcie-root-port + + x3130-upstream + + xio3130-downstream + + pxb + + pxb-pcie + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pci-root + pcie-root + + + + + + + + + + + + pci-bridge + dmi-to-pci-bridge + pcie-to-pci-bridge + pcie-root-port + pcie-switch-upstream-port + pcie-switch-downstream-port + pci-expander-bus + pcie-expander-bus + + + + + + + + + virtio-serial + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + + + + xenbus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + mount + + + + + + + + + + + + + + + + + + + + + bind + + + + + + + + + + + + + + + + + template + + + + + + + + + + + + + + + + ram + + + + + + + + + + + + + + + + + + + + + + + + + + + + passthrough + mapped + squash + + + + + + + default + remap + forbid + warn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + path + handle + loop + nbd + ploop + + + + + + + + + + + immediate + + + + + + + virtiofs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + none + always + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9_\.\-\\:/ ]* + + + + + + + + + + + + + + + + bridge + + + + + + + + + + + + + + + + + + + + ethernet + + + + + + + + + + + + + vhostuser + + + + + + + + + network + + + + + + + + + + + + + + + + + + direct + + + + + + + + + + + + + + + + + + + + + + + + + user + + + + + + + + internal + + + + + + + + + + + + + + + mcast + client + + + + + + + + + + + + + + + + + + udp + + + + + + + + + + + + + + + + + + + + + + + + + server + + + + + + + + + + + + + + + + + + + hostdev + + + + + + + + + + + + + + + + + + + + + + + + + pci + + + + + + usb + + + + + + + + + + + + + + + + + + + + + + vdpa + + + + + + + + + + + + + + + + + + + + + + + + + + + up + down + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + generated + static + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9\-_]+ + + + + + + + + + + + + + + + + + + + + + + + + + + kvm + vfio + xen + + + + + + + + qemu + vhost + + + + + + + + + + + + + + + + + + + + + + iothread + timer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + persistent + + + + + transient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sdl + + + + + + + + + + + + + + + + + + + + + + + + + + + + vnc + + + + + + + + + + + + + + + + + + + + + + + + + + + allow-exclusive + force-shared + ignore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + keep + + + + + + + spice + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fail + disconnect + keep + + + + + + + any + secure + insecure + + + + + + + + + + main + display + inputs + cursor + playback + record + smartcard + usbredir + + + + + any + secure + insecure + + + + + + + + + + auto_glz + auto_lz + quic + glz + lz + off + + + + + + + + + + auto + never + always + + + + + + + + + + auto + never + always + + + + + + + + + + + + + + + + + + filter + all + off + + + + + + + + + + + + + + + + + + server + client + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rdp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + desktop + + + + + + + + + + + + + + + egl-headless + + + + + + + + + + + + + + + + + + + + + + address + + + + + + + + + + network + + + + + + + + + + + + + socket + + + + + + + + + + none + + + + + + + + + + + + + + + + + + qemu + vhostuser + + + + + + + io + on + off + + + + + + + + + + + vga + cirrus + vmvga + xen + vbox + virtio + gop + none + bochs + ramfb + + + + + qxl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + destroy + restart + preserve + rename-restart + + + + + + destroy + restart + preserve + rename-restart + coredump-destroy + coredump-restart + + + + + + poweroff + restart + pause + ignore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xen + serial + uml + virtio + lxc + openvz + sclp + sclplm + + + + + + + + isa-serial + usb-serial + pci-serial + spapr-vio-serial + system-serial + sclp-serial + + + + + + + + + isa-serial + usb-serial + pci-serial + spapr-vty + pl011 + 16550a + sclpconsole + sclplmconsole + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dev + file + pipe + unix + tcp + udp + null + stdio + vc + pty + spicevmc + spiceport + nmdm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + raw + telnet + telnets + tls + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + duplex + micro + output + + + + + + + + + sb16 + es1370 + pcspk + ac97 + ich6 + ich7 + ich9 + usb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + oss + + + + + + + + + + + + + + + + + + + + + + + + + i6300esb + ib700 + diag288 + + + + + + reset + shutdown + poweroff + pause + none + dump + inject-nmi + + + + + + + + + + + + + + + + + + + + + + + + [^/]* + + + + + + master + peer + + + + + + + + + ivshmem + ivshmem-plain + ivshmem-doorbell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + xen + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + guestfwd + + + + + + + + + virtio + + + + + + + + connected + disconnected + + + + + + + + + xen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + host + + + + + + host-certificates + + + + + + + + + + + + + passthrough + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tpm-tis + tpm-crb + tpm-spapr + spapr-tpm-proxy + + + + + + + + + + + + + + + + + + + passthrough + + + + + + emulator + + + + + + yes + no + + + + + + + + + 1.2 + 2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + intel + smmuv3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tablet + mouse + keyboard + + + + + + ps2 + usb + xen + virtio + + + + + + + passthrough + + + virtio + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + + usb + + + + + + + + + + + + + + + usb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + subsystem + + + + + + + + + + + + + + + + + + + capabilities + + + + + + + + + + + + + + + + + + pci + + + + + + + kvm + vfio + xen + + + + + + + + + + + + + + + + + + + + + + + + usb + + + + + + + + + + + + + + + + + + + + scsi + + + + + + + + + + + + + adapter + + + + + + + + + + + + iscsi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + scsi_host + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + vhost + + + + (naa\.)[0-9a-fA-F]{16} + + + + + + + + + + mdev + + + + vfio-pci + vfio-ccw + vfio-ap + + + + + + + + + + + + + + + + + + + + storage + + + + + + + + + + + misc + + + + + + + + + + + net + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + host + 2 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + smbios + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fwcfg + + + + + + + + + + + + + + + + + + + + + + + + + + + vendor + version + date + release + + + + + + manufacturer + product + version + serial + uuid + sku + family + + + + + + manufacturer + product + version + serial + asset + location + + + + + + manufacturer + version + serial + asset + sku + + + + + + + + + + + + + slic + + + + + + + + + + + + emulate + host + sysinfo + + + + + + + + + + + + + + + + + + + + + + + + + + qemu + kvm + + + + + + + + + + + + enabled + disabled + required + + + + + + + + + + + + + + + + + + + + + + + + + + ignore + fault + + + + + + + + + + broken + workaround + fixed + + + + + + + + + + broken + workaround + fixed + + + + + + + + + + broken + workaround + fixed-ibs + fixed-ccd + fixed-na + + + + + + + + + + + pci + + + + + + + drive + + + + + + virtio-serial + + + + + + ccid + + + + + + usb + + + + + + spapr-vio + + + + + + ccw + + + + + + isa + + + + + + virtio-mmio + + + + + dimm + + + + + + unassigned + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dimm + nvdimm + + + + + + shared + private + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + virtio + virtio-transitional + virtio-non-transitional + + + + + + + + + + + + + + + + + + + + + + + + + + + + random + + + + + + + + + egd + + + + + + + builtin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9.\s]{1,8} + + + + + + + + + + + + + + + + + + + + + + copy + + + + + + + + + + + + + + + copy + active-commit + + + + + + + + + + + + + + yes + abort + pivot + + + + + + + + + + + + + + + + + + + + ceph + iscsi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [^,]{0,12} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (sync_pt|share_pt) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + allow + deny + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + netns + name + pid + + + + + + + + + + name + pid + + + + + + + + + + name + pid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [0-9]+ + 1 + + + + + [0-9]+ + + + + + [0-9]+ + + + + + [0-9]+ + 1000 + 1000000 + + + + + -?[0-9]+ + 18446744073709551 + -1 + + + + + -1 + + + + + + [0-9]+ + 100 + 1000 + + + + + [A-Za-z0-9_\.\+\- ]+ + + + + + (vepa|bridge|private|passthrough) + + + + + + + + + + + -1 + + + + + (0x)?[0-9a-fA-F]{1,4} + + + + + [0-9]{1,2}.[0-9]{1,2} + + + + + (0x)?[0-9a-fA-F]{1,3} + + + + + (0x)?[0-9a-fA-F]{1,2} + + + + + ((0x)?[0-9a-fA-F]{1,3}\.){0,3}(0x)?[0-9a-fA-F]{1,3} + + + + + [0-9]{1,2} + + + + + [0-9]{1,2} + + + + + [0-9]{1,2} + + + + + [0-9]{1,10} + + + + + [0-9]{1,5} + + + + + [0-9]{1,20} + + + + + (-|\+)?[0-9]+ + + + + + [a-zA-Z0-9_\.\+\-/]+ + + + + + (0x)?[0-9a-fA-F]{1,8} + + + + + [a-zA-Z0-9_\-.]+ + + + + + [0-9]{1,2} + + + + + [0-9]{1,2} + + + + + + + + + + + + + + + + isa + pseries + hyperv + s390 + + + + + + + + + + + + + + + + + + + + + + filtered + unfiltered + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/domainsnapshot.rng b/src/main/resources/libvirt/rng/domainsnapshot.rng new file mode 100644 index 0000000..58c3708 --- /dev/null +++ b/src/main/resources/libvirt/rng/domainsnapshot.rng @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + no + internal + + + + + + external + + + + + + + + + + + + + + + + + + + + + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + running + blocked + paused + shutdown + shutoff + crashed + disk-snapshot + + + + + + + + + + + + + + + + + + + no + + + internal + + + + + external + + + + + + + file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + block + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/interface.rng b/src/main/resources/libvirt/rng/interface.rng new file mode 100644 index 0000000..8c11f0d --- /dev/null +++ b/src/main/resources/libvirt/rng/interface.rng @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + ethernet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vlan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bridge + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bond + + + + + + + + + + + balance-rr + + active-backup + balance-xor + broadcast + 802.3ad + balance-tlb + balance-alb + + + + + + + + + + + + + + + + + + + + + + + + ioctl + + netif + + + + + + + + + + + none + active + backup + all + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + onboot + none + hotplug + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ipv4 + + + + + + + + + + + + + + + + + + + + + + + + + + ipv6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + 4095 + + + diff --git a/src/main/resources/libvirt/rng/network.rng b/src/main/resources/libvirt/rng/network.rng new file mode 100644 index 0000000..4317572 --- /dev/null +++ b/src/main/resources/libvirt/rng/network.rng @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nat + route + open + bridge + passthrough + private + vepa + hostdev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pci + + + + + + + + + + + + + + + + + + + + + + + kvm + vfio + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/networkcommon.rng b/src/main/resources/libvirt/rng/networkcommon.rng new file mode 100644 index 0000000..6df6d43 --- /dev/null +++ b/src/main/resources/libvirt/rng/networkcommon.rng @@ -0,0 +1,294 @@ + + + + + + + 39 + + + + + + + + + 802.1Qbg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 802.1Qbh + + + + + + + + + + + + + + + + openvswitch + + + + + + + + + + + + + + + + + + + + + midonet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [0-9]+ + 1 + + + + + [0-9]+ + 1 + + + + + + 0 + 65535 + + + + + (tcp)|(udp) + + + + + (ipv4)|(ipv6) + + + + + + + + yes + + + + + + + 4095 + + + + + + tagged + untagged + + + + + + + + + + + + 1 + 65535 + + + + + + + + + + + + + + + + + + + + + + + + + + kernel + libvirt + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/networkport.rng b/src/main/resources/libvirt/rng/networkport.rng new file mode 100644 index 0000000..1a12a32 --- /dev/null +++ b/src/main/resources/libvirt/rng/networkport.rng @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + network + + + + + + + + + + + + + + bridge + + + + + + + + + + + + + + direct + + + + + + + bridge + passthrough + private + vepa + + + + + + + hostdev-pci + + + + + + + + + + + kvm + vfio + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/nodedev.rng b/src/main/resources/libvirt/rng/nodedev.rng new file mode 100644 index 0000000..5840dc9 --- /dev/null +++ b/src/main/resources/libvirt/rng/nodedev.rng @@ -0,0 +1,765 @@ + + + + + + + + + + + + + + + + + + + dev + + + + + + + + link + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pci + + + + + + 0x[0-9a-fA-F]{6} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + phys_function + + + + + + + + + + + virt_functions + + + + + + + + + + + + + + + + + pci-bridge + cardbus-bridge + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cap + sta + + + + + + + + + + + [0-9]+(.[0-9]+)? + + + + + + + + + + + + + + + usb_device + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + usb + + + + + + + + + + + + + + + + + + + + + + + + + net + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z\-_]+ + + + + + + + + + + + + + + + 80203 + + + + + + 80211 + + + + + + fc_host + + + + + + + + + + + + + + + + + + + + vports_ops + + + + + + + + + + + + scsi_host + + + + + + + + + + + + + + + + + + + + + + + + + + + fc_remote_port + + + + + + + + + + + + + + scsi_target + + + + + + + + + + + + + + + + scsi + + + + + + + + + + + + + + + + + + + + + + + storage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hotpluggable + + + + + + + + + removable + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + drm + + + + primary + control + render + + + + + + + mdev + + + + + + + + + + + + + + + + + + + + + + + + ccw + + + + + + + + + + + + + + + css + + + + + + + + + + + + + + + + + + vdpa + + + + + + + + + ap_card + + + + + + + + + ap_queue + + + + + + + + + + + + ap_matrix + + + + + + + + + + + + + + + + + + ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} + + + + + + /[a-zA-Z0-9_\+\-/%]+ + + + + + + + mdev_types + + + + + + + + + + + + vfio-pci + vfio-ccw + vfio-ap + + + + + + + + + + + + + + 0x[0-9a-fA-F]{1,4} + + + 0 + 255 + + + + + diff --git a/src/main/resources/libvirt/rng/nwfilter.rng b/src/main/resources/libvirt/rng/nwfilter.rng new file mode 100644 index 0000000..a75de7e --- /dev/null +++ b/src/main/resources/libvirt/rng/nwfilter.rng @@ -0,0 +1,986 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + root + + mac[a-zA-Z0-9_\.:\-]{0,9} + + + stp[a-zA-Z0-9_\.:\-]{0,9} + + + vlan[a-zA-Z0-9_\.:\-]{0,8} + + + arp[a-zA-Z0-9_\.:\-]{0,9} + + + rarp[a-zA-Z0-9_\.:\-]{0,8} + + + ipv4[a-zA-Z0-9_\.:\-]{0,8} + + + ipv6[a-zA-Z0-9_\.:\-]{0,8} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $[ ]*[a-zA-Z0-9_]+(\[[ ]*[@]?[0-9]+[ ]*\])?[ ]* + + + + + + + + + ([a-fA-F0-9]{1,2}:){5}[a-fA-F0-9]{1,2} + + + + + + + + + + ([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9] + + + + + + + + + + ([a-fA-F0-9]{0,4}:){2,7}([a-fA-F0-9]*)(([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9])? + + + + + + + + + + 0 + 32 + + + + ([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9] + + + + + + + + + + 0 + 128 + + + + ([a-fA-F0-9]{0,4}:){2,7}([a-fA-F0-9]*) + + + + + + + + 0x([0-3][0-9a-fA-F]|[0-9a-fA-F]) + + + + + + 0 + 63 + + + + + + + + + + 0x([6-9a-fA-F][0-9a-fA-F]{2}|[0-9a-fA-F]{4}) + + + + 1536 + 65535 + + + + arp + rarp + ipv4 + ipv6 + vlan + + + + + + + + + + 0x([0-9a-fA-F]{1,3}) + + + + 0 + 4095 + + + + + + + + + + 0x[0-9a-fA-F]{1,4} + + + + 0 + 65535 + + + + + + + + + + 0x[0-9a-fA-F]{1,8} + + + + + + + + + yes + no + true + false + 1 + 0 + + + + + + + + + 0 + 65535 + + + + ([Rr]eply|[Rr]equest|[Rr]equest_[Rr]everse|[Rr]eply_[Rr]everse|DRARP_[Rr]equest|DRARP_[Rr]eply|DRARP_[Ee]rror|InARP_[Rr]equest|ARP_NAK) + + + + + + + + + + + 0x[0-9a-fA-F]{1,2} + + + + 0 + 255 + + + + tcp + udp + udplite + esp + ah + icmp + igmp + sctp + icmpv6 + + + + + + + drop + accept + reject + continue + return + + + + + + in + out + inout + + + + + + -1000 + 1000 + + + + + ([Ff][Aa][Ll][Ss][Ee]|0) + + + + + + + + + + ((NEW|ESTABLISHED|RELATED|INVALID)(,(NEW|ESTABLISHED|RELATED|INVALID))*|NONE) + + + + + + ((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE)/((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE) + + + + + + + + [a-zA-Z0-9_\.:\-\+ ]{1,31} + + + + + + + ([Ss][Rr][Cc]|[Dd][Ss][Tt])(,([Ss][Rr][Cc]|[Dd][Ss][Tt])){0,5} + + + diff --git a/src/main/resources/libvirt/rng/nwfilter_params.rng b/src/main/resources/libvirt/rng/nwfilter_params.rng new file mode 100644 index 0000000..a3e7b35 --- /dev/null +++ b/src/main/resources/libvirt/rng/nwfilter_params.rng @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9_]+ + + + + + [a-zA-Z0-9_\.:]+ + + + + diff --git a/src/main/resources/libvirt/rng/nwfilterbinding.rng b/src/main/resources/libvirt/rng/nwfilterbinding.rng new file mode 100644 index 0000000..a0a956e --- /dev/null +++ b/src/main/resources/libvirt/rng/nwfilterbinding.rng @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/secret.rng b/src/main/resources/libvirt/rng/secret.rng new file mode 100644 index 0000000..c90e2eb --- /dev/null +++ b/src/main/resources/libvirt/rng/secret.rng @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + volume + + + + + + + + + ceph + + + + + + + + + iscsi + + + + + + + + + tls + + + + + + + + + vtpm + + + + + + + diff --git a/src/main/resources/libvirt/rng/storagecommon.rng b/src/main/resources/libvirt/rng/storagecommon.rng new file mode 100644 index 0000000..e3d08a8 --- /dev/null +++ b/src/main/resources/libvirt/rng/storagecommon.rng @@ -0,0 +1,238 @@ + + + + + + + + + + + default + qcow + luks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + unix + + + + + + + server + client + + + + + + + + + + + + + + + + + + + + + + + + + + passphrase + + + + + + + + + + + + + + + + [0-9]+\.[0-9]+ + + + + + + + + + + + + + + + + + + + cow + qcow + qcow2 + qed + vmdk + + + + + raw + dir + bochs + cloop + dmg + iso + vpc + vdi + fat + vhd + ploop + luks + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + capacity + + + + diff --git a/src/main/resources/libvirt/rng/storagepool.rng b/src/main/resources/libvirt/rng/storagepool.rng new file mode 100644 index 0000000..bd24b8b --- /dev/null +++ b/src/main/resources/libvirt/rng/storagepool.rng @@ -0,0 +1,788 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dir + + + + + + + + + + + + + fs + + + + + + + + + + + + + + + + netfs + + + + + + + + + + + + + + + + logical + + + + + + + + + + + + + disk + + + + + + + + + + + + + iscsi + + + + + + + + + + + + + iscsi-direct + + + + + + + + + + + + + + scsi + + + + + + + + + + + + + mpath + + + + + + + + + + + + + + + rbd + + + + + + + + + + + + + + + + sheepdog + + + + + + + + + + + + gluster + + + + + + + + + + + + zfs + + + + + + + + + + + + + + + vstorage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + chap + ceph + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auto + ext2 + ext3 + ext4 + ufs + iso9660 + udf + gfs + gfs2 + vfat + hfs+ + xfs + ocfs2 + vmfs + + + + + + + + + + + + + auto + nfs + + + + + + + + + + + + + unknown + dos + dvh + gpt + mac + bsd + pc98 + sun + lvm2 + + + + + + + + + + + + + + + + unknown + lvm2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cifs + glusterfs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + iqn\.[0-9]{4}-(0[1-9]|1[0-2])\.[a-zA-Z0-9\.\-]+(:.+)? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/storagepoolcaps.rng b/src/main/resources/libvirt/rng/storagepoolcaps.rng new file mode 100644 index 0000000..ec65fba --- /dev/null +++ b/src/main/resources/libvirt/rng/storagepoolcaps.rng @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/libvirt/rng/storagevol.rng b/src/main/resources/libvirt/rng/storagevol.rng new file mode 100644 index 0000000..22ce5ea --- /dev/null +++ b/src/main/resources/libvirt/rng/storagevol.rng @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + file + block + dir + network + netdir + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [0-9]+(\.[0-9]{0,9})? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + none + auto + ext2 + ext3 + ext4 + ufs + iso9660 + udf + gfs + gfs2 + vfat + hfs+ + xfs + ocfs2 + vmfs + + + + + + unknown + + + + + + + none + linux + fat16 + fat32 + linux-swap + linux-lvm + linux-raid + extended + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-55-g7522 From 706910e440527c22f176bcab0032c37c60357c25 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 29 Jan 2021 12:25:44 +0100 Subject: Add support for QEMU VMs (based on Libvirt domain XML documents) --- pom.xml | 27 +- src/main/java/org/openslx/util/vm/DiskImage.java | 35 + .../org/openslx/util/vm/DockerMetaDataDummy.java | 16 + .../java/org/openslx/util/vm/QemuMetaData.java | 796 ++++++++++++++++++--- .../org/openslx/util/vm/QemuMetaDataUtils.java | 188 +++++ .../java/org/openslx/util/vm/VboxMetaData.java | 14 + src/main/java/org/openslx/util/vm/VmMetaData.java | 9 +- .../java/org/openslx/util/vm/VmwareMetaData.java | 16 +- .../libvirt/xsl/xml-output-transformation.xsl | 12 + .../java/org/openslx/util/vm/QemuMetaDataTest.java | 466 ++++++++++++ 10 files changed, 1487 insertions(+), 92 deletions(-) create mode 100644 src/main/java/org/openslx/util/vm/QemuMetaDataUtils.java create mode 100644 src/main/resources/libvirt/xsl/xml-output-transformation.xsl create mode 100644 src/test/java/org/openslx/util/vm/QemuMetaDataTest.java (limited to 'src/main/resources') diff --git a/pom.xml b/pom.xml index 6daf903..4b8b3dc 100644 --- a/pom.xml +++ b/pom.xml @@ -82,11 +82,21 @@ 3.0.0-M5 + + + ${basedir}/src/main/resources + + libvirt/rng/* + libvirt/xsl/* + + + ${basedir}/src/test/resources disk/* + libvirt/xml/* @@ -111,6 +121,12 @@ 5.5.2 test + + org.junit.jupiter + junit-jupiter-params + 5.5.2 + test + log4j log4j @@ -140,9 +156,14 @@ 2.8.0 - com.google.jimfs - jimfs - 1.1 + xalan + xalan + 2.7.2 + + + org.relaxng + jing + 20181222 diff --git a/src/main/java/org/openslx/util/vm/DiskImage.java b/src/main/java/org/openslx/util/vm/DiskImage.java index 1602926..617fadd 100644 --- a/src/main/java/org/openslx/util/vm/DiskImage.java +++ b/src/main/java/org/openslx/util/vm/DiskImage.java @@ -5,6 +5,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.Virtualizer; @@ -318,7 +320,40 @@ public class DiskImage } throw new UnknownImageFormatException(); } + + /** + * Creates new disk image and checks if image is supported by hypervisor's image formats. + * + * @param disk file to a disk storing the virtual machine content. + * @param supportedImageTypes list of supported image types of a hypervisor's image format. + * @throws FileNotFoundException cannot find virtual machine image file. + * @throws IOException cannot access the virtual machine image file. + * @throws UnknownImageFormatException virtual machine image file has an unknown image format. + */ + public DiskImage( File disk, List supportedImageTypes ) + throws FileNotFoundException, IOException, UnknownImageFormatException + { + this( disk ); + if ( !this.isSupportedByHypervisor( supportedImageTypes ) ) { + throw new UnknownImageFormatException(); + } + } + + /** + * Checks if image format is supported by a list of supported hypervisor image formats. + * + * @param supportedImageTypes list of supported image types of a hypervisor. + * @return true if image type is supported by the hypervisor; otherwise + * false. + */ + public boolean isSupportedByHypervisor( List supportedImageTypes ) + { + Predicate matchDiskFormat = supportedImageType -> supportedImageType.toString() + .equalsIgnoreCase( this.getImageFormat().toString() ); + return supportedImageTypes.stream().anyMatch( matchDiskFormat ); + } + private int findNull( byte[] buffer ) { for ( int i = 0; i < buffer.length; ++i ) { diff --git a/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java b/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java index 3ee964f..9698c52 100644 --- a/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java +++ b/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java @@ -3,13 +3,23 @@ package org.openslx.util.vm; import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.Virtualizer; import org.openslx.thrifthelper.TConst; +import org.openslx.util.vm.DiskImage.ImageFormat; import java.io.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; public class DockerMetaDataDummy extends VmMetaData { // TODO Define DOCKER CONSTANT + /** + * List of supported image formats by the Docker hypervisor. + */ + private static final List SUPPORTED_IMAGE_FORMATS = Collections.unmodifiableList( + Arrays.asList( ImageFormat.DOCKER ) ); + private static final Logger LOGGER = Logger.getLogger( DockerMetaDataDummy.class); private final Virtualizer virtualizer = new Virtualizer( TConst.VIRT_DOCKER, "Docker" ); @@ -41,6 +51,12 @@ public class DockerMetaDataDummy extends VmMetaData { @Override public byte[] getFilteredDefinitionArray() { return dockerfile; } + + @Override + public List getSupportedImageFormats() + { + return DockerMetaDataDummy.SUPPORTED_IMAGE_FORMATS; + } @Override public void applySettingsForLocalEdit() { diff --git a/src/main/java/org/openslx/util/vm/QemuMetaData.java b/src/main/java/org/openslx/util/vm/QemuMetaData.java index 201ffd8..1e5dd33 100644 --- a/src/main/java/org/openslx/util/vm/QemuMetaData.java +++ b/src/main/java/org/openslx/util/vm/QemuMetaData.java @@ -1,233 +1,855 @@ package org.openslx.util.vm; import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; +import java.math.BigInteger; import java.nio.charset.StandardCharsets; -import java.util.HashMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; -import java.util.Map; +import java.util.Map.Entry; import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.bwlp.thrift.iface.Virtualizer; +import org.openslx.libvirt.domain.Domain; +import org.openslx.libvirt.domain.device.ControllerUsb; +import org.openslx.libvirt.domain.device.Disk.BusType; +import org.openslx.libvirt.domain.device.Disk.StorageType; +import org.openslx.libvirt.domain.device.DiskCdrom; +import org.openslx.libvirt.domain.device.DiskFloppy; +import org.openslx.libvirt.domain.device.DiskStorage; +import org.openslx.libvirt.domain.device.Graphics; +import org.openslx.libvirt.domain.device.GraphicsSpice; +import org.openslx.libvirt.domain.device.Interface; +import org.openslx.libvirt.domain.device.Sound; +import org.openslx.libvirt.domain.device.Video; +import org.openslx.libvirt.xml.LibvirtXmlDocumentException; +import org.openslx.libvirt.xml.LibvirtXmlSerializationException; +import org.openslx.libvirt.xml.LibvirtXmlValidationException; import org.openslx.thrifthelper.TConst; import org.openslx.util.vm.DiskImage.ImageFormat; -import org.openslx.util.vm.DiskImage.UnknownImageFormatException; -public class QemuMetaData extends VmMetaData +/** + * Metadata to describe the hardware type of a QEMU sound card. + * + * @author Manuel Bentele + * @version 1.0 + */ +class QemuSoundCardMeta { + /** + * Stores the hardware model of the QEMU sound card. + */ + private final Sound.Model model; + + /** + * Creates metadata to describe the hardware model of a QEMU sound card. + * + * @param model hardware model of the QEMU sound card. + */ + public QemuSoundCardMeta( Sound.Model model ) + { + this.model = model; + } - private final Map arguments = new HashMap(); - // the above map's elements will take the place of in the config string - private String config; - private static final Logger LOGGER = Logger.getLogger( QemuMetaData.class ); + /** + * Returns hardware model of the QEMU sound card. + * + * @return hardware model of the QEMU sound card. + */ + public Sound.Model getModel() + { + return this.model; + } +} - private static final Virtualizer virtualizer = new Virtualizer( TConst.VIRT_QEMU, "QEMU-KVM" ); +/** + * Metadata to describe the hardware acceleration state of QEMU virtual graphics. + * + * @author Manuel Bentele + * @version 1.0 + */ +class QemuDDAccelMeta +{ + /** + * Stores state of the hardware acceleration for QEMU virtual graphics. + */ + private final boolean enabled; + + /** + * Creates metadata to describe the hardware acceleration state of QEMU virtual graphics. + * + * @param enabled state of the hardware acceleration for QEMU virtual graphics. + */ + public QemuDDAccelMeta( boolean enabled ) + { + this.enabled = enabled; + } - public QemuMetaData( List osList, File file ) throws FileNotFoundException, IOException, UnsupportedVirtualizerFormatException + /** + * Returns state of the hardware acceleration of QEMU virtual graphics. + * + * @return state of the hardware acceleration for QEMU virtual graphics. + */ + public boolean isEnabled() + { + return this.enabled; + } +} + +/** + * Metadata to describe the version of a QEMU virtual machine configuration. + * + * @author Manuel Bentele + * @version 1.0 + */ +class QemuHWVersionMeta +{ + /** + * Stores the version of a QEMU virtual machine configuration. + */ + private final int version; + + /** + * Creates metadata to describe the version of a QEMU virtual machine configuration. + * + * @param version version of the QEMU virtual machine configuration. + */ + public QemuHWVersionMeta( int version ) + { + this.version = version; + } + + /** + * Returns version of the QEMU virtual machine configuration. + * + * @return version of the QEMU virtual machine configuration. + */ + public int getVersion() + { + return this.version; + } +} + +/** + * Metadata to describe the hardware type of a QEMU ethernet device. + * + * @author Manuel Bentele + * @version 1.0 + */ +class QemuEthernetDevTypeMeta +{ + /** + * Stores the hardware model of the QEMU ethernet device. + */ + private final Interface.Model model; + + /** + * Creates metadata to describe the hardware type of a QEMU ethernet device. + * + * @param model hardware type of the QEMU ethernet device. + */ + public QemuEthernetDevTypeMeta( Interface.Model model ) + { + this.model = model; + } + + /** + * Returns the hardware type of a QEMU ethernet device. + * + * @return hardware type of the QEMU ethernet device. + */ + public Interface.Model getModel() + { + return this.model; + } +} + +/** + * Metadata to describe a QEMU USB controller. + * + * @author Manuel Bentele + * @version 1.0 + */ +class QemuUsbSpeedMeta +{ + /** + * Stores the USB speed of the QEMU USB controller. + */ + private final int speed; + + /** + * Stores the QEMU hardware model of the USB controller. + */ + private final ControllerUsb.Model model; + + /** + * Creates metadata to describe a QEMU USB controller. + * + * @param speed USB speed of the QEMU USB controller. + * @param model QEMU hardware model of the USB controller. + */ + public QemuUsbSpeedMeta( int speed, ControllerUsb.Model model ) + { + this.speed = speed; + this.model = model; + } + + /** + * Returns the speed of the QEMU USB controller. + * + * @return speed of the QEMU USB controller. + */ + public int getSpeed() + { + return this.speed; + } + + /** + * Returns QEMU hardware model of the USB controller. + * + * @return hardware model of the QEMU USB controller. + */ + public ControllerUsb.Model getModel() + { + return this.model; + } +} + +/** + * Virtual machine configuration (managed by Libvirt) for the QEMU hypervisor. + * + * @author Manuel Bentele + * @version 1.0 + */ +public class QemuMetaData extends + VmMetaData +{ + /** + * Default bridge name of the network bridge connected to the LAN. + */ + public static final String NETWORK_DEFAULT_BRIDGE = "brBwLehrpool"; + + /** + * Default network name of the isolated host network (host only). + */ + public static final String NETWORK_DEFAULT_HOST_ONLY = "host"; + + /** + * Default network name of the NAT network. + */ + public static final String NETWORK_DEFAULT_NAT = "nat"; + + /** + * Default physical CDROM drive of the hypervisor host. + */ + public static final String CDROM_DEFAULT_PHYSICAL_DRIVE = "/dev/sr0"; + + /** + * List of supported image formats by the QEMU hypervisor. + */ + private static final List SUPPORTED_IMAGE_FORMATS = Collections.unmodifiableList( + Arrays.asList( ImageFormat.QCOW2, ImageFormat.VMDK, ImageFormat.VDI ) ); + + /** + * Representation of a QEMU hypervisor (managed by Libvirt). + */ + private static final Virtualizer VIRTUALIZER = new Virtualizer( TConst.VIRT_QEMU, "QEMU" ); + + /** + * Libvirt XML configuration file to modify configuration of virtual machine for QEMU. + */ + private Domain vmConfig = null; + + /** + * Stores current index of added HDD device to the Libvirt XML configuration file. + */ + private int vmDeviceIndexHddAdd = 0; + + /** + * Stores current index of added CDROM device to the Libvirt XML configuration file. + */ + private int vmDeviceIndexCdromAdd = 0; + + /** + * Stores current index of added ethernet device to the Libvirt XML configuration file. + */ + private int vmDeviceIndexEthernetAdd = 0; + + /** + * Creates new virtual machine configuration (managed by Libvirt) for the QEMU hypervisor. + * + * @param osList list of operating systems. + * @param file image file for the QEMU hypervisor. + * @throws UnsupportedVirtualizerFormatException Libvirt XML configuration cannot be processed. + */ + public QemuMetaData( List osList, File file ) throws UnsupportedVirtualizerFormatException { super( osList ); - DiskImage di; + try { - di = new DiskImage( file ); - } catch ( UnknownImageFormatException e ) { - di = null; + // read and parse Libvirt domain XML configuration document + this.vmConfig = new Domain( file ); + } catch ( LibvirtXmlDocumentException e ) { + throw new UnsupportedVirtualizerFormatException( e.getLocalizedMessage() ); + } catch ( LibvirtXmlSerializationException e ) { + throw new UnsupportedVirtualizerFormatException( e.getLocalizedMessage() ); + } catch ( LibvirtXmlValidationException e ) { + throw new UnsupportedVirtualizerFormatException( e.getLocalizedMessage() ); } - if ( di == null || di.format != ImageFormat.QCOW2 ) { - throw new UnsupportedVirtualizerFormatException( "This is not a qcow2 disk image" ); + + // register virtual hardware models for graphical editing of virtual devices (GPU, sound, USB, ...) + this.registerVirtualHW(); + + // set display name of VM + this.displayName = vmConfig.getName(); + + // this property cannot be checked with the Libvirt domain XML configuration + // to check if machine is in a paused/suspended state, look in the QEMU qcow2 image for snapshots and machine states + this.isMachineSnapshot = false; + + // add HDDs, SSDs to QEMU metadata + for ( DiskStorage storageDiskDevice : this.vmConfig.getDiskStorageDevices() ) { + this.addHddMetaData( storageDiskDevice ); } - config = "qemu-system-i386 -enable-kvm\nqemu-system-x86_64 -enable-kvm"; - displayName = file.getName().substring( 0, file.getName().indexOf( "." ) ); - setOs( "anyOs" ); - hdds.add( new HardDisk( "anychipset", DriveBusType.IDE, file.getAbsolutePath() ) ); - makeStartSequence(); } - // initiates the arguments map with a default working sequence that will later be used in the definition array - public void makeStartSequence() + /** + * Adds an existing and observed storage disk device to the HDD metadata. + * + * @param storageDiskDevice existing and observed storage disk that should be added to the + * metadata. + */ + private void addHddMetaData( DiskStorage storageDiskDevice ) { - arguments.put( "cpu", "host" ); - arguments.put( "smp", "2" ); - arguments.put( "m", "1024" ); - arguments.put( "vga", "std" ); + String hddChipsetModel = null; + DriveBusType hddChipsetBus = QemuMetaDataUtils.convertBusType( storageDiskDevice.getBusType() ); + String hddImagePath = storageDiskDevice.getStorageSource(); + + this.hdds.add( new HardDisk( hddChipsetModel, hddChipsetBus, hddImagePath ) ); } - private String configWithArgs() + @Override + public byte[] getFilteredDefinitionArray() { - String tempString = ""; - for ( String key : arguments.keySet() ) { - tempString += "-" + key + " " + arguments.get( key ) + " "; - } - return config.replaceAll( "", tempString ); + // remove UUID in Libvirt domain XML configuration + this.vmConfig.removeUuid(); + + // removes all specified boot order entries + this.vmConfig.removeBootOrder(); + + // removes all referenced storage files of all specified CDROMs, Floppy drives and HDDs + this.vmConfig.removeDiskDevicesStorage(); + + // removes all source networks of all specified network interfaces + this.vmConfig.removeInterfaceDevicesSource(); + + // output filtered Libvirt domain XML configuration + String configuration = this.vmConfig.toString(); + return configuration.getBytes( StandardCharsets.UTF_8 ); } @Override - public byte[] getFilteredDefinitionArray() + public List getSupportedImageFormats() { - return configWithArgs().getBytes( StandardCharsets.UTF_8 ); + return QemuMetaData.SUPPORTED_IMAGE_FORMATS; } @Override public void applySettingsForLocalEdit() { + // NOT implemented yet } @Override public boolean addHddTemplate( File diskImage, String hddMode, String redoDir ) { - String tempS = config.replaceAll( "", diskImage.getAbsolutePath() ); - config = tempS; - hdds.add( new HardDisk( "anychipset", DriveBusType.IDE, diskImage.getAbsolutePath() ) ); - return true; + return this.addHddTemplate( diskImage.getAbsolutePath(), hddMode, redoDir ); } @Override public boolean addHddTemplate( String diskImagePath, String hddMode, String redoDir ) { - String tempS = config.replaceAll( "", diskImagePath ); - config = tempS; - hdds.add( new HardDisk( "anychipset", DriveBusType.IDE, diskImagePath ) ); - return true; + return this.addHddTemplate( this.vmDeviceIndexHddAdd++, diskImagePath, hddMode, redoDir ); + } + + /** + * Adds hard disk drive (HDD) to the QEMU virtual machine configuration. + * + * @param index current index of HDD to be added to the virtual machine configuration. + * @param diskImagePath path to the virtual disk image for the HDD. + * @param hddMode operation mode of the HDD. + * @param redoDir directory for the redo log if an independent non-persistent + * hddMode is set. + * @return result state of adding the HDD. + */ + public boolean addHddTemplate( int index, String diskImagePath, String hddMode, String redoDir ) + { + ArrayList storageDiskDevices = this.vmConfig.getDiskStorageDevices(); + DiskStorage storageDiskDevice = QemuMetaDataUtils.getArrayIndex( storageDiskDevices, index ); + + if ( storageDiskDevice == null ) { + // HDD does not exist, so create new storage (HDD) device + storageDiskDevice = this.vmConfig.addDiskStorageDevice(); + storageDiskDevice.setReadOnly( false ); + storageDiskDevice.setBusType( BusType.VIRTIO ); + String targetDevName = QemuMetaDataUtils.createAlphabeticalDeviceName( "vd", index ); + storageDiskDevice.setTargetDevice( targetDevName ); + storageDiskDevice.setStorage( StorageType.FILE, diskImagePath ); + + // add new created HDD to the metadata of the QemuMetaData object, too + this.addHddMetaData( storageDiskDevice ); + } else { + // HDD exists, so update existing storage (HDD) device + storageDiskDevice.setStorage( StorageType.FILE, diskImagePath ); + } + + return false; } @Override public boolean addDefaultNat() { - return true; + return this.addEthernet( EtherType.NAT ); } @Override public void setOs( String vendorOsId ) { - setOs( TConst.VIRT_QEMU, vendorOsId ); + this.setOs( vendorOsId ); } @Override public boolean addDisplayName( String name ) { - // TODO Auto-generated method stub - return false; + this.vmConfig.setName( name ); + + final boolean statusName = this.vmConfig.getName().equals( name ); + + return statusName; } @Override public boolean addRam( int mem ) { - this.arguments.put( "m", Integer.toString( mem ) ); - return true; + BigInteger memory = BigInteger.valueOf( mem ); + + this.vmConfig.setMemory( memory ); + this.vmConfig.setCurrentMemory( memory ); + + final boolean isMemorySet = this.vmConfig.getMemory().toString().equals( memory.toString() ); + final boolean isCurrentMemorySet = this.vmConfig.getCurrentMemory().toString().equals( memory.toString() ); + + return isMemorySet && isCurrentMemorySet; } @Override public void addFloppy( int index, String image, boolean readOnly ) { - // TODO Auto-generated method stub - + ArrayList floppyDiskDevices = this.vmConfig.getDiskFloppyDevices(); + DiskFloppy floppyDiskDevice = QemuMetaDataUtils.getArrayIndex( floppyDiskDevices, index ); + + if ( floppyDiskDevice == null ) { + // floppy device does not exist, so create new floppy device + floppyDiskDevice = this.vmConfig.addDiskFloppyDevice(); + floppyDiskDevice.setBusType( BusType.FDC ); + String targetDevName = QemuMetaDataUtils.createAlphabeticalDeviceName( "fd", index ); + floppyDiskDevice.setTargetDevice( targetDevName ); + floppyDiskDevice.setReadOnly( readOnly ); + floppyDiskDevice.setStorage( StorageType.FILE, image ); + } else { + // floppy device exists, so update existing floppy device + floppyDiskDevice.setReadOnly( readOnly ); + floppyDiskDevice.setStorage( StorageType.FILE, image ); + } } @Override public boolean addCdrom( String image ) { - // TODO Auto-generated method stub + return this.addCdrom( this.vmDeviceIndexCdromAdd++, image ); + } + + /** + * Adds CDROM drive to the QEMU virtual machine configuration. + * + * @param index current index of CDROM drive to be added to the virtual machine configuration. + * @param image path to a virtual image that will be inserted as CDROM into the drive. + * @return result state of adding the CDROM drive. + */ + public boolean addCdrom( int index, String image ) + { + ArrayList cdromDiskDevices = this.vmConfig.getDiskCdromDevices(); + DiskCdrom cdromDiskDevice = QemuMetaDataUtils.getArrayIndex( cdromDiskDevices, index ); + + if ( cdromDiskDevice == null ) { + // CDROM device does not exist, so create new CDROM device + cdromDiskDevice = this.vmConfig.addDiskCdromDevice(); + cdromDiskDevice.setBusType( BusType.SATA ); + String targetDevName = QemuMetaDataUtils.createAlphabeticalDeviceName( "sd", index ); + cdromDiskDevice.setTargetDevice( targetDevName ); + cdromDiskDevice.setReadOnly( true ); + + if ( image == null ) { + cdromDiskDevice.setStorage( StorageType.BLOCK, CDROM_DEFAULT_PHYSICAL_DRIVE ); + } else { + cdromDiskDevice.setStorage( StorageType.FILE, image ); + } + } else { + // CDROM device exists, so update existing CDROM device + cdromDiskDevice.setReadOnly( true ); + + if ( image == null ) { + cdromDiskDevice.setStorage( StorageType.BLOCK, CDROM_DEFAULT_PHYSICAL_DRIVE ); + } else { + cdromDiskDevice.setStorage( StorageType.FILE, image ); + } + } + return false; } @Override public boolean addCpuCoreCount( int nrOfCores ) { - this.arguments.put( "smp", Integer.toString( nrOfCores ) ); - return true; + this.vmConfig.setVCpu( nrOfCores ); + + boolean isVCpuSet = this.vmConfig.getVCpu() == nrOfCores; + + return isVCpuSet; } @Override - public void setSoundCard( VmMetaData.SoundCardType type ) + public void setSoundCard( SoundCardType type ) { + QemuSoundCardMeta soundDeviceConfig = this.soundCards.get( type ); + ArrayList soundDevices = this.vmConfig.getSoundDevices(); + Sound.Model soundDeviceModel = soundDeviceConfig.getModel(); + + if ( soundDevices.isEmpty() ) { + // create new sound device with 'soundDeviceModel' hardware + Sound soundDevice = this.vmConfig.addSoundDevice(); + soundDevice.setModel( soundDeviceModel ); + } else { + // update sound device model type of existing sound devices + for ( Sound soundDevice : soundDevices ) { + soundDevice.setModel( soundDeviceModel ); + } + } } @Override - public VmMetaData.SoundCardType getSoundCard() + public SoundCardType getSoundCard() { - return null; + ArrayList soundDevices = this.vmConfig.getSoundDevices(); + SoundCardType soundDeviceType = SoundCardType.DEFAULT; + + if ( soundDevices.isEmpty() ) { + // the VM configuration does not contain a sound card device + soundDeviceType = SoundCardType.NONE; + } else { + // the VM configuration at least one sound card device, so return the type of the first one + Sound.Model soundDeviceModel = soundDevices.get( 0 ).getModel(); + soundDeviceType = QemuMetaDataUtils.convertSoundDeviceModel( soundDeviceModel ); + } + + return soundDeviceType; } @Override - public void setDDAcceleration( VmMetaData.DDAcceleration type ) + public void setDDAcceleration( DDAcceleration type ) { + QemuDDAccelMeta accelerationConfig = this.ddacc.get( type ); + ArrayList graphicDevices = this.vmConfig.getGraphicDevices(); + ArrayList