-
-
Notifications
You must be signed in to change notification settings - Fork 149
Simplify qemu shutdown script? #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,59 +331,30 @@ lib.warnIf (mem == 2048) '' | |
then | ||
'' | ||
( | ||
${writeQmp { execute = "qmp_capabilities"; }} | ||
${writeQmp { | ||
execute = "input-send-event"; | ||
arguments.events = [ { | ||
type = "key"; | ||
data = { | ||
down = true; | ||
key = { | ||
type = "qcode"; | ||
data = "ctrl"; | ||
}; | ||
}; | ||
} { | ||
type = "key"; | ||
data = { | ||
down = true; | ||
key = { | ||
type = "qcode"; | ||
data = "alt"; | ||
}; | ||
}; | ||
} { | ||
type = "key"; | ||
data = { | ||
down = true; | ||
key = { | ||
type = "qcode"; | ||
data = "delete"; | ||
}; | ||
}; | ||
} ]; | ||
}} | ||
# wait for exit | ||
${writeQmp { execute = "query-commands"; }} | ||
${writeQmp { execute = "system_powerdown"; }} | ||
# wait for exit | ||
cat | ||
) | \ | ||
${pkgs.socat}/bin/socat STDIO UNIX:${socket},shut-none | ||
'' | ||
else throw "Cannot shutdown without socket"; | ||
|
||
setBalloonScript = | ||
if socket != null | ||
then '' | ||
if balloon | ||
then | ||
if socket != null then | ||
'' | ||
Comment on lines
+344
to
+347
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we change this again, we can drop the change in the last commit, to make the history cleaner. |
||
VALUE=$(( $SIZE * 1024 * 1024 )) | ||
SIZE=$( ( | ||
${writeQmp { execute = "qmp_capabilities"; }} | ||
${writeQmp { execute = "balloon"; arguments.value = 987; }} | ||
) | sed -e s/987/$VALUE/ | \ | ||
${pkgs.socat}/bin/socat STDIO UNIX:${socket},shut-none | \ | ||
tail -n 1 | \ | ||
Comment on lines
-378
to
-382
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did you test that this did not break anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because I removed the echo capabilities line, which doesn't do anything because it gets tailed away. That line doesn't seem to do anything at all because the user won't be able to see the output. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sorry I just read the docs; I did not realise you had to execute capabilities to establish a connection, what a strange requirement |
||
${pkgs.jq}/bin/jq -r .data.actual \ | ||
) | ||
echo $(( $SIZE / 1024 / 1024 )) | ||
'' | ||
'' | ||
else throw "Cannot balloon without socket" | ||
else null; | ||
|
||
requiresMacvtapAsFds = true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your motivation to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as below, I did not know this was required.