Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
clh: Remove unnecessary VmmPing
Browse files Browse the repository at this point in the history
We can rely on the error handling of the actual HTTP API calls to catch
errors, and don't need to call VmmPing explicitly in advance.

Signed-off-by: Bo Chen <[email protected]>
  • Loading branch information
likebreath committed Sep 30, 2020
1 parent 49bd162 commit 0f75801
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,15 +414,12 @@ func (clh *cloudHypervisor) hotplugAddBlockDevice(drive *config.BlockDrive) erro
" using '%v' but only support '%v'", clh.config.BlockDeviceDriver, config.VirtioBlock)
}

var err error

cl := clh.client()
ctx, cancel := context.WithTimeout(context.Background(), clhHotPlugAPITimeout*time.Second)
defer cancel()

_, _, err := cl.VmmPingGet(ctx)
if err != nil {
return openAPIClientError(err)
}

driveID := clhDriveIndexToID(drive.Index)

//Explicitly set PCIAddr to NULL, so that VirtPath can be used
Expand Down Expand Up @@ -451,12 +448,7 @@ func (clh *cloudHypervisor) hotPlugVFIODevice(device config.VFIODev) error {
ctx, cancel := context.WithTimeout(context.Background(), clhHotPlugAPITimeout*time.Second)
defer cancel()

_, _, err := cl.VmmPingGet(ctx)
if err != nil {
return openAPIClientError(err)
}

_, _, err = cl.VmAddDevicePut(ctx, chclient.VmAddDevice{Path: device.SysfsDev})
_, _, err := cl.VmAddDevicePut(ctx, chclient.VmAddDevice{Path: device.SysfsDev})
if err != nil {
err = fmt.Errorf("Failed to hotplug device %+v %s", device, openAPIClientError(err))
}
Expand Down

0 comments on commit 0f75801

Please sign in to comment.