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

View File

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