Show the error code in network config
If there is a problem with static addresses setting, then throw an exception containing the error code (returned value) for a better understanding of the issue. Change-Id: I44cdeec667c98212dbab6b303d3bd5765b8ea9c0
This commit is contained in:
parent
00f995f5cd
commit
1add169cc5
@ -560,7 +560,8 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
(ret_val,) = adapter_config.EnableStatic([address], [netmask])
|
||||
if ret_val > 1:
|
||||
raise exception.CloudbaseInitException(
|
||||
"Cannot set static IP address on network adapter")
|
||||
"Cannot set static IP address on network adapter (%d)",
|
||||
ret_val)
|
||||
reboot_required = (ret_val == 1)
|
||||
|
||||
if gateway:
|
||||
@ -568,7 +569,8 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
(ret_val,) = adapter_config.SetGateways([gateway], [1])
|
||||
if ret_val > 1:
|
||||
raise exception.CloudbaseInitException(
|
||||
"Cannot set gateway on network adapter")
|
||||
"Cannot set gateway on network adapter (%d)",
|
||||
ret_val)
|
||||
reboot_required = reboot_required or ret_val == 1
|
||||
|
||||
if dnsnameservers:
|
||||
@ -576,7 +578,8 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
(ret_val,) = adapter_config.SetDNSServerSearchOrder(dnsnameservers)
|
||||
if ret_val > 1:
|
||||
raise exception.CloudbaseInitException(
|
||||
"Cannot set DNS on network adapter")
|
||||
"Cannot set DNS on network adapter (%d)",
|
||||
ret_val)
|
||||
reboot_required = reboot_required or ret_val == 1
|
||||
|
||||
return reboot_required
|
||||
|
Loading…
x
Reference in New Issue
Block a user