Skip to content

Commit c4b1b62

Browse files
committed
Merge branch 'install-6.5'
2 parents 8ae0ac8 + 466a6ec commit c4b1b62

File tree

4 files changed

+46
-16
lines changed

4 files changed

+46
-16
lines changed

lib/commands.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
116116
# Get a decoded version of the output in any case, replacing potential errors
117117
output_for_errors = res.stdout.decode(errors='replace').strip()
118118

119-
# Even if check is False, we still raise in case of return code 255, which means a SSH error.
120-
if res.returncode == 255:
121-
return False, SSHCommandFailed(255, "SSH Error: %s" % output_for_errors, command)
119+
# # Even if check is False, we still raise in case of return code 255, which means a SSH error.
120+
# if res.returncode == 255:
121+
# return False, SSHCommandFailed(255, "SSH Error: %s" % output_for_errors, command)
122122

123123
output = res.stdout
124124
if config.ignore_ssh_banner:
@@ -129,7 +129,7 @@ def _ssh(hostname_or_ip, cmd, check, simple_output, suppress_fingerprint_warning
129129
if decode:
130130
output = output.decode()
131131

132-
if res.returncode and check:
132+
if res.returncode not in (0, 255) and check:
133133
return False, SSHCommandFailed(res.returncode, output_for_errors, command)
134134

135135
if simple_output:

lib/installer.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
from lib.commands import ssh, SSHCommandFailed
66
from lib.common import wait_for
77

8+
# FIXME should only be used for <7.0
9+
SSHOPTS = ("-o KexAlgorithms=+diffie-hellman-group1-sha1",
10+
"-o HostKeyAlgorithms=+ssh-rsa",
11+
"-o PubkeyAcceptedKeyTypes=+ssh-rsa",
12+
"-c +aes256-cbc")
13+
814
class AnswerFile:
915
def __init__(self, kind, /):
1016
from data import BASE_ANSWERFILES
@@ -62,36 +68,41 @@ def _defn_to_xml_et(defn, /, *, parent=None):
6268

6369
def poweroff(ip):
6470
try:
65-
ssh(ip, ["poweroff"])
71+
ssh(ip, ["/sbin/poweroff"], options=SSHOPTS)
6672
except SSHCommandFailed as e:
6773
# ignore connection closed by reboot
6874
if e.returncode == 255 and "closed by remote host" in e.stdout:
6975
logging.info("sshd closed the connection")
7076
pass
77+
elif e.returncode == 255:
78+
logging.info("sshd misbehaving?")
7179
else:
7280
raise
7381

7482
def monitor_install(*, ip):
7583
# wait for "yum install" phase to finish
76-
wait_for(lambda: ssh(ip, ["grep",
84+
wait_for(lambda: "DISPATCH: NEW PHASE: Completing installation" in ssh(ip, ["grep",
7785
"'DISPATCH: NEW PHASE: Completing installation'",
7886
"/tmp/install-log"],
7987
check=False, simple_output=False,
80-
).returncode == 0,
88+
options=SSHOPTS,
89+
).stdout,
8190
"Wait for rpm installation to succeed",
8291
timeout_secs=40 * 60) # FIXME too big
8392

8493
# wait for install to finish
85-
wait_for(lambda: ssh(ip, ["grep",
94+
wait_for(lambda: "The installation completed successfully" in ssh(ip, ["grep",
8695
"'The installation completed successfully'",
8796
"/tmp/install-log"],
8897
check=False, simple_output=False,
89-
).returncode == 0,
98+
options=SSHOPTS,
99+
).stdout,
90100
"Wait for system installation to succeed",
91101
timeout_secs=40 * 60) # FIXME too big
92102

93103
wait_for(lambda: ssh(ip, ["ps a|grep '[0-9]. python /opt/xensource/installer/init'"],
94104
check=False, simple_output=False,
105+
options=SSHOPTS,
95106
).returncode == 1,
96107
"Wait for installer to terminate")
97108

@@ -101,6 +112,7 @@ def monitor_upgrade(*, ip):
101112
"'DISPATCH: NEW PHASE: Reading package information'",
102113
"/tmp/install-log"],
103114
check=False, simple_output=False,
115+
options=SSHOPTS,
104116
).returncode == 0,
105117
"Wait for upgrade preparations to finish",
106118
timeout_secs=40 * 60) # FIXME too big
@@ -110,6 +122,7 @@ def monitor_upgrade(*, ip):
110122
"'DISPATCH: NEW PHASE: Completing installation'",
111123
"/tmp/install-log"],
112124
check=False, simple_output=False,
125+
options=SSHOPTS,
113126
).returncode == 0,
114127
"Wait for rpm installation to succeed",
115128
timeout_secs=40 * 60) # FIXME too big
@@ -119,12 +132,14 @@ def monitor_upgrade(*, ip):
119132
"'The installation completed successfully'",
120133
"/tmp/install-log"],
121134
check=False, simple_output=False,
135+
options=SSHOPTS,
122136
).returncode == 0,
123137
"Wait for system installation to succeed",
124138
timeout_secs=40 * 60) # FIXME too big
125139

