mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
hypervisor: startSandbox is StartVM
s/startSandbox/StartVM Signed-off-by: Manohar Castelino <mcastelino@apple.com> Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
parent
fd24a695bf
commit
76f1ce9e30
@ -422,8 +422,8 @@ func (a *Acrn) createSandbox(ctx context.Context, id string, networkNS NetworkNa
|
||||
}
|
||||
|
||||
// startSandbox will start the Sandbox's VM.
|
||||
func (a *Acrn) startSandbox(ctx context.Context, timeoutSecs int) error {
|
||||
span, ctx := katatrace.Trace(ctx, a.Logger(), "startSandbox", acrnTracingTags, map[string]string{"sandbox_id": a.id})
|
||||
func (a *Acrn) StartVM(ctx context.Context, timeoutSecs int) error {
|
||||
span, ctx := katatrace.Trace(ctx, a.Logger(), "StartVM", acrnTracingTags, map[string]string{"sandbox_id": a.id})
|
||||
defer span.End()
|
||||
|
||||
if a.config.Debug {
|
||||
|
@ -365,14 +365,14 @@ func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networ
|
||||
}
|
||||
|
||||
// startSandbox will start the VMM and boot the virtual machine for the given sandbox.
|
||||
func (clh *cloudHypervisor) startSandbox(ctx context.Context, timeout int) error {
|
||||
span, _ := katatrace.Trace(ctx, clh.Logger(), "startSandbox", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
||||
func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
|
||||
span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
||||
defer span.End()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), clhAPITimeout*time.Second)
|
||||
defer cancel()
|
||||
|
||||
clh.Logger().WithField("function", "startSandbox").Info("starting Sandbox")
|
||||
clh.Logger().WithField("function", "StartVM").Info("starting Sandbox")
|
||||
|
||||
vmPath := filepath.Join(clh.store.RunVMStoragePath(), clh.id)
|
||||
err := os.MkdirAll(vmPath, DirMode)
|
||||
@ -394,7 +394,7 @@ func (clh *cloudHypervisor) startSandbox(ctx context.Context, timeout int) error
|
||||
defer label.SetProcessLabel("")
|
||||
|
||||
if clh.config.SharedFS == config.VirtioFS {
|
||||
clh.Logger().WithField("function", "startSandbox").Info("Starting virtiofsd")
|
||||
clh.Logger().WithField("function", "StartVM").Info("Starting virtiofsd")
|
||||
pid, err := clh.virtiofsd.Start(ctx, func() {
|
||||
clh.StopVM(ctx, false)
|
||||
})
|
||||
|
@ -268,7 +268,7 @@ func TestClooudHypervisorStartSandbox(t *testing.T) {
|
||||
store: store,
|
||||
}
|
||||
|
||||
err = clh.startSandbox(context.Background(), 10)
|
||||
err = clh.StartVM(context.Background(), 10)
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
|
@ -765,8 +765,8 @@ func (fc *firecracker) fcInitConfiguration(ctx context.Context) error {
|
||||
// startSandbox will start the hypervisor for the given sandbox.
|
||||
// In the context of firecracker, this will start the hypervisor,
|
||||
// for configuration, but not yet start the actual virtual machine
|
||||
func (fc *firecracker) startSandbox(ctx context.Context, timeout int) error {
|
||||
span, _ := katatrace.Trace(ctx, fc.Logger(), "startSandbox", fcTracingTags, map[string]string{"sandbox_id": fc.id})
|
||||
func (fc *firecracker) StartVM(ctx context.Context, timeout int) error {
|
||||
span, _ := katatrace.Trace(ctx, fc.Logger(), "StartVM", fcTracingTags, map[string]string{"sandbox_id": fc.id})
|
||||
defer span.End()
|
||||
|
||||
if err := fc.fcInitConfiguration(ctx); err != nil {
|
||||
|
@ -898,7 +898,7 @@ func generateVMSocket(id string, vmStogarePath string) (interface{}, error) {
|
||||
type hypervisor interface {
|
||||
setConfig(config *HypervisorConfig) error
|
||||
createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *HypervisorConfig) error
|
||||
startSandbox(ctx context.Context, timeout int) error
|
||||
StartVM(ctx context.Context, timeout int) error
|
||||
|
||||
// If wait is set, don't actively stop the sandbox:
|
||||
// just perform cleanup.
|
||||
|
@ -764,7 +764,7 @@ func (k *kataAgent) getDNS(sandbox *Sandbox) ([]string, error) {
|
||||
}
|
||||
|
||||
func (k *kataAgent) startSandbox(ctx context.Context, sandbox *Sandbox) error {
|
||||
span, ctx := katatrace.Trace(ctx, k.Logger(), "startSandbox", kataAgentTracingTags)
|
||||
span, ctx := katatrace.Trace(ctx, k.Logger(), "StartVM", kataAgentTracingTags)
|
||||
defer span.End()
|
||||
|
||||
if err := k.setAgentURL(); err != nil {
|
||||
|
@ -46,7 +46,7 @@ func (m *mockHypervisor) createSandbox(ctx context.Context, id string, networkNS
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockHypervisor) startSandbox(ctx context.Context, timeout int) error {
|
||||
func (m *mockHypervisor) StartVM(ctx context.Context, timeout int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ func TestMockHypervisorCreateSandbox(t *testing.T) {
|
||||
func TestMockHypervisorStartSandbox(t *testing.T) {
|
||||
var m *mockHypervisor
|
||||
|
||||
assert.NoError(t, m.startSandbox(context.Background(), vmStartTimeout))
|
||||
assert.NoError(t, m.StartVM(context.Background(), vmStartTimeout))
|
||||
}
|
||||
|
||||
func TestMockHypervisorStopSandbox(t *testing.T) {
|
||||
|
@ -770,8 +770,8 @@ func (q *qemu) setupVirtioMem(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// startSandbox will start the Sandbox's VM.
|
||||
func (q *qemu) startSandbox(ctx context.Context, timeout int) error {
|
||||
span, ctx := katatrace.Trace(ctx, q.Logger(), "startSandbox", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||
func (q *qemu) StartVM(ctx context.Context, timeout int) error {
|
||||
span, ctx := katatrace.Trace(ctx, q.Logger(), "StartVM", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||
defer span.End()
|
||||
|
||||
if q.config.Debug {
|
||||
|
@ -1199,7 +1199,7 @@ func (s *Sandbox) startVM(ctx context.Context) (err error) {
|
||||
return vm.assignSandbox(s)
|
||||
}
|
||||
|
||||
return s.hypervisor.startSandbox(ctx, vmStartTimeout)
|
||||
return s.hypervisor.StartVM(ctx, vmStartTimeout)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
utils.StartCmd = func(c *exec.Cmd) error {
|
||||
//startSandbox will Check if the hypervisor is alive and
|
||||
//StartVM will Check if the hypervisor is alive and
|
||||
// checks for the PID is running, lets fake it using our
|
||||
// own PID
|
||||
c.Process = &os.Process{Pid: os.Getpid()}
|
||||
|
@ -130,7 +130,7 @@ func NewVM(ctx context.Context, config VMConfig) (*VM, error) {
|
||||
}
|
||||
|
||||
// 3. boot up guest vm
|
||||
if err = hypervisor.startSandbox(ctx, vmStartTimeout); err != nil {
|
||||
if err = hypervisor.StartVM(ctx, vmStartTimeout); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ func (v *VM) Resume(ctx context.Context) error {
|
||||
// Start kicks off a configured VM.
|
||||
func (v *VM) Start(ctx context.Context) error {
|
||||
v.logger().Info("start vm")
|
||||
return v.hypervisor.startSandbox(ctx, vmStartTimeout)
|
||||
return v.hypervisor.StartVM(ctx, vmStartTimeout)
|
||||
}
|
||||
|
||||
// Disconnect agent connections to a VM
|
||||
|
Loading…
Reference in New Issue
Block a user