mirror of https://github.com/apache/cloudstack.git
bug 11212: disable vlan network when vm fails to start. It is still possible for it leak. For example, if the VM object wasn't constructed and we already failed but those cases are less likely and it's not absolutely necessary to disable vlan.
This commit is contained in:
parent
c50a01fa1f
commit
b04e14425d
|
|
@ -881,6 +881,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
|
||||
try {
|
||||
VM.Record vmr = vm.getRecord(conn);
|
||||
List<Network> networks = new ArrayList<Network>();
|
||||
for (VIF vif : vmr.VIFs) {
|
||||
try {
|
||||
VIF.Record rec = vif.getRecord(conn);
|
||||
networks.add(rec.network);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Unable to cleanup VIF", e);
|
||||
}
|
||||
}
|
||||
if (vmr.powerState == VmPowerState.RUNNING) {
|
||||
try {
|
||||
vm.hardShutdown(conn);
|
||||
|
|
@ -911,6 +920,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
s_logger.warn("Unable to cleanup VIF", e);
|
||||
}
|
||||
}
|
||||
for (Network network : networks) {
|
||||
if (network.getNameLabel(conn).startsWith("VLAN")) {
|
||||
disableVlanNetwork(conn, network);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("VM getRecord failed due to ", e);
|
||||
}
|
||||
|
|
@ -6368,7 +6382,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
* XsNic represents a network and the host's specific PIF.
|
||||
*/
|
||||
protected class XsLocalNetwork {
|
||||
private Network _n;
|
||||
private final Network _n;
|
||||
private Network.Record _nr;
|
||||
private PIF _p;
|
||||
private PIF.Record _pr;
|
||||
|
|
|
|||
Loading…
Reference in New Issue