代码拉取完成,页面将自动刷新
// Copyright (c) 2018 HyperHQ Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// direct implements base vm factory without vm templating.
package direct
import (
"context"
pb "github.com/kata-containers/runtime/protocols/cache"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/factory/base"
)
type direct struct {
config vc.VMConfig
}
// New returns a new direct vm factory.
func New(ctx context.Context, config vc.VMConfig) base.FactoryBase {
return &direct{config}
}
// Config returns the direct factory's configuration.
func (d *direct) Config() vc.VMConfig {
return d.config
}
// GetBaseVM create a new VM directly.
func (d *direct) GetBaseVM(ctx context.Context, config vc.VMConfig) (*vc.VM, error) {
vm, err := vc.NewVM(ctx, config)
if err != nil {
return nil, err
}
err = vm.Pause()
if err != nil {
vm.Stop()
return nil, err
}
return vm, nil
}
// CloseFactory closes the direct vm factory.
func (d *direct) CloseFactory(ctx context.Context) {
}
// GetVMStatus is not supported
func (d *direct) GetVMStatus() []*pb.GrpcVMStatus {
panic("ERROR: package direct does not support GetVMStatus")
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。