[libvirt] libvirt API/design questions

Cole Robinson crobinso at redhat.com
Wed Dec 11 14:45:07 UTC 2019


There's some pre-existing libvirt design questions I would like some
feedback on, and one new one


* `virsh blockresize` doesn't prevent shrink by default, couple users
have blown their foot off and there's attempts at patches.
https://www.redhat.com/archives/libvir-list/2019-October/msg00258.html
https://www.redhat.com/archives/libvir-list/2019-November/msg00843.html

Do we implement this as a protection in virsh, or change the API
behavior and require a new API flag to allow shrinking? Or some other idea?


* vhost-user-scsi and vhost-user-blk XML schema
https://www.redhat.com/archives/libvirt-users/2019-October/msg00018.html

Last proposal was using <hostdev> for this, which revisiting it now
makes more sense than <disk>, because it vhost-user-X doesn't seem to
use qemu's block layer at all. So vhost-user-scsi would be:

    <hostdev mode='subsystem' type='scsi_host'>
      <source protocol='vhostuser' type='unix'
path='/path/to/vhost-user-scsi.sock' mode='client'/>
    </hostdev>

vhost-user-blk maybe requires a new type='block' ? Otherwise it's
unclear how to differentiate between the two. Regardless it would be
nice to give the original patch author guidance here, they seemed
motivated to get this working


* Splitting domain_conf up. There's 30k lines in domain_conf.c and 3500
in domain_conf.h, it would be nice to unwind it a bit. Getting some sign
off on this ahead of time is critical IMO so pieces can be posted and
committed quickly because they will obviously go out of date fast. My
thoughts:

- domain_def.[ch]: DomainDefXXX and enum definitions.
  - probably New and Free functions too
- domain_parse.[ch]: XML parsing
- domain_format.[ch]: XML formatting
- domain_validate.[ch]: validate and postparse handling
- domain_util.[ch]: everything else, or keep it in domain_conf?

domain_def should be easy but no idea how intertwined the rest are. If
the domain_validate naming is acceptable for both validate and postparse
functions, we could use that naming for qemu_domain.c split too.

Also maybe it's worth considering if there's some way to sensibly split
the conf/ directory. We could add a top level domain/ directory, but
that's kinda ambiguously named as we already have network/ + storage/ +
secret/ etc that have different meanings. Maybe sub dirs like
conf/domain/ ? I'm curious if anyone has strong feelings either way.
There's not really a clear place to dump shared DomainDef code at the
moment, like possible domain_cgroup for sharing cgroup handling across
lxc + qemu

Thanks,
Cole




More information about the libvir-list mailing list