]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
mg-schema-test-database: Borrow shares properly
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 17 Dec 2015 13:16:37 +0000 (13:16 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 5 Jan 2016 17:46:12 +0000 (17:46 +0000)
Previously, the test database would be generated in a broken state:
resources share-host/foo/{1,2,...} exist but the resource host/foo/0
is allocated to magic/xdbref rather than to magic/shared.  This causes
various resource allocation machinery to crash.  (Even if the host is
entirely un-borrowed.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Expand commit message.

mg-schema-test-database

index a4cb732b15a78583cf9df57ea6faa40f8df93538..4e0ee6890f4c828d6a1f4c56bd8a12a0153a0f3a 100755 (executable)
@@ -448,12 +448,22 @@ END
        done
 
        # As we copy, we note everything we're not borrowing as
-       # belonging to the parent db.
+       # belonging to the parent db.  We borrow shares of a shared
+       # resource.  If we borrow only some rather than all of the
+       # shares, neither DB will be able to unshare it.
+
+       # In principle it might be possible to actually use different
+       # shares of the same resource with different dbs.  However the
+       # `sharetype' contains the osstest revision, which prevents
+       # sharing between test and real versions of osstest code.
+
        cat >>$t.import <<END
                $(make_xdbref_task $maindbname 'not borrowed' '' PARENT)
                UPDATE resources
                        SET owntaskid = $(taskid xdbref $maindbname)
-                       WHERE owntaskid != $(borrowtaskid $task);
+                       WHERE owntaskid != $(borrowtaskid $task)
+                         AND owntaskid != $(taskid magic shared)
+                         AND owntaskid != $(taskid magic preparing);
                COMMIT;
 END