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