mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Destroy unplugged VIFs before creating a VIF for a VM
This commit is contained in:
parent
ad60eed4a9
commit
8f9d87c6d9
@ -3947,6 +3947,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
while (vifIter.hasNext()) {
|
||||
VIF vif = vifIter.next();
|
||||
try {
|
||||
String deviceId = vif.getDevice(conn);
|
||||
if(vm.getIsControlDomain(conn) || vif.getCurrentlyAttached(conn)) {
|
||||
usedDeviceNums.add(Integer.valueOf(deviceId));
|
||||
} else {
|
||||
s_logger.debug("Found unplugged VIF " + deviceId + " in VM " + vmName + " destroy it");
|
||||
vif.destroy(conn);
|
||||
}
|
||||
usedDeviceNums.add(Integer.valueOf(vif.getDevice(conn)));
|
||||
} catch (NumberFormatException e) {
|
||||
String msg = "Obtained an invalid value for an allocated VIF device number for VM: " + vmName;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user