github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/machine/qemu/config.go (about)

     1  //go:build (amd64 && !windows) || (arm64 && !windows)
     2  // +build amd64,!windows arm64,!windows
     3  
     4  package qemu
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/hanks177/podman/v4/pkg/machine"
    10  )
    11  
    12  const (
    13  	// FCOS streams
    14  	// Testing FCOS stream
    15  	Testing string = "testing"
    16  	// Next FCOS stream
    17  	Next string = "next"
    18  	// Stable FCOS stream
    19  	Stable string = "stable"
    20  
    21  	// Max length of fully qualified socket path
    22  
    23  )
    24  
    25  type Provider struct{}
    26  
    27  // Deprecated: MachineVMV1 is being deprecated in favor a more flexible and informative
    28  // structure
    29  type MachineVMV1 struct {
    30  	// CPUs to be assigned to the VM
    31  	CPUs uint64
    32  	// The command line representation of the qemu command
    33  	CmdLine []string
    34  	// Mounts is the list of remote filesystems to mount
    35  	Mounts []machine.Mount
    36  	// IdentityPath is the fq path to the ssh priv key
    37  	IdentityPath string
    38  	// IgnitionFilePath is the fq path to the .ign file
    39  	IgnitionFilePath string
    40  	// ImageStream is the update stream for the image
    41  	ImageStream string
    42  	// ImagePath is the fq path to
    43  	ImagePath string
    44  	// Memory in megabytes assigned to the vm
    45  	Memory uint64
    46  	// Disk size in gigabytes assigned to the vm
    47  	DiskSize uint64
    48  	// Name of the vm
    49  	Name string
    50  	// SSH port for user networking
    51  	Port int
    52  	// QMPMonitor is the qemu monitor object for sending commands
    53  	QMPMonitor Monitorv1
    54  	// RemoteUsername of the vm user
    55  	RemoteUsername string
    56  	// Whether this machine should run in a rootful or rootless manner
    57  	Rootful bool
    58  	// UID is the numerical id of the user that called machine
    59  	UID int
    60  }
    61  
    62  type MachineVM struct {
    63  	// ConfigPath is the path to the configuration file
    64  	ConfigPath machine.VMFile
    65  	// The command line representation of the qemu command
    66  	CmdLine []string
    67  	// HostUser contains info about host user
    68  	machine.HostUser
    69  	// ImageConfig describes the bootable image
    70  	machine.ImageConfig
    71  	// Mounts is the list of remote filesystems to mount
    72  	Mounts []machine.Mount
    73  	// Name of VM
    74  	Name string
    75  	// PidFilePath is the where the PID file lives
    76  	PidFilePath machine.VMFile
    77  	// QMPMonitor is the qemu monitor object for sending commands
    78  	QMPMonitor Monitor
    79  	// ReadySocket tells host when vm is booted
    80  	ReadySocket machine.VMFile
    81  	// ResourceConfig is physical attrs of the VM
    82  	machine.ResourceConfig
    83  	// SSHConfig for accessing the remote vm
    84  	machine.SSHConfig
    85  	// Starting tells us whether the machine is running or if we have just dialed it to start it
    86  	Starting bool
    87  	// Created contains the original created time instead of querying the file mod time
    88  	Created time.Time
    89  	// LastUp contains the last recorded uptime
    90  	LastUp time.Time
    91  }
    92  
    93  type Monitorv1 struct {
    94  	//	Address portion of the qmp monitor (/tmp/tmp.sock)
    95  	Address string
    96  	// Network portion of the qmp monitor (unix)
    97  	Network string
    98  	// Timeout in seconds for qmp monitor transactions
    99  	Timeout time.Duration
   100  }
   101  
   102  type Monitor struct {
   103  	//	Address portion of the qmp monitor (/tmp/tmp.sock)
   104  	Address machine.VMFile
   105  	// Network portion of the qmp monitor (unix)
   106  	Network string
   107  	// Timeout in seconds for qmp monitor transactions
   108  	Timeout time.Duration
   109  }
   110  
   111  var (
   112  	// defaultQMPTimeout is the timeout duration for the
   113  	// qmp monitor interactions.
   114  	defaultQMPTimeout = 2 * time.Second
   115  )