<div dir="ltr">Hi Eric,<div><br></div><div>Thanks for your response.</div><div>I like to know how test driver works. </div><div><br></div><div>In the <a href="http://libvirt.org">libvirt.org</a> for test driver it is mentioned as "<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">It can start with a pre-configured default config, or be given a path to an alternate config".</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">Is the config is an xml file where we mentioned some dummy data so that the test driver will return it as response. If yes then where can I find this dummy file?</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">As mentioned earlier my intention is to mock qemu calls. so it test driver works then I'm planning to remove the qemu driver and register "test" driver as "qemu" driver and take the fake data from the config file. Please let me know which are the files I need to look into to register "test" as "qemu" and make its operations to work.</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">Thanks In Advance,</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">Arun V</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 11, 2013 at 12:14 AM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 09/10/2013 12:03 PM, Arun Viswanath wrote:<br>
> Hi All,<br>
>    I'm need to simulate libvirt API's say to mock the libvirt API<br>
> responses. (Actually I need to simulate qemu API's response). Because of my<br>
> project needs I need to write this simulated libvirt server in Java. I<br>
> believe the simulated libvirt can be written as java RPC which should<br>
> capable to receive the client RPC request calls and by dispatcher we can<br>
> dispatch to the simulated java functions. I searched for .x file to be used<br>
> for generating server stubs but unfortunately .x files like<br>
> "remote_protocol.x", "virnetprotocol.x", "qemu_protocol.x" and<br>
> "lxc_monitor_protocol.x" are not containing any procedure for libvirt API's<br>
> that exposed. Please let me know which files will have these exposed<br>
> procedures and how can I use it in java,<br>
<br>
</div>Rather than trying to write your own RPC handler, have you considered<br>
using the existing libvirt-java bindings and just targetting the<br>
test:/// URI connection?  This will give you a fairly reliable exposure<br>
to the libvirt APIs, without actually needing a working qemu.<br>
<br>
The .x files implement the driver API; so also does the test driver.<br>
Basically, src/libvirt.c is the public API, which then delegates to the<br>
appropriate driver based on what URI you connected to; if the URI is<br>
remote (as qemu:/// and all other stateful drivers are), then libvirt.so<br>
passes it to src/remote/remote_driver.c to be bundled up into RPC calls<br>
which mirror the semantics of the public API.  If you want to install<br>
your own mock driver, it may be easier to build a new URI and implement<br>
the same C interface as the test driver (see src/test/test_driver.c)<br>
than it is to implement your own RPC parser.<br>
<div class="im"><br>
><br>
>          Also I'm not sure how to implement the ssl layer support for the<br>
> libvirt server in java. I need to write a java server in such a way that<br>
> python client should capable to create a connection with uri<br>
> "qemu+tls://systemip:port?no_tty=1". Also with the created connection<br>
> object it should able to call the libvirt API's like getCapabilities, etc.<br>
<br>
</div>Again, instead of trying to write your own RPC server, I'd instead focus<br>
on utilizing the existing test:/// driver as your point of mocked calls.<br>
<br>
As this is mostly development-related, I've set the reply-to to<br>
libvir-list (we can drop libvirt-users from the rest of this thread).<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Eric Blake   eblake redhat com    +1-919-301-3266<br>
Libvirt virtualization library <a href="http://libvirt.org" target="_blank">http://libvirt.org</a><br>
<br>
</font></span></blockquote></div><br></div>