Resurrecting an OpenStack backup on a libvirt hypervisor


In the process of moving out of the cloud, the first host is Its latest backup was resurrected on the libvirt hypervisor hosting as follows:

  • mac=,mac=52:54:00:56:f7:8b
  • host=openedx-host
  • service=openedx
  • virt-install --connect qemu:///system --network network=enough-ext$mac --network network=enough-int --boot hd --name $host --memory 8192 --vcpus 4 --cpu host --disk path=/var/lib/libvirt/images/enough/$domain/$host.qcow2,bus=virtio,format=qcow2 --os-type=linux --os-variant=debian10 --graphics vnc --noautoconsole
  • virsh autostart $host
  • ip=$(virsh domifaddr $host)
  • /etc/dhcp/dhclient.conf
    supersede domain-name “$domain”;
    supersede domain-search “$domain”;
    supersede domain-name-servers;
  • ifdown eth0 ; ifup eth0
  • cat .enough/ >> .ssh/authorized_keys
  • add ~/.enough/
    ansible_host: $ip
    ansible_port: 22
  • ~/.enough/$domain/inventory/host_vars/$host/network.yml
    network_primary_interface: eth0
    network_secondary_interface: eth1
  • ~/.enough/$domain/inventory/group_vars/$service-service-group.yml
  • docker network rm

I thought it would be necessary to deactivate cloud-init and other cloud specific settings, but it turns out to work out of the box. With the following caveats:

  • –graphics none blocks, it must be –graphics vnc
  • the dhcp configuration gets two IP for eth0 for an unknown reason but that does not seem to be a problem

For debugging the following proved useful:

  • virsh net-destroy enough-ext ; virsh net-start enough-ext
  • virsh destroy openedx-host ; virsh start openedx-host
  • /var/lib/libvirt/dnsmasq and /etc/libvirt/qemu/networks/enough-ext.xml
  • virsh dumpxml openedx-host ; virsh console openedx-host
  • virsh domifaddr openedx-host

To verify it is working properly the line was added to the hypervisor /etc/hosts file and it was possible see the expected web page from the web browser.