mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-06 12:06:49 +00:00
Merge pull request #4647 from fidencio/topic/fix-clh-crash-when-booting-up-with-no-network-device
clh: Don't crash if no network device is set by the upper layer
This commit is contained in:
commit
0cc20f014d
@ -149,6 +149,11 @@ func (c *clhClientApi) VmRemoveDevicePut(ctx context.Context, vmRemoveDevice chc
|
|||||||
// This is done in order to be able to override such a function as part of
|
// This is done in order to be able to override such a function as part of
|
||||||
// our unit tests, as when testing bootVM we're on a mocked scenario already.
|
// our unit tests, as when testing bootVM we're on a mocked scenario already.
|
||||||
var vmAddNetPutRequest = func(clh *cloudHypervisor) error {
|
var vmAddNetPutRequest = func(clh *cloudHypervisor) error {
|
||||||
|
if clh.netDevices == nil {
|
||||||
|
clh.Logger().Info("No network device has been configured by the upper layer")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
addr, err := net.ResolveUnixAddr("unix", clh.state.apiSocket)
|
addr, err := net.ResolveUnixAddr("unix", clh.state.apiSocket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user