Files
kata-containers/virtcontainers/resource_storage.go
Manohar Castelino c1d3f1a98b firecracker: VMM API support
Initial Support for the firecracker VMM

Note:
- 9p is unsupported by firecracker
- Enable pseudo hotplug block device hotplug capability

Initially, this will be a pseudo capability for Firecracker hypervisor,
but we will utilize a pool of block devices and block device rescan as a
temporary workaround.

Fixes: #1064

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2018-12-20 11:54:49 -08:00

69 lines
2.8 KiB
Go

// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"context"
"encoding/json"
"github.com/kata-containers/runtime/virtcontainers/device/api"
)
// TypedDevice is used as an intermediate representation for marshalling
// and unmarshalling Device implementations.
type TypedDevice struct {
Type string
// Data is assigned the Device object.
// This being declared as RawMessage prevents it from being marshalled/unmarshalled.
// We do that explicitly depending on Type.
Data json.RawMessage
}
// resourceStorage is the virtcontainers resources (configuration, state, etc...)
// storage interface.
// The default resource storage implementation is filesystem.
type resourceStorage interface {
// Create all resources for a sandbox
createAllResources(ctx context.Context, sandbox *Sandbox) error
// Resources URIs functions return both the URI
// for the actual resource and the URI base.
containerURI(sandboxID, containerID string, resource sandboxResource) (string, string, error)
sandboxURI(sandboxID string, resource sandboxResource) (string, string, error)
// Sandbox resources
storeSandboxResource(sandboxID string, resource sandboxResource, data interface{}) error
deleteSandboxResources(sandboxID string, resources []sandboxResource) error
fetchSandboxConfig(sandboxID string) (SandboxConfig, error)
fetchSandboxState(sandboxID string) (State, error)
fetchSandboxNetwork(sandboxID string) (NetworkNamespace, error)
storeSandboxNetwork(sandboxID string, networkNS NetworkNamespace) error
fetchSandboxDevices(sandboxID string) ([]api.Device, error)
storeSandboxDevices(sandboxID string, devices []api.Device) error
// Hypervisor resources
fetchHypervisorState(sandboxID string, state interface{}) error
storeHypervisorState(sandboxID string, state interface{}) error
// Agent resources
fetchAgentState(sandboxID string, state interface{}) error
storeAgentState(sandboxID string, state interface{}) error
// Container resources
storeContainerResource(sandboxID, containerID string, resource sandboxResource, data interface{}) error
deleteContainerResources(sandboxID, containerID string, resources []sandboxResource) error
fetchContainerConfig(sandboxID, containerID string) (ContainerConfig, error)
fetchContainerState(sandboxID, containerID string) (State, error)
fetchContainerProcess(sandboxID, containerID string) (Process, error)
storeContainerProcess(sandboxID, containerID string, process Process) error
fetchContainerMounts(sandboxID, containerID string) ([]Mount, error)
storeContainerMounts(sandboxID, containerID string, mounts []Mount) error
fetchContainerDevices(sandboxID, containerID string) ([]ContainerDevice, error)
storeContainerDevices(sandboxID, containerID string, devices []ContainerDevice) error
createSandboxTempFile(sandboxID string) (string, error)
}