]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
mg-schema-test-database: Change username for back-to-main-db xref
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 7 Dec 2015 16:37:03 +0000 (16:37 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 8 Dec 2015 14:51:02 +0000 (14:51 +0000)
The `username' of the xdbref task in the test db, referring to the
main db, is changed to `PARENT' (from `<username>@<nodename>').

Currently this is purely cosmetic, but it is going to be useful to
distinguish the two cases:
 * This is a test DB and contains references to a parent
 * This is a parent DB (probably the main DB) which contains
   references to child test DB(s).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: Fix `DBS' in commit message to `DB(s)'.
v2: New patch

mg-schema-test-database

index b1b5e60b7bb5d8314b7bda329a5c14358ea9aebd..78f26db6e50be597bf402b9bc58b9c3330e0964b 100755 (executable)
@@ -152,10 +152,11 @@ make_xdbref_task () {
        local refkey=$1; shift
        local comment=$1; shift
        local refinfo=$1; shift
+       local taskusername=$1; shift
        echo "
                INSERT INTO tasks
                        (type, refkey, username, comment, live, refinfo)
-                 VALUES ('xdbref','$refkey','$username@$nodename',
+                 VALUES ('xdbref','$refkey','$taskusername',
                          '$comment','t','$refinfo');
        "
 }
@@ -373,7 +374,8 @@ END
        for task in $tasks; do
                psql_do <<END
                        BEGIN;
-                       $(make_xdbref_task $dbname 'borrowed for test db' $task)
+                       $(make_xdbref_task $dbname 'borrowed for test db' \
+                               $task "$username@$nodename")
                        UPDATE resources SET owntaskid = $(borrowtaskid $task)
                                WHERE owntaskid=$task;
                        COMMIT;
@@ -411,7 +413,7 @@ END
        # As we copy, we note everything we're not borrowing as
        # belonging to the parent db.
        cat >>$t.import <<END
-               $(make_xdbref_task $maindbname 'not borrowed' '')
+               $(make_xdbref_task $maindbname 'not borrowed' '' PARENT)
                UPDATE resources
                        SET owntaskid = $(taskid xdbref $maindbname)
                        WHERE owntaskid != $(borrowtaskid $task);