File tree Expand file tree Collapse file tree 4 files changed +49
-30
lines changed Expand file tree Collapse file tree 4 files changed +49
-30
lines changed Original file line number Diff line number Diff line change
1
+ name : collect-logs
2
+ description : Store debugging information for offline analysis
3
+ runs :
4
+ using : " composite"
5
+ steps :
6
+ - name : Obtain logs from test runner
7
+ shell : bash
8
+ run : |
9
+ sudo cp /var/log/libvirt/qemu/HV1.log "libvirt-HV1.log" || true
10
+ sudo cp /var/log/libvirt/qemu/HV2.log "libvirt-HV2.log" || true
11
+ sudo journalctl --no-pager > journal-RUNNER.log || true
12
+
13
+ - name : Obtain logs from hypervisors
14
+ shell : bash
15
+ run : |
16
+ KEY=/opt/ssh_host_ed25519_key
17
+ SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
18
+ USER="root"
19
+ HV1_IP="192.168.122.2"
20
+ HV2_IP="192.168.122.3"
21
+
22
+ ssh $SSH_OPTS $USER@$HV1_IP "journalctl --no-pager" > "journal-HV1.log" || true
23
+ scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/qemu/VM-QEMU.log "libvirt-VM-QEMU-HV1.log" || true
24
+ scp $SSH_OPTS $USER@$HV1_IP:/var/log/libvirt/ch/VM-CHV.log "libvirt-VM-CHV-HV1.log" || true
25
+ scp $SSH_OPTS $USER@$HV1_IP:/var/log/QEMU.log "serial-VM-QEMU-HV1.log" || true
26
+
27
+ ssh $SSH_OPTS $USER@$HV2_IP "journalctl --no-pager" > "journal-HV2.log" || true
28
+ scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/qemu/VM-QEMU.log "libvirt-VM-QEMU-HV2.log" || true
29
+ scp $SSH_OPTS $USER@$HV2_IP:/var/log/libvirt/ch/VM-CHV.log "libvirt-VM-CHV-HV2.log" || true
30
+ scp $SSH_OPTS $USER@$HV2_IP:/var/log/QEMU.log "serial-VM-QEMU-HV2.log" || true
31
+
32
+ - name : Set permissions
33
+ shell : bash
34
+ run : |
35
+ sudo chmod 644 *.log
36
+
37
+ - name : Upload artifacts
38
+ uses : actions/upload-artifact@v4
39
+ with :
40
+ name : debug-logs
41
+ path : " *.log"
42
+
Original file line number Diff line number Diff line change 47
47
SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
48
48
USER="root"
49
49
50
- MAX_ITER=40
50
+ MAX_ITER=60
51
51
for ((i=1; i<=MAX_ITER; i++)); do
52
52
IP=\$(virsh -c ch:///session domifaddr VM-CHV | awk '/ipv4/ {print \$4}' | cut -d'/' -f1)
53
53
if [ -z "\$IP" ]; then
60
60
fi
61
61
if (( i == MAX_ITER )); then
62
62
echo "Timeout waiting for VM to respond to SSH."
63
- cat /var/log/CHV.log
64
63
exit 1
65
64
fi
66
65
echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
@@ -110,7 +109,7 @@ runs:
110
109
# the IP is static, so we can just use it directly
111
110
IP="192.168.222.3"
112
111
113
- MAX_ITER=40
112
+ MAX_ITER=15
114
113
for ((i=1; i<=MAX_ITER; i++)); do
115
114
if ssh \$SSH_OPTS "\$USER@\$IP" 'exit' ; then
116
115
echo "VM is up at IP: \$IP"
@@ -125,7 +124,6 @@ runs:
125
124
fi
126
125
if (( i == MAX_ITER )); then
127
126
echo "Timeout waiting for VM to respond to SSH."
128
- cat /var/log/CHV.log
129
127
exit 1
130
128
fi
131
129
echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
Original file line number Diff line number Diff line change 45
45
SSH_OPTS="-i \$KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
46
46
USER="root"
47
47
48
- MAX_ITER=40
48
+ MAX_ITER=60
49
49
for ((i=1; i<=MAX_ITER; i++)); do
50
50
IP=\$(virsh domifaddr VM-QEMU | awk '/ipv4/ {print \$4}' | cut -d'/' -f1)
51
51
if [ -z "\$IP" ]; then
58
58
fi
59
59
if (( i == MAX_ITER )); then
60
60
echo "Timeout waiting for VM to respond to SSH."
61
- cat /var/log/QEMU.log
62
61
exit 1
63
62
fi
64
63
echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
@@ -108,7 +107,7 @@ runs:
108
107
# the IP is static, so we can just use it directly
109
108
IP="192.168.222.2"
110
109
111
- MAX_ITER=40
110
+ MAX_ITER=15
112
111
for ((i=1; i<=MAX_ITER; i++)); do
113
112
if ssh \$SSH_OPTS "\$USER@\$IP" 'exit' 2>/dev/null; then
114
113
echo "VM is up at IP: \$IP"
@@ -123,32 +122,9 @@ runs:
123
122
fi
124
123
if (( i == MAX_ITER )); then
125
124
echo "Timeout waiting for VM to respond to SSH."
126
- cat /var/log/QEMU.log
127
125
exit 1
128
126
fi
129
127
echo "Waiting for VM to respond to SSH... (\$i/\$MAX_ITER)"
130
128
sleep 10
131
129
done
132
130
EOF
133
-
134
- - name : Clean up HyperVisors
135
- shell : bash
136
- run : |
137
- KEY=/opt/ssh_host_ed25519_key
138
- SSH_OPTS="-i $KEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
139
- USER="root"
140
- IP_HV1="192.168.122.2"
141
- IP_HV2="192.168.122.3"
142
-
143
- cleanup() {
144
- local IP="$1"
145
- ssh $SSH_OPTS "$USER@$IP" << EOF
146
- virsh destroy VM-QEMU || true
147
- virsh undefine VM-QEMU --nvram --tpm --remove-all-storage
148
- rm -f /var/lib/libvirt/images/ubuntu.qcow2
149
- rm -f /opt/vm-qemu.xml
150
- EOF
151
- }
152
-
153
- cleanup "$IP_HV1"
154
- cleanup "$IP_HV2"
Original file line number Diff line number Diff line change 40
40
uses : ./.github/actions/test/integration/test/qemu
41
41
- name : Test CloudHypervisor
42
42
uses : ./.github/actions/test/integration/test/cloudhypervisor
43
+ - name : Collect Debug Logs
44
+ if : always()
45
+ uses : ./.github/actions/test/integration/collect-logs
You can’t perform that action at this time.
0 commit comments