]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts: add libvirt util functions to build_utils.sh
authorAndrew Schoen <aschoen@redhat.com>
Tue, 2 May 2017 12:45:28 +0000 (07:45 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 2 May 2017 18:57:44 +0000 (13:57 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
scripts/build_utils.sh

index db5e7e8655565e033f3255a8145008c1f6fe90b8..2c8c2567e4a12125c2f4ed54b93879a89625948d 100644 (file)
@@ -406,3 +406,18 @@ setup_pbuilder() {
         --mirror "$mirror"
     fi
 }
+
+clear_libvirt_networks() {
+    # Sometimes, networks may linger around, so we must ensure they are killed:
+    networks=`sudo virsh net-list --all | grep active | egrep -v "(default|libvirt)" | cut -d ' ' -f 2`
+    for network in $networks; do
+        sudo virsh net-destroy $network || true
+        sudo virsh net-undefine $network || true
+    done
+}
+
+restart_libvirt_services() {
+    # restart libvirt services
+    sudo service libvirt-bin restart
+    sudo service libvirt-guests restart
+}