virtcontainers: Add firecracker as a supported hypervisor

Add firecracker as a supported hypervisor. This connects the
newly defined firecracker implementation as a supported
hypervisor.

Move operation definition to the common hypervisor code.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
This commit is contained in:
Manohar Castelino 2018-12-18 10:34:36 -08:00
parent c1d3f1a98b
commit e65bafa793
2 changed files with 12 additions and 2 deletions

View File

@ -18,7 +18,12 @@ import (
// HypervisorType describes an hypervisor type. // HypervisorType describes an hypervisor type.
type HypervisorType string type HypervisorType string
type operation int
const ( const (
// FirecrackerHypervisor is the FC hypervisor.
FirecrackerHypervisor HypervisorType = "firecracker"
// QemuHypervisor is the QEMU hypervisor. // QemuHypervisor is the QEMU hypervisor.
QemuHypervisor HypervisorType = "qemu" QemuHypervisor HypervisorType = "qemu"
@ -96,6 +101,9 @@ func (hType *HypervisorType) Set(value string) error {
case "qemu": case "qemu":
*hType = QemuHypervisor *hType = QemuHypervisor
return nil return nil
case "firecracker":
*hType = FirecrackerHypervisor
return nil
case "mock": case "mock":
*hType = MockHypervisor *hType = MockHypervisor
return nil return nil
@ -109,6 +117,8 @@ func (hType *HypervisorType) String() string {
switch *hType { switch *hType {
case QemuHypervisor: case QemuHypervisor:
return string(QemuHypervisor) return string(QemuHypervisor)
case FirecrackerHypervisor:
return string(FirecrackerHypervisor)
case MockHypervisor: case MockHypervisor:
return string(MockHypervisor) return string(MockHypervisor)
default: default:
@ -121,6 +131,8 @@ func newHypervisor(hType HypervisorType) (hypervisor, error) {
switch hType { switch hType {
case QemuHypervisor: case QemuHypervisor:
return &qemu{}, nil return &qemu{}, nil
case FirecrackerHypervisor:
return &firecracker{}, nil
case MockHypervisor: case MockHypervisor:
return &mockHypervisor{}, nil return &mockHypervisor{}, nil
default: default:

View File

@ -96,8 +96,6 @@ var defaultKernelParameters = []Param{
{"panic", "1"}, {"panic", "1"},
} }
type operation int
const ( const (
addDevice operation = iota addDevice operation = iota
removeDevice removeDevice