render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 0dc8024eae1f56e02228171feb824becf21ee697 Mon Sep 17 00:00:00 2001
Message-Id: <0dc8024eae1f56e02228171feb824becf21ee697@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 17 Mar 2020 17:12:46 +0100
Subject: [PATCH] qemublocktest: Add tests for re-enabling of bitmaps after
 commit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Some branches were not covered and thus we didn't catch that the bitmaps
are not re-enabled if nothing is merged into them. Two bitmaps are
necessary to reliably test the case due to hash table ordering.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit cab3622119a73a54e62e5f2d7b4257da00bd4ac8)
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
Message-Id: <fc3f48f6a5233fce3148fc21a63c4e0255b2e466.1584461519.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 .../bitmap/snapshots-synthetic-broken.json    | 18 ++++++++
 .../bitmap/snapshots-synthetic-broken.out     |  2 +
 .../snapshots-synthetic-broken-1-2            | 30 ++++++++++++
 .../snapshots-synthetic-broken-1-3            | 46 +++++++++++++++++++
 .../snapshots-synthetic-broken-1-4            | 46 +++++++++++++++++++
 .../snapshots-synthetic-broken-1-5            | 46 +++++++++++++++++++
 .../snapshots-synthetic-broken-2-3            | 46 +++++++++++++++++++
 .../snapshots-synthetic-broken-2-4            | 46 +++++++++++++++++++
 .../snapshots-synthetic-broken-2-5            | 46 +++++++++++++++++++
 9 files changed, 326 insertions(+)

diff --git a/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.json b/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.json
index bf4963494f..8cf14d4baa 100644
--- a/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.json
+++ b/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.json
@@ -398,6 +398,24 @@
                 "granularity": 65536,
                 "count": 0
             },
+            {
+                "name": "oa",
+                "recording": true,
+                "persistent": true,
+                "busy": false,
+                "status": "active",
+                "granularity": 65536,
+                "count": 0
+            },
+            {
+                "name": "ob",
+                "recording": true,
+                "persistent": true,
+                "busy": false,
+                "status": "active",
+                "granularity": 65536,
+                "count": 0
+            },
             {
                 "name": "d",
                 "recording": true,
diff --git a/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.out b/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.out
index 022630bd76..ad24a580f1 100644
--- a/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.out
+++ b/tests/qemublocktestdata/bitmap/snapshots-synthetic-broken.out
@@ -3,6 +3,8 @@ libvirt-1-format:
   current: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
 libvirt-2-format:
         c: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+       oa: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+       ob: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
         d: record:1 busy:0 persist:1 inconsist:1 gran:65536 dirty:0
 libvirt-3-format:
         a: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-2 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-2
index d413fbe723..463120d442 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-2
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-2
@@ -1,4 +1,20 @@
 pre job bitmap disable:
+[
+  {
+    "type": "block-dirty-bitmap-disable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "oa"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-disable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "ob"
+    }
+  }
+]
 merge bitmpas:
 [
   {
@@ -23,5 +39,19 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "oa"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "ob"
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-3
index 6eb14f927a..fec6f95dd1 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-3
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-3
@@ -62,5 +62,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-4
index f4d9b72576..697230f67b 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-4
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-4
@@ -69,5 +69,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-5
index a8e575c2d9..6bf1f0da64 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-5
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-1-5
@@ -69,5 +69,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-3
index d468e2b9d8..f202bb94b1 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-3
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-3
@@ -39,5 +39,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-4
index 2a9986bac6..864cc9041b 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-4
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-4
@@ -46,5 +46,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-5
index 47d9f6e17a..4c5d8dbe80 100644
--- a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-5
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-2-5
@@ -46,5 +46,51 @@ merge bitmpas:
         }
       ]
     }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "oa",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "oa",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "oa"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "ob",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "ob",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "ob"
+        }
+      ]
+    }
   }
 ]
-- 
2.25.1