@@ -912,9 +912,19 @@ def ReconfigureManagement(self, inPIF, inMode, inIP, inNetmask, inGateway, in
912912 self .RequireSession ()
913913 if inPIF ['primary_address_type' ].lower () == 'ipv4' :
914914 self .session .xenapi .PIF .reconfigure_ip (inPIF ['opaqueref' ], inMode , inIP , inNetmask , inGateway , FirstValue (inDNS , '' ))
915+ if inPIF ['ipv6_configuration_mode' ].lower () == 'static' :
916+ # Update IPv6 DNS as well
917+ self .session .xenapi .PIF .reconfigure_ipv6 (
918+ inPIF ['opaqueref' ], inPIF ['ipv6_configuration_mode' ], inPIF ['IPv6' ], inPIF ['ipv6_gateway' ], FirstValue (inDNS , '' )
919+ )
915920 else :
916921 inIPv6 = inIP + '/' + inNetmask
917922 self .session .xenapi .PIF .reconfigure_ipv6 (inPIF ['opaqueref' ], inMode , inIPv6 , inGateway , FirstValue (inDNS , '' ))
923+ if inPIF ['ip_configuration_mode' ].lower () == 'static' :
924+ # Update IPv4 DNS as well
925+ self .session .xenapi .PIF .reconfigure_ip (
926+ inPIF ['opaqueref' ], inPIF ['ip_configuration_mode' ], inPIF ['IP' ], inPIF ['netmask' ], inPIF ['gateway' ], FirstValue (inDNS , '' )
927+ )
918928 self .session .xenapi .host .management_reconfigure (inPIF ['opaqueref' ])
919929 status , output = commands .getstatusoutput ('%s host-signal-networking-change' % (Config .Inst ().XECLIPath ()))
920930 if status != 0 :
@@ -933,10 +943,8 @@ def DisableManagement(self):
933943 self .session .xenapi .host .management_disable ()
934944 # Disable the PIF that the management interface was using
935945 for pif in self .derived .managementpifs ([]):
936- if pif ['primary_address_type' ].lower () == 'ipv4' :
937- self .session .xenapi .PIF .reconfigure_ip (pif ['opaqueref' ], 'None' ,'' ,'' ,'' ,'' )
938- else :
939- self .session .xenapi .PIF .reconfigure_ipv6 (pif ['opaqueref' ], 'None' ,'' ,'' ,'' )
946+ self .session .xenapi .PIF .reconfigure_ip (pif ['opaqueref' ], 'None' ,'' ,'' ,'' ,'' )
947+ self .session .xenapi .PIF .reconfigure_ipv6 (pif ['opaqueref' ], 'None' ,'' ,'' ,'' )
940948 finally :
941949 # Network reconfigured so this link is potentially no longer valid
942950 self .session = Auth .Inst ().CloseSession (self .session )
0 commit comments