Skip to content

Commit ca0d0b9

Browse files
committed
DBG - close channels
1 parent 5f05d08 commit ca0d0b9

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ COCKPIT_REPO_FILES = \
4040
$(NULL)
4141

4242
COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git
43-
COCKPIT_REPO_COMMIT = dad4484037b14dda1f6040c52d314a3ba8bc5cc8 # 336 + a couple commits
43+
COCKPIT_REPO_COMMIT = 77facae6b8bf4ec98d5d278d5986b848340f4206 # 336 + a couple commits
4444

4545
$(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP)
4646
COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}'

src/components/vm/consoles/serial.jsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class SerialActive extends React.Component {
7575
}
7676

7777
componentDidMount() {
78-
this.updateChannel(this.props.spawnArgs);
78+
this.updateChannel();
7979
}
8080

8181
componentDidUpdate(prevProps) {
@@ -84,8 +84,10 @@ export class SerialActive extends React.Component {
8484

8585
const channel_needs_update = () => {
8686
if (newSpawnArgs.length !== oldSpawnArgs.length ||
87-
oldSpawnArgs.some((arg, index) => arg !== newSpawnArgs[index]))
87+
oldSpawnArgs.some((arg, index) => arg !== newSpawnArgs[index])) {
88+
console.log("ARGS CHANGES", JSON.stringify({ old: oldSpawnArgs, new: newSpawnArgs }));
8889
return true;
90+
}
8991
if (this.props.state.connected && !this.state.channel)
9092
return true;
9193
if (!this.props.state.connected && this.state.channel)
@@ -94,12 +96,20 @@ export class SerialActive extends React.Component {
9496
};
9597

9698
if (channel_needs_update())
97-
this.updateChannel(this.props.spawnArgs);
99+
this.updateChannel();
98100
}
99101

100102
updateChannel() {
101-
if (this.state.channel)
103+
console.log("CHANNEL UPDATE", JSON.stringify({
104+
args: this.props.spawnArgs,
105+
connected: this.props.state.connected,
106+
has_channel: !!this.state.channel
107+
}));
108+
109+
if (this.state.channel) {
110+
console.log("UPDATE CLOSE", JSON.stringify(this.state.channel.options.spawn));
102111
this.state.channel.close();
112+
}
103113

104114
if (this.props.state.connected) {
105115
const opts = {
@@ -109,6 +119,7 @@ export class SerialActive extends React.Component {
109119
};
110120
if (this.props.connectionName == "system")
111121
opts.superuser = "try";
122+
console.log("UPDATE OPEN");
112123
const channel = cockpit.channel(opts);
113124
this.setState({ channel });
114125
} else {

test/check-machines-consoles

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,17 @@ fullscreen=0
168168
b.wait(lambda: m.execute(
169169
f'ps aux | grep \'virsh -c [q]emu:///system console vmWithSerialConsole {tag}{i}\'')) # noqa: B023
170170

171+
def console_channels():
172+
output = m.execute("(ps aux | grep 'virsh -c [q]emu:///system console vmWithSerialConsole') || true")
173+
print("CHANNELS", output)
174+
return output
175+
171176
# Verify that there is still at least one channel open
172-
b.wait(lambda: m.execute("(ps aux | grep 'virsh -c [q]emu:///system console vmWithSerialConsole')"))
177+
b.wait(lambda: console_channels() != "")
173178
# Navigating away from the details page should close all channels
179+
print("MAIN")
174180
self.goToMainPage()
175-
b.wait(lambda: m.execute("! (ps aux | grep 'virsh -c [q]emu:///system console vmWithSerialConsole')") == "")
181+
b.wait(lambda: console_channels() == "")
176182

177183
# disconnecting the serial console closes the pty channel
178184
self.allow_journal_messages("connection unexpectedly closed by peer",

0 commit comments

Comments
 (0)