From: Fiona Ebner <f.ebner@proxmox.com>
To: Markus Frank <m.frank@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server v2 1/2] QEMU AMD SEV enable
Date: Thu, 17 Nov 2022 12:27:37 +0100 [thread overview]
Message-ID: <335ab365-5286-d88a-2694-2feb087944ce@proxmox.com> (raw)
In-Reply-To: <eecbdb15-714e-112f-b6e2-69e1286918f7@proxmox.com>
Am 17.11.22 um 11:50 schrieb Markus Frank:>>> @@ -2113,6 +2171,17 @@ sub
parse_guest_agent {
>>> return $res;
>>> }
>>> +sub parse_memory_encryption {
>>> + my ($value) = @_;
>>> +
>>> + return if !$value;
>>> +
>>> + my $res = eval { parse_property_string($memory_encryption_fmt,
>>> $value) };
>>> + warn $@ if $@;
>>> + return $res;
>>> +}
>>
>> Why not fail if parsing fails?
> replaced warn with die
You can also just remove the eval to make the error propagate ;) And I
guess the whole helper could be replaced at the call side with an inline
parse_property_string($memory_encryption_fmt, $value) if $value
but no big deal.
>>> + # Get reduced-phys-bits & cbitpos from QMP, if not set
>>> + if (
>>> + !$memory_encryption->{'reduced-phys-bits'}
>>> + || !$memory_encryption->{cbitpos}
>>> + ) {
>>> + my $fakevmid = -1;
>>> + my $qemu_cmd = get_command_for_arch($arch);
>>> + my $pidfile =
>>> PVE::QemuServer::Helpers::pidfile_name($fakevmid);
>>> + my $default_machine = $default_machines->{$arch};
>>> + my $cmd = [
>>> + $qemu_cmd,
>>> + '-machine', $default_machine,
>>> + '-display', 'none',
>>> + '-chardev',
>>> "socket,id=qmp,path=/var/run/qemu-server/$fakevmid.qmp,server=on,wait=off",
>>> + '-mon', 'chardev=qmp,mode=control',
>>> + '-pidfile', $pidfile,
>>> + '-S', '-daemonize'
>>> + ];
>>
>> Instead of daemonizing, pidfile etc. we could also use --qmp stdio and
>> pass the commands via stdin like:
>> {"execute": "qmp_capabilities"}
>> {"execute": "query-sev-capabilities"}
>> {"execute": "quit"}
>> which might be a bit more straight-forward. But maybe we prefer re-using
>> the existing infrastructure with the fake ID, not sure?
> What would be the best way to send stdin to "kvm -qmp stdio" here?
>
> Not the same way like I would do in shell or yes?:
> echo '{"execute": "qmp_capabilities"} {"execute":
> "query-sev-capabilities"} {"execute": "quit"}' | kvm -qmp stdio
The run_command helper can take an "input => $input" parameter. Haven't
actually used it myself, but there are existing examples in our code base :)
next prev parent reply other threads:[~2022-11-17 11:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 14:27 [pve-devel] [PATCH qemu-server/docs v2 0/2] AMD SEV Markus Frank
2022-11-11 14:27 ` [pve-devel] [PATCH qemu-server v2 1/2] QEMU AMD SEV enable Markus Frank
2022-11-14 13:06 ` Fiona Ebner
2022-11-17 10:50 ` Markus Frank
2022-11-17 11:27 ` Fiona Ebner [this message]
2022-11-11 14:27 ` [pve-devel] [PATCH docs v2 2/2] added Memory Encryption documentation Markus Frank
2022-11-11 14:48 ` Matthias Heiserer
2022-11-14 13:07 ` Fiona Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=335ab365-5286-d88a-2694-2feb087944ce@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=m.frank@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.