How to find the IP address of Linux guests

There’s a lot of examples in the internet showing how you can obtain the IP address of a libvirt guest virtual machine. Most of the examples show how to do that when the network is using NAT forwarding (aka “Virtual Networks”).

However, how to do that if your setup is using Bridged Networking and your guests receive an IP address from an external DHCP server?

One idea is to install the read the DHCP leases file straight from the guest FS. You can do that by using the libguestfs-tools to cat the file within the image. For RHEL 6 (and CentOS 6 and similar distributions) the process is similar to this:

For RHEL 7 (as well as CentOS 7 and similar) the process is slightly different due to the way NetworkManager stores the leases file:

In this Gist there’s a modified script I used to update the IP address of all guests in one shot.

SonarQube database migration: MariaDB 5.5 to MySQL 5.7

Newer versions of SonarQube have stopped supporting MariaDB and you may need to switch to MySQL instead. While I’d rather use MariaDB, I understand that it is not within the supported matrix. Therefore I am documenting the steps here. The steps are focused on RHEL 7 (they probably would work on Centos 7 as well, but I did not test it).

Before start with this process, shutdown your SonarQube instance as well as any other analysis that may access the database.

The first step is to use mysqldump to create a backup of your MariaDB database:

After the backup is complete, shutdown and disable your MariaDB instance:

Then install MySQL 5.7 from Software Collections. The process is documented on this page. These steps are for 5.6, however, you can just replace 56 with 57 in all the steps and the result is the same.

With the new MySQL 5.7 installed and running, create the database:

In the MySQL sheel recreate the database with the same credentials and permissions as the old one:

Then you can recover the backup into the new MySQL 5.7 instance:

Now you can go to your SonarQube server and start it.