importer

package
v0.0.0-...-fa603ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageFlag          = "image_name"
	ClientFlag         = "client_id"
	BYOLFlag           = "byol"
	DataDiskFlag       = "data_disk"
	OSFlag             = "os"
	CustomWorkflowFlag = "custom_translate_workflow"
)

Flags that are validated.

Variables

This section is empty.

Functions

func FixBYOLAndOSArguments

func FixBYOLAndOSArguments(osIDArgument *string, byolArgument *bool)

FixBYOLAndOSArguments fixes the user's arguments for the --os and --byol flags to follow the invariants from ImageImportRequest's validation where --byol may only be specified when --os is empty (implying that detection is being used).

For example, `--byol --os=rhel-8` will be changed to `--os=rhel-8-byol`.

func GetDiskURI

func GetDiskURI(pd persistentDisk) string

GetDiskURI return the URI of a PD disk

Types

type ImageImportRequest

type ImageImportRequest struct {
	ExecutionID                 string `name:"execution_id" validate:"required"`
	CloudLogsDisabled           bool
	ComputeServiceAccount       string
	WorkflowDir                 string `name:"workflow_dir" validate:"required"`
	CustomWorkflow              string
	DataDisk                    bool
	DaisyLogLinePrefix          string
	Description                 string
	Family                      string
	GcsLogsDisabled             bool
	ImageName                   string `name:"image_name" validate:"required,gce_disk_image_name"`
	Inspect                     bool
	Labels                      map[string]string
	Network                     string
	NoExternalIP                bool
	NoGuestEnvironment          bool
	Oauth                       string
	BYOL                        bool
	OS                          string
	Project                     string `name:"project" validate:"required"`
	ScratchBucketGcsPath        string `name:"scratch_bucket_gcs_path" validate:"required"`
	Source                      Source `name:"source" validate:"required"`
	StdoutLogsDisabled          bool
	StorageLocation             string
	Subnet                      string
	SysprepWindows              bool
	Tool                        daisyutils.Tool `name:"tool" validate:"required"`
	Timeout                     time.Duration   `name:"timeout" validate:"required"`
	UefiCompatible              bool
	Zone                        string `name:"zone" validate:"required"`
	DataDisks                   []domain.Disk
	NestedVirtualizationEnabled bool
	WorkerMachineSeries         []string
	EndpointsOverride           daisyutils.EndpointsOverride
}

ImageImportRequest includes the parameters required to perform an image import.

DaisyLogLinePrefix configures Daisy's stdout to include this prefix. During inflation, for example, a prefix of `ovf` would create a log line of `[ovf-inflate]`.

Tags define validations; see validation.ValidateStruct for more info.

func (ImageImportRequest) EnvironmentSettings

func (args ImageImportRequest) EnvironmentSettings() daisyutils.EnvironmentSettings

EnvironmentSettings returns the subset of EnvironmentSettings that are required to instantiate a daisy workflow.

type Importer

type Importer interface {
	Run(ctx context.Context) error
}

Importer creates a GCE disk image from a source disk file or image.

func NewImporter

func NewImporter(request ImageImportRequest, computeClient daisyCompute.Client, storageClient domain.StorageClientInterface, logger logging.Logger) (Importer, error)

NewImporter constructs an Importer instance.

type Inflater

type Inflater interface {
	Inflate() (persistentDisk, inflationInfo, error)
	Cancel(reason string) bool
}

Inflater constructs a new persistentDisk, typically starting from a frozen representation of a disk, such as a VMDK file or a GCP disk image.

func NewDaisyInflater

func NewDaisyInflater(request ImageImportRequest, fileMetadata imagefile.Metadata, logger logging.Logger) (Inflater, error)

NewDaisyInflater returns an inflater that uses a Daisy workflow.

func NewInflater

func NewInflater(request ImageImportRequest, computeClient daisyCompute.Client, storageClient domain.StorageClientInterface,
	inspector imagefile.Inspector, logger logging.Logger) (Inflater, error)

NewInflater returns an Inflater object that uses either PD API or Daisy workflow to create a 1:1 data copy of disk file into GCP disk

type Source

type Source interface {
	Path() string
}

Source is a resource that can be imported to GCE disk images. If an instance of this interface exists, it is expected that validation has already occurred, and that the caller can safely use the resource.

type SourceFactory

type SourceFactory interface {
	Init(sourceFile, sourceImage string) (Source, error)
}

SourceFactory takes the sourceFile and sourceImage specified by the user and determines which, if any, is importable. It is an error if both sourceFile and sourceImage are specified.

func NewSourceFactory

func NewSourceFactory(storageClient domain.StorageClientInterface) SourceFactory

NewSourceFactory returns an instance of SourceFactory.

Directories

Path Synopsis
Package imagemocks is a generated GoMock package.
Package imagemocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL