<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Richard,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you!  I really appreciate your help and information.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
J.P.</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Richard W.M. Jones <rjones@redhat.com><br>
<b>Sent:</b> Saturday, March 14, 2020 3:04 AM<br>
<b>To:</b> JP Zhang <jpzhang@koono.com>; libguestfs@redhat.com <libguestfs@redhat.com><br>
<b>Subject:</b> Re: Use libguestfs with SAS URI of a disk image</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On Sat, Mar 14, 2020 at 04:48:24AM +0000, JP Zhang wrote:<br>
> HI Richard,<br>
> <br>
> Thanks for the quick reply.<br>
> <br>
> The Python program that works, that I mentioned earlier, uses subprocess to issue/run "guestfish" commands below in that order.<br>
> /libguestfs/run guestfish --listen -a <https storage-SAS-URL> -- ro<br>
> then the Python code exported $PID to the environment. I believe so that the same $PID could be used for the subsequent guestfish calls.<br>
> /libguestfs/run guestfish --remote -- -version<br>
> /libguestfs/run guestfish --remote launch<br>
><br>
> Since it is running in the subprocess of "run.sh" shell, I couldn't see the libguestfs debug output. Maybe there is a way, I just don't know.<br>
> <br>
> Then I manually typed similar guestfish commands in Linux bash shell, like<br>
> guestfish --listen -a <https storage-SAS-URL> -- ro<br>
> <this returned a $PID><br>
> guestfish --remote=<$PID> -- -version<br>
> guestfish --remote=<$PID> launch<br>
> this sequence of guestfish commands failed at "launch" cmd.<br>
> <br>
> regarding params passed to add_drive call in libguestfs, the debug trace from running the guestfish cmds above looks like this:<br>
> libguestfs: trace: add_drive "/<container>/abcd" "protocol:https" "server:tcp:<account>.blob.core.windows.net"<br>
> which is something I already tried, not any more insights.<br>
<br>
You'll need the trace from the working call, not the<br>
call that doesn't work.<br>
<br>
Try ‘export LIBGUESTFS_TRACE=1’ before the working command.<br>
<br>
> I really could not tell the difference between these two set of guestfish commands.<br>
> <br>
> (1) do you see any substance difference between doing things in these two sets of commands? ones issued in Python program and ones issued in Bash shell manually?<br>
> (2) if I can add a local VM disk image to libguestfs and list its files, can I safely say that I have libguestfs installed or set up correctly on my machine? meaning I should be able to do "network" based disk image calls/add "network" based disk image? correct,
 in theory? At this point, I cannot 100% trust my local linguestfs setup since I don't know much about libguestfs.<br>
> (3) BTW, I see error message in manual run in Bash shell above. does this tell us anything?<br>
> Could not access KVM kernel module: No such file or directory<br>
> qemu-system-x86_64: failed to initialize KVM: No such file or directory<br>
> qemu-system-x86_64: Back to tcg accelerator<br>
> I see the same KVM error when I ran "libguestfs-test-tool"<br>
> Is KVM kernel absolutely needed? or is this just an option to try and does libguestfs fall back to other Linux kernel to build supermin appliance<br>
> <br>
> BTW, the working Python program was developed by others whom we have no contact now. So far I don't see anything special about Python. It is a just a shell program to issue libguestfs commands and wire up our own processing logic on top of libguestfs.<br>
> <br>
> Regarding using "nbdkit", it looks like it is another service I need to run on my box. The goal of my project is to reduce the hops and improve the performance. Also the code I develop will be a web service that takes many real time requests. with nbdkit,
 does it mean that I need to create a instance of nbdkit on the fly for every request that my service receives? will nbdkit option work well when I have multiple concurrent libguestfs calls going through nbdkit in multiple threads/processes?<br>
<br>
Actually nbdkit doesn't need to be run as a separate service.  You can<br>
run it "captive" from the main program.  It also has several<br>
advantages over using libguestfs to connect to curl directly.<br>
<br>
You probably want to look at what we do in virt-v2v, where we have<br>
almost exactly the same scenario and we use nbdkit to proxy the<br>
connection:<br>
<br>
<a href="https://github.com/libguestfs/virt-v2v/blob/master/v2v/nbdkit.ml">https://github.com/libguestfs/virt-v2v/blob/master/v2v/nbdkit.ml</a><br>
<a href="https://github.com/libguestfs/virt-v2v/blob/f8e4e8643f105bc2abeb6b80b17a0ded3b636b7c/v2v/nbdkit_sources.ml#L276">https://github.com/libguestfs/virt-v2v/blob/f8e4e8643f105bc2abeb6b80b17a0ded3b636b7c/v2v/nbdkit_sources.ml#L276</a><br>
<br>
Also at:<br>
<br>
<a href="http://libguestfs.org/nbdkit.1.html">http://libguestfs.org/nbdkit.1.html</a><br>
<a href="http://libguestfs.org/nbdkit-captive.1.html">http://libguestfs.org/nbdkit-captive.1.html</a><br>
<a href="http://libguestfs.org/nbdkit-curl-plugin.1.html">http://libguestfs.org/nbdkit-curl-plugin.1.html</a><br>
<a href="http://libguestfs.org/nbdkit-cache-filter.1.html">http://libguestfs.org/nbdkit-cache-filter.1.html</a><br>
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones">
http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com">
http://rwmj.wordpress.com</a><br>
libguestfs lets you edit virtual machines.  Supports shell scripting,<br>
bindings from many languages.  <a href="http://libguestfs.org">http://libguestfs.org</a><br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>