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:
Manohar Castelino 2021-09-21 10:39:24 -07:00 committed by Eric Ernst
parent fd24a695bf
commit 76f1ce9e30
12 changed files with 19 additions and 19 deletions

View File

@ -422,8 +422,8 @@ func (a *Acrn) createSandbox(ctx context.Context, id string, networkNS NetworkNa
} }
// startSandbox will start the Sandbox's VM. // startSandbox will start the Sandbox's VM.
func (a *Acrn) startSandbox(ctx context.Context, timeoutSecs int) error { func (a *Acrn) StartVM(ctx context.Context, timeoutSecs int) error {
span, ctx := katatrace.Trace(ctx, a.Logger(), "startSandbox", acrnTracingTags, map[string]string{"sandbox_id": a.id}) span, ctx := katatrace.Trace(ctx, a.Logger(), "StartVM", acrnTracingTags, map[string]string{"sandbox_id": a.id})
defer span.End() defer span.End()
if a.config.Debug { if a.config.Debug {

View File

@ -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. // startSandbox will start the VMM and boot the virtual machine for the given sandbox.
func (clh *cloudHypervisor) startSandbox(ctx context.Context, timeout int) error { func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
span, _ := katatrace.Trace(ctx, clh.Logger(), "startSandbox", clhTracingTags, map[string]string{"sandbox_id": clh.id}) span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id})
defer span.End() defer span.End()
ctx, cancel := context.WithTimeout(context.Background(), clhAPITimeout*time.Second) ctx, cancel := context.WithTimeout(context.Background(), clhAPITimeout*time.Second)
defer cancel() 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) vmPath := filepath.Join(clh.store.RunVMStoragePath(), clh.id)
err := os.MkdirAll(vmPath, DirMode) err := os.MkdirAll(vmPath, DirMode)
@ -394,7 +394,7 @@ func (clh *cloudHypervisor) startSandbox(ctx context.Context, timeout int) error
defer label.SetProcessLabel("") defer label.SetProcessLabel("")
if clh.config.SharedFS == config.VirtioFS { 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() { pid, err := clh.virtiofsd.Start(ctx, func() {
clh.StopVM(ctx, false) clh.StopVM(ctx, false)
}) })

View File

@ -268,7 +268,7 @@ func TestClooudHypervisorStartSandbox(t *testing.T) {
store: store, store: store,
} }
err = clh.startSandbox(context.Background(), 10) err = clh.StartVM(context.Background(), 10)
assert.NoError(err) assert.NoError(err)
} }

View File

