Documentation
¶
Index ¶
Constants ¶
View Source
const ( // NetQueueSize is the default virtio-net ring depth per queue. // 512 balances download throughput (favors larger rings) against // request-response latency (favors smaller rings). NetQueueSize = 512 )
Variables ¶
View Source
var ( ErrNotFound = errors.New("network not found") ErrNotConfigured = errors.New("network provider not configured") )
Functions ¶
func NetNumQueues ¶ added in v0.3.2
NetNumQueues returns the virtio-net queue count for the given CPU count. CH uses queue pairs (TX+RX), so the result is always even (≥ 2).
func ResolveQueueSize ¶ added in v0.3.2
ResolveQueueSize returns qs if positive, otherwise the default NetQueueSize.
func VMIDPrefix ¶ added in v0.3.2
VMIDPrefix returns the first 8 characters of a VM ID, matching the truncation used by both bridge and CNI TAP device naming.
Types ¶
type Network ¶
type Network interface {
Type() string
// Verify checks whether the network namespace for a VM exists.
// Returns nil if the netns is present, an error otherwise.
Verify(ctx context.Context, vmID string) error
// Config creates network namespace, bridge, and tap for a VM.
// When existing configs are provided (recovery after host reboot),
// the netns and tap devices are recreated using the persisted MAC addresses.
// NOTE: vmCfg.Network may be mutated to record the resolved conflist name.
Config(ctx context.Context, vmID string, numNICs int, vmCfg *types.VMConfig, existing ...*types.NetworkConfig) ([]*types.NetworkConfig, error)
Delete(context.Context, []string) ([]string, error)
Inspect(context.Context, string) (*types.Network, error)
List(context.Context) ([]*types.Network, error)
RegisterGC(*gc.Orchestrator)
}
Network defines the interface for a network provider (CNI, etc.).
Click to show internal directories.
Click to hide internal directories.