osbuild: filesystem is not required member of qemu assembler

The input options of qemu assembler do not require filesystem for every
partition. This patch makes it optional and omits the object in case it
is empty.

osbuild schema definition:
162797f206/assemblers/org.osbuild.qemu (L63)
This commit is contained in:
Martin Sehnoutka 2020-06-05 10:02:36 +02:00 committed by Tom Gundersen
parent 673e967b2d
commit 7979a705b6
5 changed files with 16 additions and 16 deletions

View file

@ -647,7 +647,7 @@ func qemuAssembler(format string, filename string, uefi bool, size uint64) *osbu
Size: 972800,
Type: "c12a7328-f81f-11d2-ba4b-00a0c93ec93b",
UUID: "02C1E068-1D2F-4DA3-91FD-8DD76A955C9D",
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "vfat",
UUID: "46BB-8120",
Label: "EFI System Partition",
@ -657,7 +657,7 @@ func qemuAssembler(format string, filename string, uefi bool, size uint64) *osbu
{
Start: 976896,
UUID: "8D760010-FAAE-46D1-9E5B-4A2EAC5030CD",
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "ext4",
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Mountpoint: "/",
@ -676,7 +676,7 @@ func qemuAssembler(format string, filename string, uefi bool, size uint64) *osbu
{
Start: 2048,
Bootable: true,
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "ext4",
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Mountpoint: "/",

View file

@ -493,7 +493,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
Size: 972800,
Type: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
UUID: "02C1E068-1D2F-4DA3-91FD-8DD76A955C9D",
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "vfat",
UUID: "46BB-8120",
Label: "EFI System Partition",
@ -503,7 +503,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
{
Start: 976896,
UUID: "8D760010-FAAE-46D1-9E5B-4A2EAC5030CD",
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "ext4",
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Mountpoint: "/",
@ -522,7 +522,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
{
Start: 2048,
Bootable: true,
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "ext4",
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Mountpoint: "/",

View file

@ -499,7 +499,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
Start: 2048,
Size: 972800,
Type: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "vfat",
UUID: "46BB-8120",
Label: "EFI System Partition",
@ -508,7 +508,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
},
{
Start: 976896,
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "xfs",
UUID: "0bd700f8-090f-4556-b797-b340297ea1bd",
Mountpoint: "/",
@ -527,7 +527,7 @@ func qemuAssembler(format string, filename string, uefi bool, imageOptions distr
{
Start: 2048,
Bootable: true,
Filesystem: osbuild.QEMUFilesystem{
Filesystem: &osbuild.QEMUFilesystem{
Type: "xfs",
UUID: "0bd700f8-090f-4556-b797-b340297ea1bd",
Mountpoint: "/",

View file

@ -58,7 +58,7 @@ func TestAssembler_UnmarshalJSON(t *testing.T) {
Partitions: []QEMUPartition{QEMUPartition{
Start: 2048,
Bootable: true,
Filesystem: QEMUFilesystem{
Filesystem: &QEMUFilesystem{
Type: "ext4",
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
Label: "root",

View file

@ -17,12 +17,12 @@ type QEMUAssemblerOptions struct {
}
type QEMUPartition struct {
Start uint64 `json:"start"`
Size uint64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
Bootable bool `json:"bootable,omitempty"`
UUID string `json:"uuid,omitempty"`
Filesystem QEMUFilesystem `json:"filesystem"`
Start uint64 `json:"start"`
Size uint64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
Bootable bool `json:"bootable,omitempty"`
UUID string `json:"uuid,omitempty"`
Filesystem *QEMUFilesystem `json:"filesystem,omitempty"`
}
type QEMUFilesystem struct {