On Fri, Aug 09, 2024 at 11:59:45AM -0000, brownie4597@gmail.com wrote:
First, i'm appreciate to your hard work. i have a question for using virt-{X} commands (virt-customize, virt-cat and so on...).
Is there any way to connect RBD storage including keyring for using virt-X commands?
it seems possible with `guestfish add`, but i could not find out with -a option. https://libguestfs.org/guestfish.1.html#adding-remote-storage (ex. -a rbd://example.com[:port]/pool/disk)
rbd://... URIs should be supported by virt-customize. However I kind of doubt that anyone has ever tested them. Also this doesn't pass the secret along. You could try it anyhow: virt-customize -a rbd://... --hostname ... If libvirt knows about the guest, then an alternative is to use the -d option with the libvirt guest name. Again in theory this should just set up the disks (with the secret?), although I doubt anyone tried it.
i tried hard, but switching virt-X commands to `guestfish` is so difficult. - like `virt-customize`
virt-customize --hostname -> guestfish add pool/image protocol:rbd username:admin server:example.com:1234 secret:{keyring} : run : mount ~~~ : write /etc/hostname ~~~)
If there is a way, I would appreciate it if you could let me know. Thanks
One thing that might help is to run virt-customize with the -x option (but not -v), which will print the libguestfs calls being made. You'll see that virt-customize high level commands translate in some cases into a lot of low level calls. But some virt-customize commands are actually quite trivial. For example, setting a hostname on a test image: $ virt-builder fedora-39 $ virt-customize -a fedora-39.img -x --hostname foobar ... libguestfs: trace: write "/etc/hostname" "foobar\x0a" ... The key guestfish command here is just the 'write'. So the guestfish equivalent would be: $ guestfish
<fs> add pool/image protocol:rbd username:admin server:example.com:1234 secret:{keyring} <fs> run <fs> [mount up the disks] <fs> write "/etc/hostname" "foobar\n" <fs> exit
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org