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

Re: [libvirt] SPAM-LOW: Domain.GetInfo error



Hi,
 
In fact, when you compile libvirt with mingwin/msys, the binaries are compiled in 32 bits, even it runs on a 64 bits system. Accordingly, C# bindings must be targeted as x86 (32 bits) when compiling them. This isn't a problem for a 64 bits application which use bindings, .Net make the trick to make it works.
 
I haven't made any test with xen (I haven't xen) but if your sample works, it means libvirt is compiled with xen support.
 
Happy halloween to you also.
 
Arnaud

From: 黄亮
Sent: Sunday, October 31, 2010 6:52 AM
Subject: Re: Re: SPAM-LOW: Domain.GetInfo error

Hi,
 
Thanks for your reply.
It works with the patch you provide in last letter.
But I don't understand "x86 target" you mentioned, does it mean if I want to make the code run, the server which runs xend & libvirtd must be a x86 arch, not a x64 arch?
 
As to the question "are you sure also that libvirt dll is compiled with xen support ?"
I just follow the instructions on http://github.com/photron/msys_setup, without the ESX support, I think it should support Xen, though it isn't write in explicit.
 
Anyway, at least it's working. Thanks for your reply.
 
Regards and Best wishes, and Happy Halloween XD
 
 
2010-10-31

Lancer 

发件人: arnaud champion devatom fr
发送时间: 2010-10-31  01:21:52
收件人: 黄亮
抄送: libvir-list redhat com
主题: Re: SPAM-LOW: Domain.GetInfo error
Hi,
 
So, at first, are you sure that conn != IntPtr.Zero and pDomain != IntPtr.Zero.
if both pointer are ok, can you please check the DomainInfo marshal, I have just sended patch today around this structure, and I think the patch is not yet pushed to the git.
The DomainInfo structure must be marshaled in this way :
 

/// <summary>

/// Structure to handle domain informations

/// </summary>

[StructLayout(LayoutKind.Sequential)]

public class DomainInfo

{

/// <summary>

/// The running state, one of virDomainState.

/// </summary>

private byte state;

/// <summary>

/// The maximum memory in KBytes allowed.

/// </summary>

[MarshalAs(UnmanagedType.SysUInt)]

public UIntPtr maxMem;

/// <summary>

/// The memory in KBytes used by the domain.

/// </summary>

[MarshalAs(UnmanagedType.SysUInt)]

public UIntPtr memory;

/// <summary>

/// The number of virtual CPUs for the domain.

/// </summary>

public ushort nrVirtCpu;

/// <summary>

/// The CPU time used in nanoseconds.

/// </summary>

[MarshalAs(UnmanagedType.SysUInt)]

public UIntPtr cpuTime;

/// <summary>

/// The running state, one of virDomainState.

/// </summary>

public DomainState State { get { return (DomainState)state; } }

}

 

Also, another important thing change : the libvirt bindings project must have an x86 target to make this marshaling working. This is also in the patch.

 

Another thing, you can also use Errors.GetLastErro() method to identify the problem, it return an error class which can inform you about the problem.

 

Best regards,

 

Arnaud

 

PS : are you sure also that libvirt dll is compiled with xen support ?


From: 黄亮
Sent: Saturday, October 30, 2010 7:07 PM
Subject: SPAM-LOW: Domain.GetInfo error

Dear Arnaud
 
Here is my test code. Function Domain.GetInfo return -1 and I don't know where is the mistake.
Would you do me a favor to point out the problem? Thank you!
 
Code:
 
   IntPtr conn = Connect.Open("xen+tcp://192.168.0.1?no_verify=1");
   String DomainName = e.Node.Text;
   IntPtr pDomain = Domain.LookupByName(conn, DomainName);
 
   DomainInfo aInfo = new DomainInfo();
   if (Domain.GetInfo(pDomain, aInfo) == -1)
   {
    MessageBox.Show("Get Info error");
    return;
   }
 
2010-10-31

黄亮


__________ Information from ESET Smart Security, version of virus signature database 5576 (20101029) __________

The message was checked by ESET Smart Security.

http://www.eset.com

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