1 | -- $Id: tmdb-r14-testboxes-2.pgsql 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | --- @file
|
---|
3 | -- VBox Test Manager Database - Adds sCpuName, lCpuRevision and sReport to TestBoxes.
|
---|
4 | --
|
---|
5 |
|
---|
6 | --
|
---|
7 | -- Copyright (C) 2013-2020 Oracle Corporation
|
---|
8 | --
|
---|
9 | -- This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | -- available from http://www.virtualbox.org. This file is free software;
|
---|
11 | -- you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | -- General Public License (GPL) as published by the Free Software
|
---|
13 | -- Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | -- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | -- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | --
|
---|
17 | -- The contents of this file may alternatively be used under the terms
|
---|
18 | -- of the Common Development and Distribution License Version 1.0
|
---|
19 | -- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | -- VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | -- CDDL are applicable instead of those of the GPL.
|
---|
22 | --
|
---|
23 | -- You may elect to license modified versions of this file under the
|
---|
24 | -- terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | --
|
---|
26 |
|
---|
27 |
|
---|
28 | DROP TABLE OldTestBoxes;
|
---|
29 | DROP TABLE NewTestBoxes;
|
---|
30 |
|
---|
31 | \d TestBoxes;
|
---|
32 |
|
---|
33 | \set ON_ERROR_STOP 1
|
---|
34 | \set AUTOCOMMIT 0
|
---|
35 |
|
---|
36 | LOCK TABLE TestBoxStatuses IN ACCESS EXCLUSIVE MODE;
|
---|
37 | LOCK TABLE TestSets IN ACCESS EXCLUSIVE MODE;
|
---|
38 | LOCK TABLE TestBoxes IN ACCESS EXCLUSIVE MODE;
|
---|
39 |
|
---|
40 | DROP INDEX TestBoxesUuidIdx;
|
---|
41 |
|
---|
42 | --
|
---|
43 | -- Rename the original table, drop constrains and foreign key references so we
|
---|
44 | -- get the right name automatic when creating the new one.
|
---|
45 | --
|
---|
46 | ALTER TABLE TestBoxes RENAME TO OldTestBoxes;
|
---|
47 |
|
---|
48 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_ccpus_check;
|
---|
49 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_check;
|
---|
50 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbmemory_check;
|
---|
51 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbscratch_check;
|
---|
52 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pctscaletimeout_check;
|
---|
53 |
|
---|
54 | ALTER TABLE TestBoxStatuses DROP CONSTRAINT TestBoxStatuses_idGenTestBox_fkey;
|
---|
55 | ALTER TABLE TestSets DROP CONSTRAINT TestSets_idGenTestBox_fkey;
|
---|
56 |
|
---|
57 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pkey;
|
---|
58 | ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_idgentestbox_key;
|
---|
59 |
|
---|
60 | --
|
---|
61 | -- Create the new table, filling it with the current TestBoxes content.
|
---|
62 | --
|
---|
63 | CREATE TABLE TestBoxes (
|
---|
64 | --- The fixed testbox ID.
|
---|
65 | -- This is assigned when the testbox is created and will never change.
|
---|
66 | idTestBox INTEGER DEFAULT NEXTVAL('TestBoxIdSeq') NOT NULL,
|
---|
67 | --- When this row starts taking effect (inclusive).
|
---|
68 | tsEffective TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp NOT NULL,
|
---|
69 | --- When this row stops being tsEffective (exclusive).
|
---|
70 | tsExpire TIMESTAMP WITH TIME ZONE DEFAULT TIMESTAMP WITH TIME ZONE 'infinity' NOT NULL,
|
---|
71 | --- The user id of the one who created/modified this entry.
|
---|
72 | -- When modified automatically by the testbox, NULL is used.
|
---|
73 | -- Non-unique foreign key: Users(uid)
|
---|
74 | uidAuthor INTEGER DEFAULT NULL,
|
---|
75 | --- Generation ID for this row.
|
---|
76 | -- This is primarily for referencing by TestSets.
|
---|
77 | idGenTestBox INTEGER UNIQUE DEFAULT NEXTVAL('TestBoxGenIdSeq') NOT NULL,
|
---|
78 |
|
---|
79 | --- The testbox IP.
|
---|
80 | -- This is from the webserver point of view and automatically updated on
|
---|
81 | -- SIGNON. The test setup doesn't permit for IP addresses to change while
|
---|
82 | -- the testbox is operational, because this will break gang tests.
|
---|
83 | ip inet NOT NULL,
|
---|
84 | --- The system or firmware UUID.
|
---|
85 | -- This uniquely identifies the testbox when talking to the server. After
|
---|
86 | -- SIGNON though, the testbox will also provide idTestBox and ip to
|
---|
87 | -- establish its identity beyond doubt.
|
---|
88 | uuidSystem uuid NOT NULL,
|
---|
89 | --- The testbox name.
|
---|
90 | -- Usually similar to the DNS name.
|
---|
91 | sName text NOT NULL,
|
---|
92 | --- Optional testbox description.
|
---|
93 | -- Intended for describing the box as well as making other relevant notes.
|
---|
94 | sDescription text DEFAULT NULL,
|
---|
95 |
|
---|
96 | --- Reference to the scheduling group that this testbox is a member of.
|
---|
97 | -- Non-unique foreign key: SchedGroups(idSchedGroup)
|
---|
98 | -- A testbox is always part of a group, the default one nothing else.
|
---|
99 | idSchedGroup INTEGER DEFAULT 1 NOT NULL,
|
---|
100 |
|
---|
101 | --- Indicates whether this testbox is enabled.
|
---|
102 | -- A testbox gets disabled when we're doing maintenance, debugging a issue
|
---|
103 | -- that happens only on that testbox, or some similar stuff. This is an
|
---|
104 | -- alternative to deleting the testbox.
|
---|
105 | fEnabled BOOLEAN DEFAULT NULL,
|
---|
106 |
|
---|
107 | --- The kind of lights-out-management.
|
---|
108 | enmLomKind LomKind_T DEFAULT 'none'::LomKind_T NOT NULL,
|
---|
109 | --- The IP adress of the lights-out-management.
|
---|
110 | -- This can be NULL if enmLomKind is 'none', otherwise it must contain a valid address.
|
---|
111 | ipLom inet DEFAULT NULL,
|
---|
112 |
|
---|
113 | --- Timeout scale factor, given as a percent.
|
---|
114 | -- This is a crude adjustment of the test case timeout for slower hardware.
|
---|
115 | pctScaleTimeout smallint DEFAULT 100 NOT NULL CHECK (pctScaleTimeout > 10 AND pctScaleTimeout < 20000),
|
---|
116 |
|
---|
117 | --- @name Scheduling properties (reported by testbox script).
|
---|
118 | -- @{
|
---|
119 | --- Same abbrieviations as kBuild, see KBUILD_OSES.
|
---|
120 | sOs text DEFAULT NULL,
|
---|
121 | --- Informational, no fixed format.
|
---|
122 | sOsVersion text DEFAULT NULL,
|
---|
123 | --- Same as CPUID reports (GenuineIntel, AuthenticAMD, CentaurHauls, ...).
|
---|
124 | sCpuVendor text DEFAULT NULL,
|
---|
125 | --- Same as kBuild - x86, amd64, ... See KBUILD_ARCHES.
|
---|
126 | sCpuArch text DEFAULT NULL,
|
---|
127 | --- The CPU name if available.
|
---|
128 | sCpuName text DEFAULT NULL,
|
---|
129 | --- Number identifying the CPU family/model/stepping/whatever.
|
---|
130 | -- For x86 and AMD64 type CPUs, this will on the following format:
|
---|
131 | -- (EffFamily << 24) | (EffModel << 8) | Stepping.
|
---|
132 | lCpuRevision bigint DEFAULT NULL,
|
---|
133 | --- Number of CPUs, CPU cores and CPU threads.
|
---|
134 | cCpus smallint DEFAULT NULL CHECK (cCpus IS NULL OR cCpus > 0),
|
---|
135 | --- Set if capable of hardware virtualization.
|
---|
136 | fCpuHwVirt boolean DEFAULT NULL,
|
---|
137 | --- Set if capable of nested paging.
|
---|
138 | fCpuNestedPaging boolean DEFAULT NULL,
|
---|
139 | --- Set if CPU capable of 64-bit (VBox) guests.
|
---|
140 | fCpu64BitGuest boolean DEFAULT NULL,
|
---|
141 | --- Set if chipset with usable IOMMU (VT-d / AMD-Vi).
|
---|
142 | fChipsetIoMmu boolean DEFAULT NULL,
|
---|
143 | --- The (approximate) memory size in megabytes (rounded down to nearest 4 MB).
|
---|
144 | cMbMemory bigint DEFAULT NULL CHECK (cMbMemory IS NULL OR cMbMemory > 0),
|
---|
145 | --- The amount of scratch space in megabytes (rounded down to nearest 64 MB).
|
---|
146 | cMbScratch bigint DEFAULT NULL CHECK (cMbScratch IS NULL OR cMbScratch >= 0),
|
---|
147 | --- Free form hardware and software report field.
|
---|
148 | sReport text DEFAULT NULL,
|
---|
149 | --- @}
|
---|
150 |
|
---|
151 | --- The testbox script revision number, serves the purpose of a version number.
|
---|
152 | -- Probably good to have when scheduling upgrades as well for status purposes.
|
---|
153 | iTestBoxScriptRev INTEGER DEFAULT 0 NOT NULL,
|
---|
154 | --- The python sys.hexversion (layed out as of 2.7).
|
---|
155 | -- Good to know which python versions we need to support.
|
---|
156 | iPythonHexVersion INTEGER DEFAULT NULL,
|
---|
157 |
|
---|
158 | --- Pending command.
|
---|
159 | -- @note We put it here instead of in TestBoxStatuses to get history.
|
---|
160 | enmPendingCmd TestBoxCmd_T DEFAULT 'none'::TestBoxCmd_T NOT NULL,
|
---|
161 |
|
---|
162 | PRIMARY KEY (idTestBox, tsExpire),
|
---|
163 |
|
---|
164 | --- Nested paging requires hardware virtualization.
|
---|
165 | CHECK (fCpuNestedPaging IS NULL OR (fCpuNestedPaging <> TRUE OR fCpuHwVirt = TRUE))
|
---|
166 | );
|
---|
167 |
|
---|
168 | INSERT INTO TestBoxes ( idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
|
---|
169 | idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, sCpuName,
|
---|
170 | lCpuRevision, cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest, fChipsetIoMmu, cMbMemory, cMbScratch, sReport,
|
---|
171 | iTestBoxScriptRev, iPythonHexVersion, enmPendingCmd )
|
---|
172 | SELECT idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
|
---|
173 | idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, NULL,
|
---|
174 | NULL, cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest, fChipsetIoMmu, cMbMemory, cMbScratch, NULL,
|
---|
175 | iTestBoxScriptRev, iPythonHexVersion, enmPendingCmd
|
---|
176 | FROM OldTestBoxes;
|
---|
177 |
|
---|
178 | -- Add index.
|
---|
179 | CREATE UNIQUE INDEX TestBoxesUuidIdx ON TestBoxes (uuidSystem, tsExpire);
|
---|
180 |
|
---|
181 | -- Restore foreign key references to the table.
|
---|
182 | ALTER TABLE TestBoxStatuses ADD CONSTRAINT TestBoxStatuses_idGenTestBox_fkey FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
|
---|
183 | ALTER TABLE TestSets ADD CONSTRAINT TestSets_idGenTestBox_fkey FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
|
---|
184 |
|
---|
185 | -- Drop the old table.
|
---|
186 | DROP TABLE OldTestBoxes;
|
---|
187 |
|
---|
188 | COMMIT;
|
---|
189 |
|
---|
190 | \d TestBoxes;
|
---|
191 |
|
---|