@ -765,8 +765,8 @@ func (fc *firecracker) fcInitConfiguration(ctx context.Context) error {
// startSandbox will start the hypervisor for the given sandbox. // startSandbox will start the hypervisor for the given sandbox.
// In the context of firecracker, this will start the hypervisor, // In the context of firecracker, this will start the hypervisor,
// for configuration, but not yet start the actual virtual machine // for configuration, but not yet start the actual virtual machine
func (fc *firecracker) startSandbox(ctx context.Context, timeout int) error { func (fc *firecracker) StartVM(ctx context.Context, timeout int) error {
span, _ := katatrace.Trace(ctx, fc.Logger(), "startSandbox", fcTracingTags, map[string]string{"sandbox_id": fc.id}) span, _ := katatrace.Trace(ctx, fc.Logger(), "StartVM", fcTracingTags, map[string]string{"sandbox_id": fc.id})
defer span.End() defer span.End()
if err := fc.fcInitConfiguration(ctx); err != nil { if err := fc.fcInitConfiguration(ctx); err != nil {

View File

@ -898,7 +898,7 @@ func generateVMSocket(id string, vmStogarePath string) (interface{}, error) {
type hypervisor interface { type hypervisor interface {
setConfig(config *HypervisorConfig) error setConfig(config *HypervisorConfig) error
createSandbox(ctx context.Context, id string, networkNS NetworkNamespace, hypervisorConfig *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: // If wait is set, don't actively stop the sandbox:
// just perform cleanup. // just perform cleanup.

View File

@ -764,7 +764,7 @@ func (k *kataAgent) getDNS(sandbox *Sandbox) ([]string, error) {
} }
func (k *kataAgent) startSandbox(ctx context.Context, sandbox *Sandbox) 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() defer span.End()
if err := k.setAgentURL(); err != nil { if err := k.setAgentURL(); err != nil {

View File

@ -46,7 +46,7 @@ func (m *mockHypervisor) createSandbox(ctx context.Context, id string, networkNS
return nil return nil
} }
func (m *mockHypervisor) startSandbox(ctx context.Context, timeout int) error { func (m *mockHypervisor) StartVM(ctx context.Context, timeout int) error {
return nil return nil
} }

View File

@ -47,7 +47,7 @@ func TestMockHypervisorCreateSandbox(t *testing.T) {
func TestMockHypervisorStartSandbox(t *testing.T) { func TestMockHypervisorStartSandbox(t *testing.T) {
var m *mockHypervisor var m *mockHypervisor
assert.NoError(t, m.startSandbox(context.Background(), vmStartTimeout)) assert.NoError(t, m.StartVM(context.Background(), vmStartTimeout))
} }
func TestMockHypervisorStopSandbox(t *testing.T) { func TestMockHypervisorStopSandbox(t *testing.T) {

View File

@ -770,8 +770,8 @@ func (q *qemu) setupVirtioMem(ctx context.Context) error {
} }
// startSandbox will start the Sandbox's VM. // startSandbox will start the Sandbox's VM.
func (q *qemu) startSandbox(ctx context.Context, timeout int) error { func (q *qemu) StartVM(ctx context.Context, timeout int) error {
span, ctx := katatrace.Trace(ctx, q.Logger(), "startSandbox", qemuTracingTags, map[string]string{"sandbox_id": q.id}) span, ctx := katatrace.Trace(ctx, q.Logger(), "StartVM", qemuTracingTags, map[string]string{"sandbox_id": q.id})
defer span.End() defer span.End()
if q.config.Debug { if q.config.Debug {

View File

@ -1199,7 +1199,7 @@ func (s *Sandbox) startVM(ctx context.Context) (err error) {
return vm.assignSandbox(s) return vm.assignSandbox(s)
} }
return s.hypervisor.startSandbox(ctx, vmStartTimeout) return s.hypervisor.StartVM(ctx, vmStartTimeout)
}); err != nil { }); err != nil {
return err return err
} }

View File

@ -134,7 +134,7 @@ func TestMain(m *testing.M) {
} }
utils.StartCmd = func(c *exec.Cmd) error { 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 // checks for the PID is running, lets fake it using our
// own PID // own PID
c.Process = &os.Process{Pid: os.Getpid()} c.Process = &os.Process{Pid: os.Getpid()}

View File

@ -130,7 +130,7 @@ func NewVM(ctx context.Context, config VMConfig) (*VM, error) {
} }
// 3. boot up guest vm // 3. boot up guest vm
if err = hypervisor.startSandbox(ctx, vmStartTimeout); err != nil { if err = hypervisor.StartVM(ctx, vmStartTimeout); err != nil {
return nil, err return nil, err
} }
@ -233,7 +233,7 @@ func (v *VM) Resume(ctx context.Context) error {
// Start kicks off a configured VM. // Start kicks off a configured VM.
func (v *VM) Start(ctx context.Context) error { func (v *VM) Start(ctx context.Context) error {
v.logger().Info("start vm") v.logger().Info("start vm")
return v.hypervisor.startSandbox(ctx, vmStartTimeout) return v.hypervisor.StartVM(ctx, vmStartTimeout)
} }
// Disconnect agent connections to a VM // Disconnect agent connections to a VM