mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-18 17:33:02 +00:00
virtcontainers: agent: fix CPU hot plug race condition
Communicate to the agent the number of vCPUs that were hot added, allowing to the agent wait for the creation of all vCPUs. fixes #90 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
9db9b286e3
commit
8c9c7ddef8
@ -175,5 +175,6 @@ type agent interface {
|
|||||||
|
|
||||||
// onlineCPUMem will online CPUs and Memory inside the Sandbox.
|
// onlineCPUMem will online CPUs and Memory inside the Sandbox.
|
||||||
// This function should be called after hot adding vCPUs or Memory.
|
// This function should be called after hot adding vCPUs or Memory.
|
||||||
onlineCPUMem() error
|
// cpus specifies the number of CPUs that were added and the agent should online
|
||||||
|
onlineCPUMem(cpus uint32) error
|
||||||
}
|
}
|
||||||
|
@ -856,7 +856,7 @@ func (c *Container) addResources() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.sandbox.agent.onlineCPUMem()
|
return c.sandbox.agent.onlineCPUMem(uint32(vCPUs))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -808,7 +808,7 @@ func (h *hyper) sendCmd(proxyCmd hyperstartProxyCmd) (interface{}, error) {
|
|||||||
return h.client.HyperWithTokens(proxyCmd.cmd, tokens, proxyCmd.message)
|
return h.client.HyperWithTokens(proxyCmd.cmd, tokens, proxyCmd.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *hyper) onlineCPUMem() error {
|
func (h *hyper) onlineCPUMem(cpus uint32) error {
|
||||||
// cc-agent uses udev to online CPUs automatically
|
// cc-agent uses udev to online CPUs automatically
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -877,8 +877,11 @@ func (k *kataAgent) processListContainer(sandbox Sandbox, c Container, options P
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *kataAgent) onlineCPUMem() error {
|
func (k *kataAgent) onlineCPUMem(cpus uint32) error {
|
||||||
req := &grpc.OnlineCPUMemRequest{}
|
req := &grpc.OnlineCPUMemRequest{
|
||||||
|
Wait: false,
|
||||||
|
NbCpus: cpus,
|
||||||
|
}
|
||||||
|
|
||||||
_, err := k.sendReq(req)
|
_, err := k.sendReq(req)
|
||||||
return err
|
return err
|
||||||
|
@ -81,6 +81,6 @@ func (n *noopAgent) processListContainer(sandbox Sandbox, c Container, options P
|
|||||||
}
|
}
|
||||||
|
|
||||||
// onlineCPUMem is the Noop agent Container online CPU and Memory implementation. It does nothing.
|
// onlineCPUMem is the Noop agent Container online CPU and Memory implementation. It does nothing.
|
||||||
func (n *noopAgent) onlineCPUMem() error {
|
func (n *noopAgent) onlineCPUMem(cpus uint32) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user