Dear Richard, Thank you for taking the time to reply to me. i have tested with "-x" option, but i cannot connect to Ceph Cluster. like this, root@kvm-test-host:/home/test# virt-customize -x -a rbd:// 1.2.3.4:3300/test/test-base-img --hostname abc [ 0.0] Examining the guest ... libguestfs: trace: set_network true libguestfs: trace: set_network = 0 libguestfs: trace: add_drive "test/test-base-img" "readonly:false" "protocol:rbd" "server:tcp:1.2.3.4:3300" "discard:besteffort" libguestfs: trace: add_drive = 0 libguestfs: trace: launch libguestfs: trace: max_disks libguestfs: trace: max_disks = 255 libguestfs: trace: get_tmpdir libguestfs: trace: get_tmpdir = "/tmp" libguestfs: trace: get_cachedir libguestfs: trace: get_cachedir = "/var/tmp" libguestfs: trace: get_cachedir libguestfs: trace: get_cachedir = "/var/tmp" libguestfs: trace: get_backend_setting "force_tcg" libguestfs: trace: get_backend_setting = NULL (error) libguestfs: trace: get_backend_setting "force_kvm" libguestfs: trace: get_backend_setting = NULL (error) libguestfs: trace: get_sockdir libguestfs: trace: get_sockdir = "/tmp" libguestfs: trace: get_backend_setting "gdb" libguestfs: trace: get_backend_setting = NULL (error) libguestfs: trace: launch = -1 (error) virt-customize: error: libguestfs error: guestfs_launch failed. This usually means the libguestfs appliance failed to start or crashed. Do: export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 and run the command again. For further information, read: http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs You can also run 'libguestfs-test-tool' and post the *complete* output into a bug report or message to the libguestfs mailing list. If reporting bugs, run virt-customize with debugging enabled and include the complete output: virt-customize -v -x [...] libguestfs: trace: close Actually, my question was how to pass the secret of ceph storage as a parameter when using uri pattern as follows. virt-customize -x -a rbd://1.2.3.4:3300/test/test-base-img add_drive "test/test-base-img" "readonly:false" "protocol:rbd" "server:tcp: 1.2.3.4:3300" "discard:besteffort" (how can i pass parameter "secret:{keyring}", "username:admin" in uri pattern?) i'm using qemu binary directly (qemu-system-x86_64) for using a VM instance, not through libvirt. So if I use libvirt, I expect it will take a long time to set up the VM because i have to add a domain to libvirtd. Thanks. 2024년 8월 10일 (토) 오전 12:46, Richard W.M. Jones <rjones@redhat.com>님이 작성:
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
On Fri, Aug 09, 2024 at 11:59:45AM -0000, brownie4597@gmail.com wrote: 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