Project

General

Profile

Wiki » History » Version 155

tinita, 2022-02-24 18:38

1 3 okurz
# Introduction
2 1 alarrosa
3 3 okurz
This is the organisation wiki for the **openQA Project**.
4 49 okurz
The source code is hosted in the [os-autoinst github project](http://github.com/os-autoinst/), especially [openQA itself](http://github.com/os-autoinst/openQA) and the main backend [os-autoinst](http://github.com/os-autoinst/os-autoinst)
5 1 alarrosa
6 48 okurz
If you are interested in the tests for SUSE/openSUSE products take a look into the [openqatests](https://progress.opensuse.org/projects/openqatests) project.
7
8 70 szarate
If you are looking for entry level issues to contribute to the backend, take a look at [this search query](https://progress.opensuse.org/projects/openqav3/search?utf8=%E2%9C%93&issues=1&q=entrance+level+issue)
9
10 14 okurz
{{toc}}
11
12 3 okurz
# Organisational
13 1 alarrosa
14 51 okurz
## ticket workflow
15
16 65 SLindoMansilla
Picture: http://imagebin.suse.de/2127/img
17 64 SLindoMansilla
18 51 okurz
The following ticket statuses are used together and their meaning is explained:
19
20 63 okurz
* *New*: No one has worked on the ticket (e.g. the ticket has not been properly refined) or no one is feeling responsible for the work on this ticket.
21 73 riafarov
* *Workable*: The ticket has been refined and is ready to be picked.
22
* *In Progress*: Assignee is actively working on the ticket.
23 1 alarrosa
* *Resolved*: The complete work on this issue is done and the according issue is supposed to be fixed as observed (Should be updated together with a link to a merged pull request or also a link to an production openQA showing the effect)
24 73 riafarov
* *Feedback*: Further work on the ticket is blocked by open points or is awaiting for the feedback to proceed. Sometimes also used to ask Assignee about progress on inactivity.
25 74 okurz
* *Blocked*: Further work on the ticket is blocked by some external dependency (e.g. bugs, not implemented features). There should be a link to another ticket, bug, trello card, etc. where it can be seen what the ticket is blocked by.
26 51 okurz
* *Rejected*: The issue is considered invalid, should not be done, is considered out of scope.
27
* *Closed*: As this can be set only by administrators it is suggested to not use this status.
28
29
It is good practice to update the status together with a comment about it, e.g. a link to a pull request or a reason for reject.
30
31 80 okurz
## ticket categories
32
33
* *Concrete Bugs*: Regressions, crashes, error messages
34
* *Feature requests*: Ideas or wishes for extension, enhancement, improvement
35
* *Organisational*: Organisational tasks within the project(s), not directly code related
36
* *Support*: Support of users, usage problems, questions
37
38 1 alarrosa
Please avoid the use of other, deprecated categories
39
40
Suggestion by *okurz*: I recommend to avoid the word "bug" in our categories because of the usual "is it a bug or a feature" struggle. Instead I suggest to strictly define "Regressions & Crashes" to clearly separate "it used to work in before" from "this was never part of requirements" for Features. Any ticket of this category also means that our project processes missed something so we have points for improvements, e.g. extend things to look out for in code review.
41 100 okurz
42
## Epics and Sagas
43
44
[epic]s and [saga]s belong to the "coordination" tracker, project contributors are not required to follow this convention but the tracker may be changed automagically in the future: http://mailman.suse.de/mailman/private/qa-sle/2020-October/002722.html 
45 83 okurz
46 13 okurz
## ticket templates
47
You can use these templates to fill in tickets and further improve them with more detail over time. Copy the code block, paste it into a new issue, replace every block marked with "<…>" with your content or delete if not appropriate.
48
49 71 nicksinger
### Defects
50 13 okurz
51
Subject: `<Short description, example: "openQA dies when triggering any Windows ME tests">`
52
53 1 alarrosa
54 13 okurz
```
55 71 nicksinger
## Observation
56 13 okurz
<description of what can be observed and what the symptoms are, provide links to failing test results and/or put short blocks from the log output here to visualize what is happening>
57
58 71 nicksinger
## Steps to reproduce
59 1 alarrosa
* <do this>
60 13 okurz
* <do that>
61 1 alarrosa
* <observe result>
62 13 okurz
63 71 nicksinger
## Problem
64 13 okurz
<problem investigation, can also include different hypotheses, should be labeled as "H1" for first hypothesis, etc.>
65
66 71 nicksinger
## Suggestion
67 123 okurz
* <what to do as a first step>
68
* <Fix the actual problem>
69
* <Consider fixing the design>
70
* <Consider fixing the team's process>
71
* <Consider to explore further>
72 13 okurz
73 71 nicksinger
## Workaround
74 13 okurz
<example: retrigger job>
75
```
76
77
example ticket: #10526
78
79 104 okurz
For tickets referencing "auto_review" see
80
https://github.com/os-autoinst/scripts/blob/master/README.md#auto-review---automatically-detect-known-issues-in-openqa-jobs-label-openqa-jobs-with-ticket-references-and-optionally-retrigger
81
for a suggested template snippet.
82
83 72 nicksinger
### Feature requests
84 13 okurz
85
Subject: `<Short description, example: "grub3 btrfs support" (feature)>`
86
87
88
```
89
## User story
90
<As a <role>, I want to <do an action>, to <achieve which goal> >
91
92 72 nicksinger
## Acceptance criteria
93 13 okurz
* <**AC1:** the first acceptance criterion that needs to be fulfilled to do this, example: Clicking "restart button" causes restart of the job>
94
* <**AC2:** also think about the "not-actions", example: other jobs are not affected>
95
96 72 nicksinger
## Tasks
97 13 okurz
* <first task to do as an easy starting point>
98 69 okurz
* <what do do next, all tasks optionally with an effort estimation in hours, e.g. "(0.5-2h)">
99 13 okurz
* <optional: mark "optional" tasks>
100
101 72 nicksinger
## Further details
102 17 okurz
<everything that does not fit into above sections>
103 13 okurz
```
104
105
example ticket: #10212
106
107 62 SLindoMansilla
## Further decision steps working on test issues
108 61 SLindoMansilla
109 62 SLindoMansilla
Test issues could be one of the following sources. Feel free to use the following template in tickets as well
110 1 alarrosa
111 62 SLindoMansilla
```
112
## Problem
113
* **H1** The product has changed
114
 * **H1.1** product changed slightly but in an acceptable way without the need for communication with DEV+RM --> adapt test
115
 * **H1.2** product changed slightly but in an acceptable way found after feedback from RM --> adapt test
116
 * **H1.3** product changed significantly --> after approval by RM adapt test
117 61 SLindoMansilla
118 62 SLindoMansilla
* **H2** Fails because of changes in test setup
119
 * **H2.1** Our test hardware equipment behaves different
120
 * **H2.2** The network behaves different
121
122
* **H3** Fails because of changes in test infrastructure software, e.g. os-autoinst, openQA
123
* **H4** Fails because of changes in test management configuration, e.g. openQA database settings
124
* **H5** Fails because of changes in the test software itself (the test plan in source code as well as needles)
125
* **H6** Sporadic issue, i.e. the root problem is already hidden in the system for a long time but does not show symptoms every time
126
```
127 25 okurz
128
## pull request handling on github
129
130
As a reviewer of pull requests on github for all related repositories, e.g. https://github.com/os-autoinst/os-autoinst-distri-opensuse/pulls, apply labels in case PRs are open for a longer time and can not be merged so that we keep our backlog clean and know why PRs are blocked.
131
132
* **notready**: Triaged as not ready yet for merging, no (immediate) reaction by the reviewee, e.g. when tests are missing, other scenarios break, only tested for one of SLE/TW
133
* **wip**: Marked by the reviewee itself as "[WIP]" or "[DO-NOT-MERGE]" or similar
134
* **question**: Questions to the reviewee, not answered yet
135 54 okurz
136
137
## Where to contribute?
138
139
If you want to help openQA development you can take a look into the existing [issues](https://progress.opensuse.org/projects/openqav3/issues). There are also some "always valid" tasks to be working on:
140
141
* *improve test coverage*:
142
 * *user story*: As openqa backend as well as test developer I want better test coverage of our projects to reduce technical debt
143
 * *acceptance criteria*: test coverage is significantly higher than before
144
 * *suggestions*: check current coverage in each individual project (os-autoinst/openQA/os-autoinst-distri-opensuse) and add tests as necessary
145
146 28 okurz
147 1 alarrosa
# Use cases
148 40 okurz
149 28 okurz
The following use cases 1-6 have been defined within a SUSE workshop (others have been defined later) to clarify how different actors work with openQA. Some of them are covered already within openQA quite well, some others are stated as motivation for further feature development.
150
151 6 okurz
## Use case 1
152 4 okurz
**User:** QA-Project Managment
153 1 alarrosa
**primary actor:** QA Project Manager, QA Team Leads
154
**stakeholder:** Directors, VP
155 7 okurz
**trigger:** product milestones, providing a daily status
156 1 alarrosa
**user story:** „As a QA project manager I want to check on a daily basis the „openQA Dashboard“ to get a summary/an overall status of the „reviewers results“ in order to take the right actions and prioritize tasks in QA accordingly.“
157 28 okurz
	
158 4 okurz
## Use case 2
159 1 alarrosa
**User:** openQA-Admin
160
**primary actor:** Backend-Team
161 4 okurz
**stakeholder:** Qa-Prjmgr, QA-TL, openQA Tech-Lead
162 7 okurz
**trigger:** Bugs, features, new testcases
163 5 okurz
**user story:** „As an openQA admin I constantly check in the web-UI the system health and I manage its configuration to ensure smooth operation of the tool.“
164 28 okurz
165 1 alarrosa
## Use case 3
166
**User:** QA-Reviewer
167
**primary actor:** QA-Team
168 4 okurz
**stakeholder:** QA-Prjmgr, Release-Mgmt, openQA-Admin
169 7 okurz
**trigger:** every new build
170
**user story:** „As an openQA-Reviewer at any point in time I review on the webpage of openQA the overall status of a build in order to track and find bugs, because I want to find bugs as early as possible and report them.“
171 28 okurz
172 1 alarrosa
## Use case 4
173
**User:** Testcase-Contributor
174 4 okurz
**primary actor:** All development teams, Maintenance QA
175 5 okurz
**stakeholder:** QA-Reviewer, openQA-Admin, openQA Tech-Lead
176 40 okurz
**trigger:** features, new functionality, bugs, new product/package
177 7 okurz
**user story:** „As developer when there are new features, new functionality, bugs, new product/package in git I contribute my testcases because I want to ensure good quality submissions and smooth product integration.“
178 28 okurz
179 4 okurz
## Use case 5
180
**User:** Release-Mgmt
181
**primary actor:** Release Manager
182 1 alarrosa
**stakeholder:** Directors, VP, PM, TAMs, Partners
183 7 okurz
**trigger:** Milestones
184
**user story:** „As a Release-Manager on a daily basis I check on a dashboard for the product health/build status in order to act early in case of failures and have concrete and current reports.“
185 28 okurz
186 4 okurz
## Use case 6
187
**User:** Staging-Admin
188
**primary actor:** Staging-Manager for the products
189 1 alarrosa
**stakeholder:** Release-Mgmt, Build-Team
190
**trigger:** every single submission to projects
191 40 okurz
**user story:** „As a Staging-Manager I review the build status of packages with every staged submission to the „staging projects“ in the „staging dashboard“ and the test-status of the pre-integrated fixes, because I want to identify major breakage before integration to the products and provide fast feedback back to the development.“
192
193
## Use case 7
194
**User:** Bug investigator
195
**primary actor:** Any bug assignee for openQA observed bugs
196
**stakeholder:** Developer
197
**trigger:** bugs
198 8 okurz
**user story:** „As a developer that has been assigned a bug which has been observed in openQA I can review referenced tests, find a newer and the most recent job in the same scenario, understand what changed since the last successful job, what other jobs show same symptoms to investigate the root cause fast and use openQA for verification of a bug fix.“
199 15 okurz
200 8 okurz
# Thoughts about categorizing test results, issues, states within openQA
201
by okurz
202
203
When reviewing test results it is important to distinguish between different causes of "failed tests"
204
205
## Nomenclature
206
207 58 okurz
### Test status categories
208 1 alarrosa
A common definition about the status of a test regarding the product it tests: "false|true positive|negative" as described on https://en.wikipedia.org/wiki/False_positives_and_false_negatives. "positive|negative" describes the outcome of a test ("positive": test signals presence of issue; "negative": no signal) whereas "false|true" describes the conclusion of the test regarding the presence of issues in the SUT or product in our case ("true": correct reporting; "false": incorrect reporting), e.g. "true negative", test successful, no issues detected and there are no issues, product is working as expected by customer. Another example: Think of testing as of a fire alarm. An alarm (event detector) should only go off (be "positive") *if* there is a fire (event to detect) --> "true positive" whereas *if* there is *no* fire there should be *no* alarm --> "true negative".
209 10 okurz
210 1 alarrosa
Another common but potentially ambiguous categorization:
211 10 okurz
212
* *broken*: the test is not behaving as expected (Ambiguity: "as expected" by whom?) --> commonly a "false positive", can also be "false negative" but hard to detect
213
* *failing*: the test is behaving as expected, but the test output is a fail --> "true positive"
214
* *working*: the test is behaving as expected (with no comment regarding the result, though some might ambiguously imply 'result is negative')
215
* *passing*: the test is behaving as expected, but the result is a success --> "true negative"
216 8 okurz
217 9 okurz
If in doubt declare a test as "broken". We should review the test and examine if it is behaving as expected.
218 10 okurz
219 8 okurz
Be careful about "positive/negative" as some might also use "positive" to incorrectly denote a passing test (and "negative" for failing test) as an indicator of "working product" not an indicator about "issue present". If you argue what is "used in common speech" think about how "false positive" is used as in "false alarm" --> "positive" == "alarm raised", also see https://narainko.wordpress.com/2012/08/26/understanding-false-positive-and-false-negative/
220
221 10 okurz
### Priorization of work regarding categories
222 3 okurz
In this sense development+QA want to accomplish a "true negative" state whenever possible (no issues present, therefore none detected). As QA and test developers we want to prevent "false positives" ("false alarms" declaring a product as broken when it is not but the test failed for other reasons), also known as "type I error" and "false negatives" (a product issue is not catched by tests and might "slip through" QA and at worst is only found by an external outside customer) also known as "type II error". Also see https://en.wikipedia.org/wiki/Type_I_and_type_II_errors. In the context of openQA and system testing paired with screen matching a "false positive" is much more likely as the tests are very susceptible to subtle variations and changes even if they should be accepted. So when in doubt, create an issue in progress, look at it again, and find that it was a false alarm, rather than wasting more peoples time with INVALID bug reports by believing the product to be broken when it isn't. To quote Richard Brown: "I […] believe this is the route to ongoing improvement - if we have tests which produce such false alarms, then that is a clear indicator that the test needs to be reworked to be less ambiguous, and that IS our job as openQA developers to deal with".
223 11 okurz
224
## Further categorization of statuses, issues and such in testing, especially automatic tests
225
By okurz
226
227
This categorization scheme is meant to help in communication in either written or spoken discussions being simple, concise, easy to remember while unambiguous in every case.
228
While used for naming it should also be used as a decision tree and can be followed from the top following each branch.
229
230
### Categorization scheme
231
232
To keep it simple I will try to go in steps of deciding if a potential issue is of one of two categories in every step (maybe three) and go further down from there. The degree of further detailing is not limited, i.e. it can be further extended. Naming scheme should follow arabic number (for two levels just 1 and 2) counting schemes added from the right for every additional level of decision step and detail without any separation between the digits, e.g. "1111" for the first type in every level of detail up to level four. Also, I am thinking of giving the fully written form phonetic name to unambiguously identify each on every level as long as not more individual levels are necessary. The alphabet should be reserved for higher levels and higher priority types.
233
Every leaf of the tree must have an action assigned to it.
234 12 okurz
235 11 okurz
1 **failed** (ZULU)
236
11 new (passed->failed) (YANKEE)
237
111 product issue ("true positive") (WHISKEY)
238 44 okurz
1111 unfiled issue (SIERRA)
239 11 okurz
11111 hard issue (openqa *fail*) (KILO)
240
111121 critical / potential ship stopper (INDIA) --> immediately file bug report with "ship_stopper?" flag; opt. inform RM directly
241 44 okurz
111122 non-critical hard issue (HOTEL) --> file bug report
242 11 okurz
11112 soft issue (openqa *softfail* on job level, not on module level) (JULIETT) --> file bug report on failing test module
243
1112 bugzilla bug exists (ROMEO)
244
11121 bug was known to openqa / openqa developer --> cross-reference (bug->test, test->bug) AND raise review process issue, improve openqa process
245
11122 bug was filed by other sources (e.g. beta-tester) --> cross-reference (bug->test, test->bug)
246
112 test issue ("false positive") (VICTOR)
247
1121 progress issue exists (QUEBEC) --> cross-reference (issue->test, test->issue)
248
1122 unfiled test issue (PAPA)
249
11221 easy to do w/o progress issue
250
112211 need needles update --> re-needle if sure, TODO how to notify?
251
112212 pot. flaky, timeout
252
1122121 retrigger yields PASS --> comment in progress about flaky issue fixed
253
1122122 reproducible on retrigger --> file progress issue
254
11222 needs progress issue filed --> file progress issue
255
12 existing / still failing (failed->failed) (XRAY)
256
121 product issue (UNIFORM)
257
1211 unfiled issue (OSCAR) --> file bug report AND raise review process issue (why has it not been found and filed?)
258
1212 bugzilla bug exists (NOVEMBER) --> ensure cross-reference, also see rules for 1112 ROMEO
259
122 test issue (TANGO)
260
1221 progress issue exists (MIKE) --> monitor, if persisting reprioritize test development work
261
1222 needs progress issue filed (LIMA) --> file progress issue AND raise review process issue, see 1211 OSCAR
262
2 **passed** (ALFA)
263
21 stable (passed->passed) (BRAVO)
264
211 existing "true negative" (DELTA) --> monitor, maybe can be made stricter
265
212 existing "false negative" (ECHO) --> needs test improvement
266
22 fixed (failed->passed) (CHARLIE)
267
222 fixed "true negative" (FOXTROTT) --> TODO split monitor, see 211 DELTA
268
2221 was test issue --> close progress issue
269
2222 was product issue
270
22221 no bug report exists --> raise review process issue (why was it not filed?)
271
22222 bug report exists
272
222221 was marked as RESOLVED FIXED
273
221 fixed but "false negative" (GOLF) --> potentially revert test fix, also see 212 ECHO
274 41 okurz
275
276 11 okurz
Priority from high to low: INDIA->OSCAR->HOTEL->JULIETT->…
277 35 okurz
278 142 okurz
# Important ticket queries
279
280
* All auto-review tickets: https://progress.opensuse.org/projects/openqav3/issues?query_id=697 , see https://github.com/os-autoinst/scripts/blob/master/README.md#auto-review---automatically-detect-known-issues-in-openqa-jobs-label-openqa-jobs-with-ticket-references-and-optionally-retrigger for further information regarding auto-review
281
* All auto-review+force-result tickets: https://progress.opensuse.org/projects/openqav3/issues?query_id=700
282
283 82 okurz
# Proposals for uses of labels
284 23 okurz
With [Show bug or label icon on overview if labeled (gh#550)](https://github.com/os-autoinst/openQA/pull/550) it is possible to add custom labels just by writing them. Nevertheless, a convention should be found for a common benefit. <del>Beware that labels are also automatically carried over with (Carry over labels from previous jobs in same scenario if still failing [gh#564])(https://github.com/os-autoinst/openQA/pull/564) which might make consistent test failures less visible when reviewers only look for test results without labels or bugrefs.</del> Labels are not anymore automatically carried over ([gh#1071](https://github.com/os-autoinst/openQA/pull/1071)).
285
286
List of proposed labels with their meaning and where they could be applied.
287
288
* ***`fixed_<build_ref>`***: If a test failure is already fixed in a more recent build and no bug reference is known, use this label together with a reference to a more recent passed test run in the same scenario. Useful for reviewing older builds. Example (https://openqa.suse.de/tests/382518#comments):
289
290
```
291
label:fixed_Build1501
292
293
t#382919
294
```
295 24 okurz
296
* ***`needles_added`***: In case needles were missing for test changes or expected product changes caused needle matching to fail, use this label with a reference to the test PR or a proper reasoning why the needles were missing and how you added them. Example (https://openqa.suse.de/tests/388521#comments):
297
298
```
299
label:needles_added
300
301
needles for https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/1353 were missing, added by jpupava in the meantime.
302 60 mgriessmeier
```
303
304 67 okurz
# s390x Test Organisation
305 1 alarrosa
306 67 okurz
See the following picture for a graphical overview of the current s390x test infrastructure at SUSE:
307
308
![SUSE s390x test infrastructure](qa_sle_openqa_s390x_test_infrastructure.jpg)
309
310 75 okurz
## Upgrades
311 60 mgriessmeier
312
### on z/VM 
313
#### special Requirements
314
315
Due to the lack of proper use of hdd-images on zVM, we need to workaround this with having a dedicated worker_class aka a dedicated Host where we run two jobs with START_AFTER_TEST,
316
the first one which installs the basesystem we want to have upgraded and a second one which is doing the actually upgrade (e.g migration_offline_sle12sp2_zVM_preparation and migration_offline_sle12sp2_zVM)
317
318
Since we encountered issues with randomly other preparation jobs are started in between there, we need to ensure that we have one complete chain for all migration jobs running on one worker, that means for example:
319
320 75 okurz
1. migration_offline_sle12sp2_zVM_preparation 
321
1. migration_offline_sle12sp2_zVM (START_AFTER_TEST=#1) 
322
1. migration_offline_sle12sp2_allpatterns_zVM_preparation (START_AFTER_TEST=#2) 
323
1. migration_offline_sle12sp2_allpatterns_zVM 
324
1. ...
325 66 okurz
326
This scheme ensures that all actual Upgrade jobs are finding the prepared system and are able to upgrade it
327
328
### on z/KVM
329
330 67 okurz
No special requirements anymore, see details in #18016
331 77 nicksinger
332
## Automated z/VM LPAR installation with openQA using qnipl
333
334 78 nicksinger
There is an ongoing effort to automate the LPAR creation and installation on z/VM. A first idea resulted in the creation of [qnipl](https://github.com/openSUSE/dracut-qnipl). `qnipl` enables one to boot a very slim initramfs from a shared medium (e.g. shared SCSI-disks) and supply it with the needed parameters to chainload a "normal SLES installation" using kexec.
335 77 nicksinger
This method is required for z/VM because snipl (Simple network initial program loader) can only load/boot LPARs from specific disks, not network resources.
336
337
### Setup
338
339
1. Get a shared disk for all your LPARs
340
  * Normally this can easily done by infra/gschlotter
341
  * Disks needs to be connected to all guests which should be able to network-boot
342
1. Boot a fully installed SLES on one of the LPARs to start preparing the shared-disk
343
1. Put a DOS partition table on the disk and create one single, large partition on there
344
1. Put a FS on there. Our first test was on ext2 and it worked flawlessly in our attempts
345
1. Install `zipl` (The s390x bootloader from IBM) on this partition
346
  * A simple and sufficient config can be found in [poo#33682](https://progress.opensuse.org/issues/33682)
347
1. clone [`qnipl`](https://github.com/nicksinger/dracut-qnipl) to your dracut modules (e.g. /usr/lib/dracut/modules.d/95qnipl)
348
1. Include the module named `qnipl` to your dracut modules for initramfs generation
349
  * e.g. in /etc/dracut.conf.d/99-qnipl.conf add: `add_dracutmodules+=qnipl`
350
1. Generate your initramfs (e.g. `dracut -f -a "url-lib qnipl" --no-hostonly-cmdline /tmp/custom_initramfs`)
351
  * Put the initramfs next to your kernel binary on the partition you want to prepare
352
1. From now on you can use `snipl` to boot any LPAR connected with this shared disk from network
353
  * example: `snipl -f ./snipl.conf -s P0069A27-LP3 -A fa00 --wwpn_scsiload 500507630713d3b3 --lun_scsiload 4001401100000000 --ossparms_scsiload "install=http://openqa.suse.de/assets/repo/SLE-15-Installer-DVD-s390x-Build533.2-Media1 hostip=10.161.159.3/20 gateway=10.161.159.254 Nameserver=10.160.0.1 Domain=suse.de ssh=1 regurl=http://all-533.2.proxy.scc.suse.de"`
354
  * `--ossparms_scsiload` is then evaluated and used by `qnipl` to kexec into the installer with the (for the installer) needed parameters
355
356
### Further details
357
358 78 nicksinger
Further details can also be found in the [github repo](https://github.com/openSUSE/dracut-qnipl/blob/master/README.md). Pull requests, questions and ideas always welcome!
359 84 okurz
360 109 okurz
# Infrastructure setup for o3 (openqa.opensuse.org) and osd (openqa.suse.de)
361 1 alarrosa
362 109 okurz
## o3 (openqa.opensuse.org)
363
364 113 okurz
o3 consists of a VM running the web UI and physical worker machines. The VM for o3 has netapp backed storage on rotating disk so less performant than SSD but cheaper. So eventually we might have the possibility to use SSD based storage. Currently there are four virtual storage devices provided to o3 totalling to 10 TB.
365 88 okurz
366 141 okurz
### Accessing the o3 infrastructure
367
368
The o3 webui host as well the workers within the o3 infrastructure can be accessed over ssh by using `ssh -p 2213 gate.opensuse.org`. Ask one of the existing admins to put your ssh key on the o3 webui host to be able to login.
369
370
To give access for a new user an existing admin can do the following:
371
372
```
373
sudo useradd -G users,trusted --create-home $user
374
echo "$ssh_key_from_user" | sudo tee -a /home/$user/.ssh/authorized_keys
375
```
376
377
#### SSH configuration
378
379
To easily access all hosts behind the jump host you can use the following config for your ssh client (`~.ssh/config`):
380
381
```
382
Host ariel
383
  HostName gate.opensuse.org
384
  Port 2213
385
386
# Note that %h as understood by -W needs the real host, aliases won't work:
387
# kex_exchange_identification: Connection closed by remote host
388
# Connection closed by UNKNOWN port 65535`
389
Host *.opensuse.org
390
  ProxyCommand ssh -q -A -x ariel -W %h:%p
391
```
392
393
**A word of warning:** be aware that this enables agent-forwarding to at least the jumphost. Please read up for yourself if and how bad you consider the security implications of doing so.
394
395
The workers can only be accessed from "ariel", not directly. One can use password authentication on the workers using the root account. Ask existing admins for the root password. It is suggested that you use key-based authentication. For this put your ssh keys on all the workers, e.g. using the above configuration and `ssh-copy-id`.
396
397
**Notice:** Some machines are connected to the o3 openQA host from other networks and might need different ways of access, at time of writing:
398
399
* Remote (owner: @ggardet_arm):
400
 * ip-10-0-0-58
401
 * oss-cobbler-03
402
 * siodtw01 (for tests on Raspberry Pi 2,3,4)
403
404
### Manual command execution on o3 workers
405
406
To execute commands manually on all workers within the o3 infrastructure one can do for example the following:
407
408
```
409
for i in aarch64 openqaworker1 openqaworker4 openqaworker7 power8 imagetester rebel; do echo $i && ssh root@$i "(transactional-update -n dup || zypper -n dup) && reboot" ; done
410
```
411
412
mind the correct list of machines.
413
414 91 okurz
### Automatic update of o3
415 92 okurz
416
o3 is automatically deployed on a daily base, that includes both the webUI host as well as the workers.
417 111 okurz
418
#### Automatic update of o3 webUI host
419
420
Done with cron job in `/etc/cron.d/auto-update`
421
422
#### Recurring automatic update of openQA workers
423
424
All o3 workers (except power8) apply a daily automatic update and are "Transactional Servers" running openSUSE Leap. power8 is non-transactional with a weekly update every Sunday.
425
426
This was for a number of reasons including:
427 109 okurz
428 96 okurz
* Getting all the machines consistent after a few years of drift
429
* Making it easier to keep them consistent by leveraging a read only root filesystem
430
* Guaranteeing rollbackability by using transactional updates
431 102 okurz
432 1 alarrosa
This was done by rbrown also to fulfill the prerequisite to getting them viable for multi-machine testing
433 102 okurz
434
These systems currently patch themselves and reboot automatically in the default maintenance window of 0330-0500 CET/CEST.
435 112 okurz
436 102 okurz
On problems this could be changed in the following way:
437
438 109 okurz
* Edit the maintenance window in /etc/rebootmgr.conf
439 105 nicksinger
* Disable the automatic reboot by "systemctl disable rebootmgr.service"
440
* Disable the automatic patching by "systemctl disable transactional-update.timer"
441
442
SUSE employees have access to the bootmenu for the openQA worker machines, e.g. openqaworker1 and openqaworker4 via openqaworker1- ipmi.suse.de and openqaworker4-ipmi.suse.de which are both connected to the r&d network. For imagetester one would need to go through SUSE-IT in an unlikely event of a boot-preventing update. "snapper rollback" can be executed from a booted, functionally operative machine which one can ssh into.
443
444
For manual investigation https://github.com/kubic-project/microos-toolbox can be helpful
445
446
#### Rollback of updates
447 140 livdywan
448
Updates on workers can be rolled back using `transactional-update` affecting the transactional workers (others are likely not updated that often):
449
450 105 nicksinger
```
451
for i in aarch64 openqaworker1 openqaworker4 openqaworker7 power8 imagetester rebel; do echo $i && ssh root@$i "transactional-update rollback last && reboot"; done
452
```
453
454
Updates on the central webUI host openqa.opensuse.org can be rolled back by using either older variants of packages that receive maintenance updates or using the locally cached packages in e.g. /var/cache/zypp/packages/devel_openQA/noarch using `zypper in --oldpackage`, similar to https://github.com/os-autoinst/openQA/blob/master/script/openqa-rollback#L39
455 108 SLindoMansilla
456
#### Debugging qemu SUTs in openqa.opensuse.org
457
458
SUT: System Under Test
459
460
os-autoinst starts qemu with network type that doesn't allow access from the outside, so ssh is not possible. But, qemu is started with a VNC channel available from the host (the openQA-worker).
461
Running vncviewer inside a headless server is useless, but it is possible to use gate.opensuse.org as a jump host and SSH port forwarding to start vncviewer client from your desktop environment and connect to the VNC channel of the qemu SUT.
462
463
```
464
ssh -p 2213 -L LOCAL_PORT:WORKER_HOSTNAME:QEMU_VNC_PORT USERNAME@gate.opensuse.org
465
```
466
467
For example, if user **bernhard**, wants to connect to openqaworker7:11, and wants to use local port **43043**
468
Being the IP of openqaworker7 **192.168.112.12**
469
And the VNC channel port of openqa-worker@11 **6001** (5990 + 11)
470
471
##### 1. Create SSH tunnel with port forwarding
472
* on laptop shell 1: ssh -p 2213 -L 43043:192.168.112.12:6001 bernhard@gate.opensuse.org
473 1 alarrosa
* Keep shell open to keep the tunnel open and the port forwarding
474 108 SLindoMansilla
475 1 alarrosa
##### 2. Open vncviewer
476
* on laptop shell 2: vncviewer -Shared localhost:43043
477
* `-shared` is needed to not kick the VNC connection of os-autoinst. If it is kicked, the job will terminate and the qemu process will be killed.
478
479 109 okurz
### AArch64 specific configurations on o3
480 1 alarrosa
481 109 okurz
On o3, the aarch64 workers need additional configuration.
482
483 127 dheidler
#### Setup HugePages
484
485
You need to setup HugePages support to improve performances with qemu VM and to match current aarch64 `MACHINE` configuration.
486
For the D05 machine, the configuration is: `40` pages with a size of `1G`.
487
If there are some permissions issues on `/dev/hugepages/`, check https://progress.opensuse.org/issues/53234
488
489 126 dheidler
### o3 s390 workers
490
491
The s390 workers for openQA are running within podman containers on openqaworker1.
492
The containers are started using systemd but the unit files are specific to the containers and will end up in a restart-loop if this fact is ignored. Whenever the containers are recreated, the systemd files have to be recreated.
493
494
The containers are started like this (for i=101…104):
495
496
```
497
i=101
498 109 okurz
podman run -d -h openqaworker1_container --name openqaworker1_container_$i -p $(python3 -c"p=${i}*10+20003;print(f'{p}:{p}')") -e OPENQA_WORKER_INSTANCE=$i -v /opt/s390x_rebel_replacement:/etc/openqa -v /var/lib/openqa/share:/var/lib/openqa/share registry.opensuse.org/devel/openqa/containers15.2/openqa_worker:latest
499
(cd /etc/systemd/system/; podman generate systemd -f -n openqaworker1_container_$i --restart-policy always)
500
systemctl daemon-reload
501
systemctl enable container-openqaworker1_container_$i
502
```
503
504 133 okurz
As alternative s390x workers can run on the host "rebel" as well. Be aware that openQA workers accessing the same s390x instances must not run in parallel so only enable one worker instance per s390x instance at a time (See https://progress.opensuse.org/issues/97658 for details).
505
506 121 okurz
### Monitoring
507
508
There is an internal munin instance on o3. Anyone wanting to look at the HTML pages, do this:
509
```
510
rsync -a o3:/srv/www/htdocs/munin ~/o3-munin/ 
511
```
512
(where "o3" is configured in your ssh config of course)
513
514 89 ggardet_arm
## Mitigation of boot failure or disk issues
515
516
### Worker stuck in recovery
517
518
Check disk health and consider manual fixup of mount points, e.g.:
519
520
```
521
test -e /dev/md/openqa || lsblk -n | grep -v nvme | grep "/$" && mdadm --create /dev/md/openqa --level=0 --force --raid-devices=$(ls /dev/nvme?n1 | wc -l) --run /dev/nvme?n1 || mdadm --create /dev/md/openqa --level=0 --force --raid-devices=1 --run /dev/nvme0n1p3
522
```
523
524 106 okurz
## PPC specific configurations
525
526
In one case it was necessary to disable snapshots for petitboot with `nvram -p default --update-config "petitboot,snapshots?=false"` to prevent a race condition between dm_raid and btrfs trying to discover bootable devices (https://progress.opensuse.org/issues/68053#note-25). In another case https://bugzilla.opensuse.org/show_bug.cgi?id=1174166 caused the boot entries to be not properly discovered and it was necessary to prevent grub from trying to update the according sections (https://progress.opensuse.org/issues/68053#note-31).
527 89 ggardet_arm
528 84 okurz
## Moving worker from osd to o3
529
530
* Ensure system management, e.g. over IPMI works. This is untouched by the following steps and can be used during the process for recovery and setup
531
* Ensure network is configured for DHCP
532
* Instruct SUSE-IT to change VLAN for machine from 2 to 662 (example: https://infra.nue.suse.com/SelfService/Display.html?id=16458)
533
* Remove from osd:
534
535
```
536
salt-key -y -d openqaworker7.suse.de
537
```
538
539
* Add entry on o3 to `/etc/dnsmasq.d/openqa.conf` with MAC address, e.g.
540
541
```
542
dhcp-host=54:ab:3a:24:34:b8,openqaworker7
543
```
544
545
* Add entry to `/etc/hosts` which dnsmasq picks up to give out a DHCP lease, e.g.
546
547
```
548
192.168.112.12   openqaworker7.openqanet.opensuse.org openqaworker7
549
```
550
551 85 okurz
* Adapt NFS mount point
552
553
```
554
sed -i '/openqa\.suse\.de/d' /etc/fstab && echo 'openqa1-opensuse:/ /var/lib/openqa/share nfs4 ro,fsc 0 0' >> /etc/fstab
555
```
556
557 84 okurz
* Reload dnsmasq with `systemctl restart dnsmasq`
558
* Restart network on machine (over IMPI) using `systemctl restart network` and monitor in o3:`journalctl -f -u dnsmasq` until address is assigned, e.g.:
559
560
```
561
Feb 29 10:48:30 ariel dnsmasq[28105]: read /etc/hosts - 30 addresses
562
Feb 29 10:48:54 ariel dnsmasq-dhcp[28105]: DHCPREQUEST(eth1) 10.160.1.101 54:ab:3a:24:34:b8
563
Feb 29 10:48:54 ariel dnsmasq-dhcp[28105]: DHCPNAK(eth1) 10.160.1.101 54:ab:3a:24:34:b8 wrong network
564
Feb 29 10:49:10 ariel dnsmasq-dhcp[28105]: DHCPDISCOVER(eth1) 54:ab:3a:24:34:b8
565
Feb 29 10:49:10 ariel dnsmasq-dhcp[28105]: DHCPOFFER(eth1) 192.168.112.12 54:ab:3a:24:34:b8
566
Feb 29 10:49:10 ariel dnsmasq-dhcp[28105]: DHCPREQUEST(eth1) 192.168.112.12 54:ab:3a:24:34:b8
567
Feb 29 10:49:10 ariel dnsmasq-dhcp[28105]: DHCPACK(eth1) 192.168.112.12 54:ab:3a:24:34:b8 openqaworker7
568 85 okurz
```
569
570
* Ensure all mountpoints up
571
572
```
573
mount -a
574 84 okurz
```
575
576
* Change root password to o3 one
577 86 okurz
* Allow ssh password authentication: `sed -i 's/^PasswordAuthentication/#&/' /etc/ssh/sshd_config && systemctl restart sshd`
578 84 okurz
* Add personal ssh key to machine, e.g. openqaworker7:/root/.ssh/authorized_keys
579
* Update /etc/openqa/client.conf with the same key as used on other workers for "openqa1-opensuse"
580
* Update /etc/openqa/workers.ini with similar config as used on other workers, e.g. based on openqaworker4, example:
581
582
```
583
# diff -Naur /etc/openqa/workers.ini{.osd,}
584
--- /etc/openqa/workers.ini.osd 2020-02-29 15:21:47.737998821 +0100
585
+++ /etc/openqa/workers.ini     2020-02-29 15:22:53.334464958 +0100
586
@@ -1,17 +1,10 @@
587
-# This file is generated by salt - don't touch
588
-# Hosted on https://gitlab.suse.de/openqa/salt-pillars-openqa
589
-# numofworkers: 10
590
-
591
 [global]
592
-HOST=openqa.suse.de
593
-CACHEDIRECTORY=/var/lib/openqa/cache
594
-LOG_LEVEL=debug
595
-WORKER_CLASS=qemu_x86_64,qemu_x86_64_staging,tap,openqaworker7
596
-WORKER_HOSTNAME=10.160.1.101
597
-
598
-[1]
599
-WORKER_CLASS=qemu_x86_64,qemu_x86_64_staging,tap,qemu_x86_64_ibft,openqaworker7
600
+HOST=http://openqa1-opensuse
601
+WORKER_HOSTNAME=192.168.112.12
602
+CACHEDIRECTORY = /var/lib/openqa/cache
603
+CACHELIMIT = 50
604
+WORKER_CLASS = openqaworker7,qemu_x86_64
605
606
-[openqa.suse.de]
607
-TESTPOOLSERVER = rsync://openqa.suse.de/tests
608
+[http://openqa1-opensuse]
609
+TESTPOOLSERVER = rsync://openqa1-opensuse/tests
610
```
611
612
* Remove OSD specifics
613
614
```
615
systemctl disable --now auto-update.timer salt-minion telegraf
616
for i in  NPI SUSE_CA telegraf-monitoring; do zypper rr $i; done
617
zypper -n dup --force-resolution --allow-vendor-change
618
```
619
620
* If the machine is not a transactional-server one has the following options: Keep as is and handle like power8 (also not transactional), enable transactional updates w/o root being r/o, change to root being r/o on-the-fly, reinstall as transactional. At least option 2 is suggested, enable transactional updates:
621
622
```
623
zypper -n in transactional-update
624
systemctl enable --now transactional-update.timer rebootmgr
625
```
626
627
* Enable apparmor
628
629
```
630
zypper -n in apparmor-utils
631
systemctl unmask apparmor
632
systemctl enable --now apparmor
633
```
634
635
* Switch firewall from SuSEfirewall2 to firewalld
636
637
```
638
zypper -n in firewalld && zypper -n rm SuSEfirewall2
639
systemctl enable --now firewalld
640
firewall-cmd --zone=trusted --add-interface=br1
641
firewall-cmd --set-default-zone trusted
642
firewall-cmd --zone=trusted --add-masquerade
643
```
644
645
* Copy over special openSUSE UEFI staging images, see #63382
646
* Check operation with a single openQA worker instance:
647
648
```
649
systemctl enable --now openqa-worker.target openqa-worker@1
650
```
651
652
* Test with an openQA job cloned from a production job, e.g. for openqaworker7
653
654
```
655
openqa-clone-job --within-instance https://openqa.opensuse.org/t${id} WORKER_CLASS=openqaworker7
656
```
657
658
* After the latest openQA job could successfully finish enable more worker instances
659
660
```
661
systemctl unmask openqa-worker@{2..14} && systemctl enable --now openqa-worker@{2..14}
662
```
663
664
* Monitor if nightly update works, e.g. look for journal entry:
665
666
```
667
Mar 01 00:08:26 openqaworker7 transactional-update[10933]: Calling zypper up
668
669
Mar 01 00:08:51 openqaworker7 transactional-update[10933]: transactional-update finished - informed rebootmgr
670
Mar 01 00:08:51 openqaworker7 systemd[1]: Started Update the system.
671
672
Mar 01 03:30:00 openqaworker7 rebootmgrd[40760]: rebootmgr: reboot triggered now!
673
674
Mar 01 03:36:32 openqaworker7 systemd[1]: Reached target openQA Worker.
675
```
676 93 okurz
677 95 okurz
## Distribution upgrades
678
679 131 livdywan
**Note:** Performing the upgrade differs slightly depending on the host setup:
680 138 okurz
* On hosts with a writeable `/` you need to enter a root shell i.e. `sudo bash`
681
* Transactional hosts require that you use `transactional-update shell` thereby creating a snapshot which is applied after a reboot, optionally using `--continue` if you want to make further changes to an existing snapshot
682
* Depending on available space it might be necessary to cleanup space before conducting the upgrade, e.g. use `snapper rm <N..M>` to delete older root btrfs snapshots, cleanup unneeded packages, e.g. with https://github.com/okurz/scripts/blob/master/zypper-rm-orphaned and https://github.com/okurz/scripts/blob/master/zypper-rm-unneeded
683
* Consider using https://github.com/okurz/auto-upgrade/blob/master/auto-upgrade or manual (*Tip**: Run this in `screen -d -r || screen` and use e.g. `sudo bash`):
684 101 okurz
685 95 okurz
```
686 137 okurz
new_version=15.3 # Specify the target release
687 1 alarrosa
688 98 livdywan
# Change the release via the special $releasever
689 1 alarrosa
. /etc/os-release
690
sed -i -e "s/${VERSION_ID}/\$releasever/g" /etc/zypp/repos.d/*
691
zypper --releasever=$new_version ref
692
test -f /etc/openqa/openqa.ini && sudo -u geekotest /opt/openqa-scripts/dump-psql
693
zypper -n --releasever=$new_version dup --auto-agree-with-licenses --replacefiles --download-in-advance
694
695
# Check config files for relevant changes
696 95 okurz
rpmconfigcheck
697
for i in $(cat /var/adm/rpmconfigcheck) ; do vimdiff ${i%.rpm*} $i ; done
698
rm $(cat /var/adm/rpmconfigcheck)
699
700 1 alarrosa
reboot
701
systemctl --failed
702 98 livdywan
```
703
704 138 okurz
* Ensure that the upgrade was really successful, e.g. /etc/os-release should show the new version, the above `zypper dup` command should show no more pending actions
705
* Crosscheck for any obvious alerts, pipelines failing, user reports, etc.
706
* Monitor for successful openQA jobs on the host
707 132 livdywan
708 109 okurz
## Remote management with IPMI
709 95 okurz
710 119 livdywan
o3 and osd worker machines are controllable over IPMI from within the SUSE network, see [openqa/workerconf.sls](https://gitlab.suse.de/openqa/salt-pillars-openqa/-/blob/master/openqa/workerconf.sls) for the commands.
711
It is recommended to use [shell aliases](https://gitlab.suse.de/openqa/salt-pillars-openqa#get-ipmi-definition-aliases) for convenience.
712 109 okurz
713
`ipmitool` can sometimes behave unreliably. It seems (to okurz) as if ipmitool version ipmitool-1.8.18+git20200916.1245aaa387dc from openSUSE Tumbleweed or Factory or the "systemsmanagement" OBS repo is more reliable than the version supplied with openSUSE Leap 15.2 (See #80544#note-14) and given a stable internet connection it is certainly possible to have a consistent serial console experience.
714
715 110 okurz
To ensure that remotely controlled machines power on automatically after a power loss ensure to set the power restory policy to "previous", especially for new machines. Using https://gitlab.suse.de/openqa/salt-pillars-openqa/#get-ipmi-definition-aliases :
716
717
```
718
IFS=$'\n'; for i in $(sed 's/^alias .*="\(.*\)"/\1/' ~/.openqa_ipmi_aliases); do eval "$i" chassis policy previous; done
719
```
720
721 130 nicksinger
### Accessing imagetester
722 129 nicksinger
Imagetester can't output anything over SOL. Therefore it is neccessary to access it over the integrated iKVM console. Unfortunately java-webstart is somewhat broken and requires some extra steps to work:
723
724
1. Access the webinterface of the BMC at http://10.160.65.195 and login
725
2. Click on the preview image of the "Remote Console Preview" an download the according "launch.jnlp" webstart script
726
3. Grab the required dependencies with curl and place them in a local directory:
727
728
```
729
mkdir /tmp/ikvm
730
curl -k https://10.160.65.195:443/liblinux_x86_64__V1.0.3.jar.pack.gz > /tmp/ikvm/liblinux_x86_64__V1.0.3.jar.pack.gz
731
curl -k https://10.160.65.195:443/iKVM__V1.69.13.0x0.jar.pack.gz > /tmp/ikvm/iKVM__V1.69.13.0x0.jar.pack.gz
732
```
733
734
4. Open the previous downloaded "launch.jnlp" and replace the IP in the first line from `<jnlp spec="1.0+" codebase="https://10.160.65.195:443/">` to `<jnlp spec="1.0+" codebase="http://127.0.0.1:8080/">`
735
5. Launch some kind of webserver which can serve the previously downloaded dependencies for javaws (from /tmp/ikvm). In this example we use python: `python3 -m http.server 8080`
736
6. Now you can finally launch the webstart application from your modifies "launch.jnlp" file in a second console: `javaws -nosecurity -jnlp ~/Downloads/launch.jnlp`
737
  * It will ask you how to run the application. You can run it in a sandbox and everything still works
738
7. You should see the monitor output of imagetester now. "Virtual Storage" is also working which allows you to mount an ISO over this remote connection. 
739
740
*Also check https://progress.opensuse.org/issues/96719#note-27 where this was discovered. If you have questions or remarks you can ping @nicksinger*
741 128 okurz
742 109 okurz
## openQA infrastructure needs (o3 + osd)
743
744 115 okurz
TL;DR: new OSD ARM workers needed, missing redundancy for o3-ppc, rest is needing replacement as nearly all current hardware is out of vendor provided maintenance (as of 2021-05), SSD storage for o3 would be good
745 93 okurz
746
2020-03: SUSE IT (EngInfra) provided us more space for O3 but we have only slow rotating-disk storage. Performance could be improved by providing SSD storage.
747
748
The most time and effort we currently struggle with storage space for OSD (openqa.suse.de) ~~both OSD (openqa.suse.de) as well as O3 (openqa.opensuse.org) (2020-03: Situation on o3 resolved with more storage provided by SUSE IT)~~. Both instances (OSD + O3) are using precious netapp-storage but there is currently no better approach to use different, external storage. An increase of the available space would be appreciated, ~~o3 being more important right now than osd,~~ see https://progress.opensuse.org/issues/57494 for details. Graphs like 
749
https://stats.openqa-monitor.qa.suse.de/d/nRDab3Jiz/openqa-jobs-test?orgId=1&from=1578343509900&to=1578653794173&fullscreen&panelId=12 show how usual test backlogs are worked on within OSD by architecture. It can be seen that both the ppc64le and aarch64 backlogs are reduced fast so we do not need more ppc64le or aarch64 machines. However, we have a stability problem with all three aarch64 workers. Potentially new machine(s) could help, see https://progress.opensuse.org/issues/41882 for details.
750 107 okurz
751 125 okurz
With number of workers and parallel processed tests as well as with the increased number of products tested on OSD and users using the system the workload on OSD constantly increases. CPU load alerts had been seen recently in #96713 and the higher load is visible in https://monitor.qa.suse.de/d/WebuiDb/webui-summary?viewPanel=25 . From time to time should increase the number of CPU cores on the OSD VM due to the higher usage.
752
753 117 okurz
## Setup guide for new machines
754
755
* Make sure to set /etc/salt/minion_id to the FQDN (see #90875#note-2 for reference)
756 135 okurz
* Change IPMI/BMC passwords to use our common passwords instead of default IPMI
757 117 okurz
* Add to salt using https://gitlab.suse.de/openqa/salt-states-openqa
758
759 120 okurz
## Take machines out of salt-controlled production
760
761
E.g. for investigation or development or manual maintenance work
762 118 okurz
763
```
764
ssh osd "sudo salt-key -y -d $hostname"
765
ssh $hostname "sudo systemctl disable --now telegraf openqa-worker-auto-restart@\*"
766
```
767
768
## Bring back machines into production
769
770
```
771 124 dheidler
ssh osd "sudo salt-key -a $hostname && sudo salt --state-output=changes $hostname state.apply"
772 118 okurz
```
773
774
Depending on your actions further manual cleanup might be necessary, e.g. `ssh $hostname "sudo systemctl unmask telegraf salt-minion"`
775 117 okurz
776 122 okurz
## Backup
777
778 134 okurz
Both openqa.opensuse.org and openqa.suse.de run on virtual machine clusters that provide redundancy and differential backup using snapshotting of the involved storage. SUSE-IT currently provides backups going back up to 3 days with two daily backups conducted at 23:10Z and 11:00Z. With this it is possible in cases of catastrophic data loss to recover (raise ticket over https://sd.suse.com in that case). Additionally automatic backup for the o3 webui host introduced with https://gitlab.suse.de/okurz/backup-server-salt/tree/master/rsnapshot covering so far /etc and the SQL database dumps. Fixed assets and testresults are backed up on storage.qa.suse.de (see https://gitlab.suse.de/openqa/salt-states-openqa/-/merge_requests/612)
779 122 okurz
780 139 okurz
### openQA database backups
781
782
Database backups of o3+osd are available on backup.qa.suse.de, acessible over ssh, same credentials as for the OSD infrastructure
783
784 144 livdywan
### Fallback deployment on AWS
785
786
To get an instance running from a backup in case of a disaster, one can be created on AWS with this configuration:
787 149 tinita
788
#### Launch instance
789
790 155 tinita
##### Web Interface, from scratch (only if necessary, otherwise just use the template below)
791 149 tinita
792 144 livdywan
- Ensure your region is **Frankfurt, Germany**
793
- Pick a **t3.large** with `openSUSE Leap` on AWS Marketplace
794 146 mkittler
- Add two disks
795
    - 10 GiB for the root filesystem should be sufficient (can be easily extended later if needed)
796
    - The OSD database alone needs > 30 GiB and results plus assets will also need a lot (e.g. > 4 GiB for TW snapshot ISO) so take at least 100 GiB for the 2nd drive
797 144 livdywan
- The security group needs to include ssh and http
798
- Add `openqa_created_by`, `openqa_ttl` and `team:qa-tools` tags
799 149 tinita
800
##### Launch from a template
801
802 151 tinita
Note: When you modify the template (creating a new version), be sure to set the new version as the default.
803
804 155 tinita
- Go to the [openQA-webUI-openSUSE-Leap](https://eu-central-1.console.aws.amazon.com/ec2/v2/home?region=eu-central-1#LaunchTemplateDetails:launchTemplateId=lt-002dfbcbd2f818e4c) Template
805 154 tinita
- Select "Actions - Launch instance from template"
806 149 tinita
- Choose your key pair
807
- Click "Launch instance"
808 1 alarrosa
809
###### Command line
810 151 tinita
811 155 tinita
For configuring aws cli, see below
812 149 tinita
[Help](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html)
813
814
    aws ec2 run-instances --launch-template LaunchTemplateId=lt-002dfbcbd2f818e4c --key-name <your-keyname>
815 150 tinita
    # or
816
    aws ec2 run-instances --launch-template LaunchTemplateName=openQA-webUI-openSUSE-Leap --key-name <your-keyname>
817 149 tinita
818
For this you have to create a key pair first, if you haven't done so.
819
Save the result and look for the `InstanceId`.
820 144 livdywan
821
#### Transfer keys
822
823
Since an instance is always created with a single key, public keys of all users need to be deployed by whoever owns that key.
824
825
**Note**: `osd2` refers to the instance created above. Replace with the instance IP or add an alias to your SSH config.
826
827
    ssh openqa.suse.de "sudo su -c 'cat /home/*/.ssh/authorized_keys'" | ssh ec2-user@osd2 "cat - >> ~/.ssh/authorized_keys"
828
829
#### Bootstrapping
830
831
```
832
ssh osd2
833 145 mkittler
parted --script /dev/nvme1n1 mklabel gpt && parted --script /dev/nvme1n1 mkpart ext4 4096s 100%
834
mkfs.ext4 /dev/nvme1n1p1
835
mkdir /space && mount /dev/nvme1n1p1 /space
836 1 alarrosa
curl -s https://raw.githubusercontent.com/os-autoinst/openQA/master/script/openqa-bootstrap | bash -x
837 144 livdywan
838 152 tinita
# move postgres data dir to outer /space
839
systemctl mask postgresql.service
840
systemctl stop postgresql.service
841
mkdir /space/pgsql
842
mv /var/lib/pgsql/data /space/pgsql/
843
ln -s /space/pgsql/data /var/lib/pgsql/data
844
systemctl unmask postgresql.service
845
systemctl start postgresql.service
846
systemctl restart openqa-webui.service
847
848 145 mkittler
ssh -A backup.qa.suse.de
849 1 alarrosa
rsync --progress /home/rsnapshot/alpha.0/openqa.suse.de/var/lib/openqa/SQL-DUMPS/2022-02-08.dump ec2-user@osd2:/tmp
850
851 144 livdywan
ssh osd2
852 147 mkittler
sudo -u postgres createdb -O geekotest openqa-osd # create pristine db for OSD import (to avoid conflicts with existing data)
853 153 tinita
sudo -u geekotest pg_restore -d openqa-osd /tmp/2022-02-08.dump # import data, will take a while (22m is a realistic time)
854 1 alarrosa
vim /etc/openqa/openqa.ini # change auth from Fake to OpenID
855 153 tinita
systemctl stop openqa-webui
856 1 alarrosa
vim /etc/openqa/database.ini # change database to openqa-osd
857
systemctl start openqa-webui
858
```
859 155 tinita
860
##### Configure aws cli
861
862
You can use the command
863
864
    aws configure
865
866
but it doesn't actually help you with the possible values, so you can just create the file yourself like this:
867
868
    % cat ~/.aws/config
869
    [default]
870
    region = eu-central-1
871
    output = json
872
873 144 livdywan
874 109 okurz
## Best practices for infrastructure work
875 107 okurz
876
* Same as in OSD deployment we should look for failed grafana alerts if users report something suspicious
877
* Collect all the information between "last good" and "first bad" and then also find the git diff in openqa/salt-states-openqa
878
* Apply proper "scientific method" with written down hypotheses, experiments and conclusions in tickets, follow https://progress.opensuse.org/projects/openqav3/wiki#Further-decision-steps-working-on-test-issues
879
* Keep salt states to describe what should *not* be there
880
* Try out older btrfs snapshots in systems for crosschecking and boot with disabled salt. In the kernel cmdline append `systemd.mask=salt-minion.service`
881
* Team should conduct a work backlog check on a daily base, e.g. look for urgent tickets related to infrastructure problems
882 143 okurz
* For hardware replacement, create EngInfra ticket for coordination, order replacement on private expenses and get reimbursed using https://intra.suse.net/company/company-news/department/finance/claim-expenses/claim-expenses/ or have order placed with the help of line managers, let the components be delivered to the according place, e.g. SUSE Nuremberg datacenter and inform EngInfra in ticket to have them conduct the physical component replacement
883 148 livdywan
* Prefer `reload` over `restart` where available e.g. `systemctl reload postgres` - in general `systemctl cat postgres` will show available commands for any service
884 116 okurz
* Test reboot stability of machines with commands like in https://progress.opensuse.org/issues/78010#note-31 e.g.
885
886
```
887
for run in {01..30}; do for host in $host; do echo -n "run: $run, $host: ping .. " && timeout -k 5 600 sh -c "until ping -c30 $host >/dev/null; do :; done" && echo -n "ok, ssh .. " && timeout -k 5 600 sh -c "until nc -z -w 1 $host 22; do :; done" && echo -n "ok, uptime/reboot: " && ssh $host "uptime && sudo reboot" && sleep 120 || break; done || break; done
888
```