forked from shaba/openuds
Fixed XEN/XCP-NG network moving on service
This commit is contained in:
parent
c34fc41f56
commit
83394f0d34
@ -477,21 +477,27 @@ class XenServer: # pylint: disable=too-many-public-methods
|
|||||||
# If requested mac address change
|
# If requested mac address change
|
||||||
try:
|
try:
|
||||||
if mac is not None:
|
if mac is not None:
|
||||||
for vifId in self.VM.get_VIFs(vmId):
|
all_VIFs = self.VM.get_VIFs(vmId)
|
||||||
|
if not all_VIFs:
|
||||||
|
raise XenException('No Network interfaces found!')
|
||||||
|
found = (all_VIFs[0], self.VIF.get_record(all_VIFs[0]))
|
||||||
|
for vifId in all_VIFs:
|
||||||
vif = self.VIF.get_record(vifId)
|
vif = self.VIF.get_record(vifId)
|
||||||
|
logger.info('VIF: %s', vif)
|
||||||
|
|
||||||
if vif['network'] == mac['network']:
|
if vif['network'] == mac['network']:
|
||||||
logger.debug('Found VIF: %s', vif['network'])
|
found = (vifId, vif)
|
||||||
self.VIF.destroy(vifId)
|
break
|
||||||
|
|
||||||
|
logger.debug('Found VIF: %s', found[1])
|
||||||
|
vifId, vif = found
|
||||||
|
self.VIF.destroy(vifId)
|
||||||
|
|
||||||
|
vif['MAC'] = mac['mac']
|
||||||
|
vif['network'] = mac['network']
|
||||||
|
vif['MAC_autogenerated'] = False
|
||||||
|
self.VIF.create(vif)
|
||||||
|
|
||||||
# for k in ['status_code', 'status_detail', 'uuid']:
|
|
||||||
# try:
|
|
||||||
# del vif[k]
|
|
||||||
# except:
|
|
||||||
# logger.exception('Erasing property {0}'.format(k))
|
|
||||||
vif['MAC'] = mac['mac']
|
|
||||||
vif['MAC_autogenerated'] = False
|
|
||||||
self.VIF.create(vif)
|
|
||||||
# If requested memory change
|
# If requested memory change
|
||||||
if memory:
|
if memory:
|
||||||
logger.debug('Setting up memory to %s MB', memory)
|
logger.debug('Setting up memory to %s MB', memory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user