cloudapi: validate Disk customization before returining

After converting a Disk customization from the API type to the Blueprint
equivalent, run the validator and return an error if it fails to
validate.
The schema doesn't catch all invalid cases, such as the mountpoint being
required when the fs_type is not "swap", so calling the validator
ensures that any such cases are caught without needing to duplicate the
checks.
This commit is contained in:
Achilleas Koutsou 2025-06-03 17:20:51 +02:00 committed by Tomáš Hozza
parent ea0b5e8661
commit 45929efbcf

View file

@ -1433,7 +1433,7 @@ func convertDiskCustomizations(disk *Disk) (*blueprint.DiskCustomization, error)
}
bpDisk.Partitions = append(bpDisk.Partitions, bpPartition)
}
return bpDisk, nil
return bpDisk, bpDisk.Validate()
}
func decodeMinsize(size *Minsize) (uint64, error) {