Resurrecting an OpenStack backup on a libvirt hypervisor

Bonjour,

In the process of moving enough.community out of the cloud, the first host is https://openedx.enough.community. Its latest backup was resurrected on the libvirt hypervisor hosting lan.enough.community as follows:

  • mac=,mac=52:54:00:56:f7:8b
  • domain=lan.enough.community
  • 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 10.23.10.2;
  • ifdown eth0 ; ifup eth0
  • cat .enough/lan.enough.community/infrastructure_key.pub >> .ssh/authorized_keys
  • add ~/.enough/lan.enough.community/inventory/hosts.yml
    $host:
    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 enough.community

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 10.23.10.146 openedx.lan.enough.community was added to the hypervisor /etc/hosts file and it was possible see the expected web page from the web browser.