Skip to content

Commit

Permalink
libvirt: Start default network and Capture libvirtd log
Browse files Browse the repository at this point in the history
Capture journalctl log of libvirtd unit when libvirt domain
creation fails.

Start the network using virsh cli before creating node

Signed-off-by: Smit Gardhariya <[email protected]>
  • Loading branch information
smit-gardhariya committed Jan 9, 2025
1 parent 4b8bca8 commit daa2eb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lisa/sut_orchestrator/libvirt/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from lisa.platform_ import Platform
from lisa.sut_orchestrator.libvirt.libvirt_device_pool import LibvirtDevicePool
from lisa.tools import (
Cat,
Chmod,
Chown,
Cp,
Expand Down Expand Up @@ -406,6 +407,12 @@ def _deploy_nodes(self, environment: Environment, log: Logger) -> None:
):
self._delete_nodes(environment, log)

self._log.debug("Capturing libvirtd log from host...")
journalctl = self.host_node.tools[Journalctl]
journalctl.logs_for_unit(unit_name="libvirtd", sudo=True)
cat = self.host_node.tools[Cat]
cat.read(file="/var/log/libvirt/libvirtd.log", sudo=True)

raise ex

# Pre-determine all the nodes' properties, including the name of all the resouces
Expand Down
12 changes: 12 additions & 0 deletions lisa/sut_orchestrator/libvirt/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,18 @@ def _install_libvirt(runbook: schema.TypedSchema, node: Node, log: Logger) -> No
log.info("Enabled libvirtd and virtnetworkd services")
node.reboot(time_out=900)
_wait_for_libvirtd(node)
if isinstance(node.os, CBLMariner):
# Some time we have seen 'default' nw of libvirt is not started
# start it in that case and mark it auto-start
node.execute(
cmd="virsh net-start default",
sudo=True,
)
node.execute(
cmd="virsh net-autostart default",
sudo=True,
)
log.info("Marked 'default' libvirt network as auto-start")


def _wait_for_libvirtd(node: Node) -> None:
Expand Down

0 comments on commit daa2eb9

Please sign in to comment.