Delete internal/blueprint/ and import from osbuild/blueprint
Import osbuild/blueprint v1.6.0
This commit is contained in:
parent
362712a71d
commit
cf956ff5a6
93 changed files with 2300 additions and 4163 deletions
44
vendor/github.com/osbuild/images/pkg/disk/lvm.go
generated
vendored
44
vendor/github.com/osbuild/images/pkg/disk/lvm.go
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
|
@ -13,10 +14,10 @@ import (
|
|||
const LVMDefaultExtentSize = 4 * datasizes.MebiByte
|
||||
|
||||
type LVMVolumeGroup struct {
|
||||
Name string
|
||||
Description string
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
|
||||
LogicalVolumes []LVMLogicalVolume
|
||||
LogicalVolumes []LVMLogicalVolume `json:"logical_volumes,omitempty" yaml:"logical_volumes,omitempty"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -174,10 +175,20 @@ func (vg *LVMVolumeGroup) minSize(size uint64) uint64 {
|
|||
return vg.AlignUp(size)
|
||||
}
|
||||
|
||||
func (vg *LVMVolumeGroup) UnmarshalJSON(data []byte) error {
|
||||
type alias LVMVolumeGroup
|
||||
var tmp alias
|
||||
if err := json.Unmarshal(data, &tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
*vg = LVMVolumeGroup(tmp)
|
||||
return nil
|
||||
}
|
||||
|
||||
type LVMLogicalVolume struct {
|
||||
Name string
|
||||
Size uint64
|
||||
Payload Entity
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Size uint64 `json:"size,omitempty" yaml:"size,omitempty"`
|
||||
Payload Entity `json:"payload,omitempty" yaml:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) Clone() Entity {
|
||||
|
|
@ -232,3 +243,24 @@ func lvname(path string) string {
|
|||
path = strings.TrimLeft(path, "/")
|
||||
return strings.ReplaceAll(path, "/", "_") + "lv"
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) UnmarshalJSON(data []byte) (err error) {
|
||||
// keep in sync with lvm.go,partition.go,luks.go
|
||||
type alias LVMLogicalVolume
|
||||
var withoutPayload struct {
|
||||
alias
|
||||
Payload json.RawMessage `json:"payload" yaml:"payload"`
|
||||
PayloadType string `json:"payload_type" yaml:"payload_type"`
|
||||
}
|
||||
if err := jsonUnmarshalStrict(data, &withoutPayload); err != nil {
|
||||
return fmt.Errorf("cannot unmarshal %q: %w", data, err)
|
||||
}
|
||||
*lv = LVMLogicalVolume(withoutPayload.alias)
|
||||
|
||||
lv.Payload, err = unmarshalJSONPayload(data)
|
||||
return err
|
||||
}
|
||||
|
||||
func (lv *LVMLogicalVolume) UnmarshalYAML(unmarshal func(any) error) error {
|
||||
return unmarshalYAMLviaJSON(lv, unmarshal)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue