mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 13:14:33 +00:00
clh: introduce loadVirtiofsDaemon()
Similarly to the `createVirtiofsDaemon` and `stopVirtiofsDaemon` methos, let's introduce and use loadVirtiofsDaemon, at it'll also be handy later in this series. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
ae2221ea68
commit
54d27ed721
@ -273,6 +273,20 @@ func (clh *cloudHypervisor) stopVirtiofsDaemon(ctx context.Context) (err error)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (clh *cloudHypervisor) loadVirtiofsDaemon(sharedPath string) (VirtiofsDaemon, error) {
|
||||||
|
virtiofsdSocketPath, err := clh.virtioFsSocketPath(clh.id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &virtiofsd{
|
||||||
|
PID: clh.state.VirtiofsDaemonPid,
|
||||||
|
sourcePath: sharedPath,
|
||||||
|
debug: clh.config.Debug,
|
||||||
|
socketPath: virtiofsdSocketPath,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (clh *cloudHypervisor) nydusdAPISocketPath(id string) (string, error) {
|
func (clh *cloudHypervisor) nydusdAPISocketPath(id string) (string, error) {
|
||||||
return utils.BuildSocketPath(clh.config.VMStorePath, id, nydusdAPISock)
|
return utils.BuildSocketPath(clh.config.VMStorePath, id, nydusdAPISock)
|
||||||
}
|
}
|
||||||
@ -323,19 +337,15 @@ func (clh *cloudHypervisor) CreateVM(ctx context.Context, id string, network Net
|
|||||||
|
|
||||||
clh.Logger().WithField("function", "CreateVM").Info("creating Sandbox")
|
clh.Logger().WithField("function", "CreateVM").Info("creating Sandbox")
|
||||||
|
|
||||||
virtiofsdSocketPath, err := clh.virtioFsSocketPath(clh.id)
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if clh.state.PID > 0 {
|
if clh.state.PID > 0 {
|
||||||
clh.Logger().WithField("function", "CreateVM").Info("Sandbox already exist, loading from state")
|
clh.Logger().WithField("function", "CreateVM").Info("Sandbox already exist, loading from state")
|
||||||
clh.virtiofsDaemon = &virtiofsd{
|
|
||||||
PID: clh.state.VirtiofsDaemonPid,
|
virtiofsDaemon, err := clh.loadVirtiofsDaemon(hypervisorConfig.SharedFS)
|
||||||
sourcePath: hypervisorConfig.SharedPath,
|
if err != nil {
|
||||||
debug: clh.config.Debug,
|
return err
|
||||||
socketPath: virtiofsdSocketPath,
|
|
||||||
}
|
}
|
||||||
|
clh.virtiofsDaemon = virtiofsDaemon
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user