Saturday, April 10, 2021

Re: [doc] using qemu guest agent on OpenBSD kvm/qemu guests

On 4/10/2021 3:05 AM, Landry Breuil wrote:
> On Fri, Apr 09, 2021 at 04:53:17PM +0200, Landry Breuil wrote:
>> On Thu, Apr 08, 2021 at 06:19:58PM +0200, Jeroen Derks wrote:
>>> On 08/04/2021 14:35, Landry Breuil wrote:>
>>>> well that's very nice, definitely interested in those freebsd patches !
>>>> not 100% sure those will get in 6.9 though as we're slowly moving towards
>>>> lock, but send them anyway, and we'll figure out what we can do from
>>>> there. I suppose those come from https://github.com/aborche/qemu-guest-agent ?
>>> Indeed, here they are (if there's interest I can also send a diff of the patches
>>> compared to the FreeBSD patches to see what I've done):
>> oh, well that looks nice. A bit rought around the edges imo, and im not
>> sure we want to maintain a rather large patch like this in the
>> portstree. according to https://wiki.qemu.org/Contribute/SubmitAPatch i
>> think it should be pushed upstream, do you have any idea if the original
>> freebsd patches were proposed there or qemu-devel list ?
>>
>> i'll let brad decide, but as is this doesnt apply as-is against 6.0 rcs
>> which we're testing for post-6.9....
> so i've backported your patch on top of brad's 6.0rc2 qemu update, and
> fixed things here and there, removed commented code, and yeah get-vcpus,
> get-fsinfo and network-get-interfaces seems to work fine !

Thanks.

I don't mind keeping this or some variation on it around. It is small
enough.

I would very much hope that there is an attempt to upstream this in some
form.

> i'm not sure we want the set user password thing in the patch, as it
> wont work on openbsd (uses the pw command which is freebsd ?). It's also
> a bit gross to exec df to fetch the mount point list..
>
> im also not sure what to do with the localstatedir thing (the -t flag),
> i've added --localstatedir=/tmp/ to CONFIGURE_ARGS but that feels wrong.
> qga needs it to store its qga.state file and probably to store temp
> files..
>
> to build the 6.0rc2 update with those two attached patches (to drop
> under patches/), just add to the port Makefile:
>
> # qemu-ga support for more operations
> CFLAGS+= -DBSD_GUEST_AGENT
>
> Landry
>
> [08:50] c64:~/mystuff/emulators/qemu/ $mkdir /tmp/run
> [08:50] c64:~/mystuff/emulators/qemu/ $doas qemu-ga -v
> 1618037419.280400: debug: disabling command: guest-suspend-disk
> 1618037419.280439: debug: disabling command: guest-suspend-ram
> 1618037419.280452: debug: disabling command: guest-suspend-hybrid
> 1618037419.280463: debug: disabling command: guest-set-vcpus
> 1618037419.280474: debug: disabling command: guest-get-memory-blocks
> 1618037419.280485: debug: disabling command: guest-set-memory-blocks
> 1618037419.280496: debug: disabling command: guest-get-memory-block-size
> 1618037419.280507: debug: disabling command: guest-get-memory-block-info
> 1618037419.280519: debug: disabling command: guest-fsfreeze-status
> 1618037419.280530: debug: disabling command: guest-fsfreeze-freeze
> 1618037419.280541: debug: disabling command: guest-fsfreeze-freeze-list
> 1618037419.280551: debug: disabling command: guest-fsfreeze-thaw
> 1618037419.280564: debug: disabling command: guest-fstrim
> 1618037419.280578: debug: disabling command: guest-get-devices
>
>
> root@openbsd-amd64:~# qm agent 100 get-vcpus
> [
> {
> "logical-id" : 0,
> "online" : true
> },
> {
> ...
> {
> "logical-id" : 7,
> "online" : true
> }
> ]
> ...
> root@openbsd-amd64:~# qm agent 100 get-fsinfo
> [
> {
> "disk" : [],
> "mountpoint" : "/build",
> "name" : "/dev/sd1a",
> "total-bytes" : 50195449856,
> "type" : "ffs",
> "used-bytes" : 28191496192
> },
> {
> "disk" : [],
> "mountpoint" : "/var",
> "name" : "/dev/sd0e",
> "total-bytes" : 4011888640,
> "type" : "ffs",
> "used-bytes" : 3049684992
> },
> ...
>
> root@openbsd-amd64:~# qm agent 100 network-get-interfaces
> [
> {
> "hardware-address" : "a2:6e:16:9f:42:70",
> "ip-addresses" : [
> {
> "ip-address" : "10.0.3.254",
> "ip-address-type" : "ipv4",
> "prefix" : 24
> }
> ],
> "name" : "vio0"
> },
> {
> "hardware-address" : "be:10:50:5f:d0:78",
> "ip-addresses" : [
> {
> "ip-address" : "10.0.2.2",
> "ip-address-type" : "ipv4",
> "prefix" : 28
> }
> ],
> "name" : "vio1"
> },
> ...

No comments:

Post a Comment