Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.libvirt.DomainSnapshot;
import org.libvirt.LibvirtException;
import org.libvirt.MemoryStatistic;
import org.libvirt.Network;
import org.libvirt.NodeInfo;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Expand Down Expand Up @@ -925,6 +926,20 @@ public boolean configure(final String name, final Map<String, Object> params) th
throw new CloudRuntimeException(e.getMessage());
}

// destroy default network, see https://libvirt.org/sources/java/javadoc/org/libvirt/Network.html
try {
Network network = conn.networkLookupByName("default");
s_logger.debug("Found libvirt default network, destroying it and setting autostart to false");
if (network.isActive() == 1) {
network.destroy();
}
if (network.getAutostart()) {
network.setAutostart(false);
}
} catch (final LibvirtException e) {
s_logger.warn("Ignoring libvirt error.", e);
}

if (HypervisorType.KVM == _hypervisorType) {
/* Does node support HVM guest? If not, exit */
if (!IsHVMEnabled(conn)) {
Expand Down
3 changes: 3 additions & 0 deletions python/lib/cloudutils/networkConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def isBridge(devName):

@staticmethod
def isOvsBridge(devName):
cmd = bash("which ovs-vsctl")
if not cmd.isSuccess():
return False
try:
return 0==subprocess.check_call(("ovs-vsctl", "br-exists", devName))
except subprocess.CalledProcessError:
Expand Down
2 changes: 2 additions & 0 deletions python/lib/cloudutils/serviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ def config(self):

self.syscfg.svo.stopService("libvirt-bin")
self.syscfg.svo.enableService("libvirt-bin")
if os.path.exists("/lib/systemd/system/libvirt-bin.socket"):
bash("systemctl stop libvirt-bin.socket")
return True
except:
raise
Expand Down