mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
Add qemu CSP for disk-mapper
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
dcdfae141d
commit
889f6cb7d3
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -11,6 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/edgelesssys/constellation/coordinator/attestation/azure"
|
"github.com/edgelesssys/constellation/coordinator/attestation/azure"
|
||||||
"github.com/edgelesssys/constellation/coordinator/attestation/gcp"
|
"github.com/edgelesssys/constellation/coordinator/attestation/gcp"
|
||||||
|
"github.com/edgelesssys/constellation/coordinator/attestation/qemu"
|
||||||
"github.com/edgelesssys/constellation/coordinator/attestation/vtpm"
|
"github.com/edgelesssys/constellation/coordinator/attestation/vtpm"
|
||||||
azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure"
|
azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure"
|
||||||
gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp"
|
gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp"
|
||||||
@ -25,7 +27,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
gcpStateDiskPath = "/dev/disk/by-id/google-state-disk"
|
gcpStateDiskPath = "/dev/disk/by-id/google-state-disk"
|
||||||
azureStateDiskPath = "/dev/disk/azure/scsi1/lun0"
|
azureStateDiskPath = "/dev/disk/azure/scsi1/lun0"
|
||||||
fallBackPath = "/dev/disk/by-id/state-disk"
|
qemuStateDiskPath = "/dev/vda"
|
||||||
)
|
)
|
||||||
|
|
||||||
var csp = flag.String("csp", "", "Cloud Service Provider the image is running on")
|
var csp = flag.String("csp", "", "Cloud Service Provider the image is running on")
|
||||||
@ -33,6 +35,8 @@ var csp = flag.String("csp", "", "Cloud Service Provider the image is running on
|
|||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
log.Printf("Starting disk-mapper for csp %q\n", *csp)
|
||||||
|
|
||||||
// set up metadata API and quote issuer for aTLS connections
|
// set up metadata API and quote issuer for aTLS connections
|
||||||
var err error
|
var err error
|
||||||
var diskPathErr error
|
var diskPathErr error
|
||||||
@ -57,21 +61,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
metadata = gcpcloud.New(gcpClient)
|
metadata = gcpcloud.New(gcpClient)
|
||||||
|
|
||||||
default:
|
case "qemu":
|
||||||
diskPath, err = filepath.EvalSymlinks(fallBackPath)
|
diskPath = qemuStateDiskPath
|
||||||
if err != nil {
|
issuer = qemu.NewIssuer()
|
||||||
utils.KernelPanic(err)
|
fmt.Fprintf(os.Stderr, "warning: cloud services are not supported for csp %q\n", *csp)
|
||||||
}
|
|
||||||
issuer = core.NewMockIssuer()
|
|
||||||
fmt.Fprintf(os.Stderr, "warning: csp %q is not supported, unable to automatically request decryption keys on reboot\n", *csp)
|
|
||||||
metadata = &core.ProviderMetadataFake{}
|
metadata = &core.ProviderMetadataFake{}
|
||||||
|
|
||||||
|
default:
|
||||||
|
diskPathErr = fmt.Errorf("csp %q is not supported by Constellation", *csp)
|
||||||
}
|
}
|
||||||
if diskPathErr != nil {
|
if diskPathErr != nil {
|
||||||
fmt.Fprintf(os.Stderr, "warning: no attached disk detected, trying to use boot-disk state partition as fallback")
|
utils.KernelPanic(fmt.Errorf("unable to determine state disk path: %w", diskPathErr))
|
||||||
diskPath, err = filepath.EvalSymlinks(fallBackPath)
|
|
||||||
if err != nil {
|
|
||||||
utils.KernelPanic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize device mapper
|
// initialize device mapper
|
||||||
|
Loading…
Reference in New Issue
Block a user