mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
Merge pull request #68 from devimc/agent/onlineCPUs
virtcontainers: agent: use onlineCPUMem to online vCPUs
This commit is contained in:
commit
6d05197625
@ -172,4 +172,8 @@ type agent interface {
|
||||
|
||||
// processListContainer will list the processes running inside the container
|
||||
processListContainer(pod Pod, c Container, options ProcessListOptions) (ProcessList, error)
|
||||
|
||||
// onlineCPUMem will online CPUs and Memory inside the Pod.
|
||||
// This function should be called after hot adding vCPUs or Memory.
|
||||
onlineCPUMem() error
|
||||
}
|
||||
|
@ -787,6 +787,8 @@ func (c *Container) addResources() error {
|
||||
if err := c.pod.hypervisor.hotplugAddDevice(uint32(vCPUs), cpuDev); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.pod.agent.onlineCPUMem()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -794,3 +794,8 @@ func (h *hyper) sendCmd(proxyCmd hyperstartProxyCmd) (interface{}, error) {
|
||||
|
||||
return h.client.HyperWithTokens(proxyCmd.cmd, tokens, proxyCmd.message)
|
||||
}
|
||||
|
||||
func (h *hyper) onlineCPUMem() error {
|
||||
// cc-agent uses udev to online CPUs automatically
|
||||
return nil
|
||||
}
|
||||
|
@ -773,6 +773,13 @@ func (k *kataAgent) processListContainer(pod Pod, c Container, options ProcessLi
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (k *kataAgent) onlineCPUMem() error {
|
||||
req := &grpc.OnlineCPUMemRequest{}
|
||||
|
||||
_, err := k.sendReq(req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (k *kataAgent) connect() error {
|
||||
if k.client != nil {
|
||||
return nil
|
||||
@ -836,6 +843,8 @@ func (k *kataAgent) sendReq(request interface{}) (interface{}, error) {
|
||||
case *grpc.UpdateInterfaceRequest:
|
||||
ifc, err := k.client.UpdateInterface(context.Background(), req)
|
||||
return ifc, err
|
||||
case *grpc.OnlineCPUMemRequest:
|
||||
return k.client.OnlineCPUMem(context.Background(), req)
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown gRPC type %T", req)
|
||||
}
|
||||
|
@ -79,3 +79,8 @@ func (n *noopAgent) killContainer(pod Pod, c Container, signal syscall.Signal, a
|
||||
func (n *noopAgent) processListContainer(pod Pod, c Container, options ProcessListOptions) (ProcessList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// onlineCPUMem is the Noop agent Container online CPU and Memory implementation. It does nothing.
|
||||
func (n *noopAgent) onlineCPUMem() error {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user