126140
wait_for(lambda: ssh(ip, ["ps a|grep '[0-9]. python /opt/xensource/installer/init'"],
127141
check=False, simple_output=False,
142+
options=SSHOPTS,
128143
).returncode == 1,
129144
"Wait for installer to terminate")
130145

@@ -134,6 +149,7 @@ def monitor_restore(*, ip):
134149
"'Restoring backup'",
135150
"/tmp/install-log"],
136151
check=False, simple_output=False,
152+
options=SSHOPTS,
137153
).returncode == 0,
138154
"Wait for data restoration to start",
139155
timeout_secs=40 * 60) # FIXME too big
@@ -143,6 +159,7 @@ def monitor_restore(*, ip):
143159
"'Data restoration complete. About to re-install bootloader.'",
144160
"/tmp/install-log"],
145161
check=False, simple_output=False,
162+
options=SSHOPTS,
146163
).returncode == 0,
147164
"Wait for data restoration to complete",
148165
timeout_secs=40 * 60) # FIXME too big
@@ -154,6 +171,7 @@ def monitor_restore(*, ip):
154171
"'ran .*swaplabel.*rc 0'",
155172
"/tmp/install-log"],
156173
check=False, simple_output=False,
174+
options=SSHOPTS,
157175
).returncode == 0,
158176
"Wait for installer to hopefully finish",
159177
timeout_secs=40 * 60) # FIXME too big

tests/install/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def remastered_iso(installer_iso, answerfile):
154154
set -ex
155155
INSTALLIMG="$1"
156156
157+
# bad permissions in XS 6.5 preventing ssh to use authorized_keys
158+
chmod g-w "$INSTALLIMG/root"
159+
157160
mkdir -p "$INSTALLIMG/root/.ssh"
158161
echo "{TEST_SSH_PUBKEY}" > "$INSTALLIMG/root/.ssh/authorized_keys"
159162

tests/install/test.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TestNested:
4949
"821.1",
5050
"81", "80", "76", "75",
5151
"xs8", "ch821.1",
52-
"xs70",
52+
"xs70", "xs65",
5353
))
5454
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
5555
@pytest.mark.vm_definitions(
@@ -106,7 +106,7 @@ def test_install(self, vm_booted_with_installer, install_disk,
106106
"81", "80",
107107
"76", "75",
108108
"ch821.1", "xs8",
109-
"xs70",
109+
"xs70", "xs65",
110110
))
111111
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
112112
@pytest.mark.continuation_of(
@@ -161,6 +161,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
161161
"xs8": "8.4.0",
162162
"ch821.1": "8.2.1",
163163
"xs70": "7.0.0-125380c",
164+
"xs65": "6.5.0-90233c",
164165
}[expected_rel_id]
165166

166167
# determine version info from `mode`
@@ -210,7 +211,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
210211
]
211212
STAMPS_DIR = "/var/lib/misc"
212213
STAMPS = [f"ran-{service}" for service in SERVICES]
213-
elif lsb_rel in ["7.0.0-125380c", "7.5.0", "7.6.0", "8.0.0", "8.1.0"]:
214+
elif lsb_rel in ["6.5.0", "7.0.0-125380c", "7.5.0", "7.6.0", "8.0.0", "8.1.0"]:
214215
SERVICES = ["xs-firstboot"]
215216
STAMPS_DIR = "/etc/firstboot.d/state"
216217
STAMPS = [
@@ -220,12 +221,20 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
220221
"25-multipath",
221222
"40-generate-iscsi-iqn",
222223
"50-prepare-control-domain-params",
223-
"60-upgrade-likewise-to-pbis",
224224
"90-flush-pool-db",
225-
"95-legacy-logrotate",
226225
"99-remove-firstboot-flag",
227226
]
228-
if lsb_rel in ["7.0.0-125380c"]:
227+
if lsb_rel in ["6.5.0-90233c"]:
228+
STAMPS += [
229+
"05-filesystem-summarise",
230+
"30-prepare-networking",
231+
]
232+
else:
233+
STAMPS += [
234+
"60-upgrade-likewise-to-pbis",
235+
"95-legacy-logrotate",
236+
]
237+
if lsb_rel in ["6.5.0-90233c", "7.0.0-125380c"]:
229238
STAMPS += [
230239
"61-regenerate-old-templates",
231240
]
@@ -297,7 +306,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
297306
"81", "80",
298307
"76", "75",
299308
"ch821.1", "xs8",
300-
"xs70",
309+
"xs70", "xs65",
301310
))
302311
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
303312
@pytest.mark.continuation_of(

0 commit comments

Comments
 (0)