[libvirt] C# bindings (Was: First patch)
arnaud.champion at devatom.fr
arnaud.champion at devatom.fr
Tue Oct 19 19:59:43 UTC 2010
?Well, I can make a little sample, with virConnectOpen instead of
virConnectOpenAuth, because virConnectOpenAuth cannot work without callback
handling, that's why it's larger. But I will be tomorrow ;) it's time to
sleep for me.
--------------------------------------------------
From: "Justin Clift" <jclift at redhat.com>
Sent: Tuesday, October 19, 2010 9:46 PM
To: "Arnaud Champion" <arnaud.champion at devatom.fr>
Cc: "Libvirt Developers Mailing List" <libvir-list at redhat.com>
Subject: 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:
>> <snip>
>>>> Ok, how's this?
>>>>
>>>> http://justinclift.fedorapeople.org/csharp/csharp.html
>>>
>>> Can we also include a sample program using the bindings, as is done in
>>> http://justinclift.fedorapeople.org/csharp/python.html and
>>> http://justinclift.fedorapeople.org/csharp/java.html?
>>
>> 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
> virConnectCredentialType.VIR_CRED_AUTHNAME,
> virConnectCredentialType.VIR_CRED_PASSPHRASE
> }
> };
>
> // 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
> libVirt.virConnectClose(conn);
>
> ?
>
> Regards and best wishes,
>
> Justin Clift
>
More information about the libvir-list
mailing list