[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] C# bindings (Was: First patch)

On 10/20/2010 05:08 AM, Justin Clift wrote:
On 10/20/2010 04:57 AM, Eric Blake wrote:
Ok, how's this?


Can we also include a sample program using the bindings, as is done in
http://justinclift.fedorapeople.org/csharp/python.html and

Good idea. Just added a space for one in the layout.

Arnaud, would I be able to get an example program from you, for adding
there? Is "virConnectOpenAuth" the correct kind of thing?

Looked at the virConnectOpenAuth example (from Arnauds patches waiting
for review).  It doesn't seem like a suitable example for the web page,
as the example code is a lot longer/larger than we'd like for this.

Arnaud, do you have time to create an extremely simple example?

Something that shows the very minimum needed.  Sort of like this:
(I do not know C# at all though :>)

  using System;
  using LibvirtBindings;

  // Fill a virConnectAuth structure
  virConnectAuth auth = new virConnectAuth
    cbdata = authData,  // The authData structure
    cb = AuthCallback,  // the method called by callbacks
    CredTypes = new[]
                      // The list of credentials types

  // Request the connection
  IntPtr conn = libVirt.virConnectOpenAuth(tbURI.Text, ref auth, 0);

  // Get the pointer to the domain
  string domainName = new string "MyGuest";
  IntPtr domainPtr = libVirt.virDomainLookupByName(conn, domainName);

  // Start the domain
  Int something = libVirt.virDomainCreate(domainPtr);

  // Close the connection


Regards and best wishes,

Justin Clift

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]