Skip to content

Commit

Permalink
ppc64le: Fix vCPU hotplug issue
Browse files Browse the repository at this point in the history
ppc64le qemu does not need threadID and
socketID parameters when hotplugging.

Fixes: kata-containers#1155

Signed-off-by: Nitesh Konkar [email protected]
  • Loading branch information
nitkon committed Jan 28, 2019
1 parent 726df9d commit b0986a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,11 @@ func (q *qemu) hotplugAddCPUs(amount uint32) (uint32, error) {
return 0, fmt.Errorf("failed to query hotpluggable CPUs: %v", err)
}

machine, err := q.arch.machine()
if err != nil {
return 0, fmt.Errorf("failed to query machine type: %v", err)
}

var hotpluggedVCPUs uint32
for _, hc := range hotpluggableVCPUs {
// qom-path is the path to the CPU, non-empty means that this CPU is already in use
Expand All @@ -1090,6 +1095,13 @@ func (q *qemu) hotplugAddCPUs(amount uint32) (uint32, error) {
socketID := fmt.Sprintf("%d", hc.Properties.Socket)
coreID := fmt.Sprintf("%d", hc.Properties.Core)
threadID := fmt.Sprintf("%d", hc.Properties.Thread)

// If CPU type is IBM pSeries, we do not set socketID and threadID
if machine.Type == "pseries" {
socketID = ""
threadID = ""
}

if err := q.qmpMonitorCh.qmp.ExecuteCPUDeviceAdd(q.qmpMonitorCh.ctx, driver, cpuID, socketID, coreID, threadID, romFile); err != nil {
// don't fail, let's try with other CPU
continue
Expand Down

0 comments on commit b0986a5

Please sign in to comment.