CA-286342: SRIOV should be enabled on master when 2 NICs are not the … (#1998)

* CA-286342: SRIOV should be enabled on master when 2 NICs are not the same type

Signed-off-by: Jisheng Xing <jisheng.xing@citrix.com>

* set the ExpectDisruption as false after action finished
This commit is contained in:
jishengx 2018-03-22 21:53:33 +08:00 committed by Cheng Zhang
parent 59ba1db95f
commit a635c6e3f5

View File

@ -56,10 +56,37 @@ namespace XenAdmin.Actions
// Create the new network
XenRef<XenAPI.Network> networkRef = XenAPI.Network.create(Session, newNetwork);
PIF pifOnMaster =null;
foreach (PIF thePif in selectedPifs)
{
Network_sriov.async_create(Session, thePif.opaque_ref, networkRef);
Host host = thePif.Connection.Resolve<XenAPI.Host>(thePif.host);
if (host == null)
continue;
if (host.IsMaster())
{
pifOnMaster = thePif;
break;
}
}
Connection.ExpectDisruption = true;
// Enable SR-IOV network on Pool Master
RelatedTask = Network_sriov.async_create(Session, pifOnMaster.opaque_ref, networkRef);
PollToCompletion(0, 100);
// Enable SR-IOV network on Pool Slaves
selectedPifs.Remove(pifOnMaster);
foreach (PIF thePif in selectedPifs)
{
Network_sriov.create(Session, thePif.opaque_ref, networkRef);
}
}
protected override void Clean()
{
Connection.ExpectDisruption = false;
}
}
}