Re: [libvirt] Clock problems with Windows guests and Xen

2009-01-27 Thread Matthew Donovan
> On Tue, Jan 27, 2009 at 01:33:21PM -0500, Matthew Donovan wrote:
> > When I start Windows guests with libvirt my clocks are 5 hours off.
When I
> > use a Xen configuration file, I can specify an offset (rtc_timeoffset =
> > -18000) to get my clock to sync with the host.  Is there a way to do
specify
> > this offset in XML with libvirt?  
> > 
> > Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1
and
> > it looks like that part of domain_conf.c hasn't changed.

> Sounds like you have the wrong clock offset setting, in the XML. There
> are two options:

> 
> 

> Usually for Windows you want the 'localtime' one since it is dumb at time
> keeping & DST shifts.

> Daniel

That seems to have done it.

Thanks!
-matthew

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Clock problems with Windows guests and Xen

2009-01-27 Thread Matthew Donovan
When I start Windows guests with libvirt my clocks are 5 hours off.  When I
use a Xen configuration file, I can specify an offset (rtc_timeoffset =
-18000) to get my clock to sync with the host.  Is there a way to do specify
this offset in XML with libvirt?  

Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1 and
it looks like that part of domain_conf.c hasn't changed.

Thanks for any help!
-matthew

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Monitoring guest state (xen hvms)

2008-09-23 Thread Matthew Donovan
I would like to be able to monitor the state of a Xen guest OS via
virDomainGetInfo (and Domain.getInfo() in the Java bindings.)  

When I start, pause, and resume the guest via the libvirt API, it works as
expected.  However, if I shutdown the guest vm by opening a VNC window and
actually selecting "shutdown" via the OS's favorite mechanism (e.g. Start ->
Shutdown in Windows), I lose the state.  In other words, virDomainGetInfo()
returns NOSTATE.

There was some conversation on this list a while ago about
virDomainGetInfo() returning NOSTATE so I added some code and recompiled
libvirt to print the value of the domain_flags returned from the xen
hypervisor.  _When_ it printed this value, it was always zero.  I stress the
"when" part because after the OS completely shuts down, the value of
domain_flags is no longer printed.  

I started virsh and did a list of VMs and the guest is gone.  However, if I
look at "xm list", the domain is still there. 

Is there a reliable way to monitor the guest state when the guest is
shutdown internally (i.e. via the guest OS itself)?

Thanks
-matthew




--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] pausing / unpausing guests with libvirt

2008-09-22 Thread Matthew Donovan
Looks like that did it.  I can pause and resume Linux and Windows guests
with this method.


Thanks a lot! 
-matthew

> -Original Message-
> From: Daniel P. Berrange [mailto:[EMAIL PROTECTED] 
> Sent: Monday, September 22, 2008 4:17 AM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] pausing / unpausing guests with libvirt
> 
> On Sun, Sep 21, 2008 at 05:16:32PM -0400, Matthew Donovan wrote:
> > 
> > DEBUG: libvirt.c: virDomainCreate (domain=0x92bd1e0)
> > DEBUG: libvirt.c: virDomainSuspend (domain=0x92bd1e0)
> > virDomainSuspend() failed: 0
> 
> I think this is a  bug in the Xen driver - the  virDomainCreate 
> api is not updating the internal 'id' parameter of the virDomainPtr
> object, so when you then call virDomainSuspend() with the same
> virDomainPtr it doesn't have the id it needs
> 
> The easy workaround is to just get rid of your existing dom object
> and lookup a new one with 'virDomainLoopByUUID' after starting it.
> 
>  virDomainPtr dom;
>  char  uuid[VIR_UUID_BUFLEN];
> 
>  virDomainCreate(dom);
> 
>  virDomainGetUUID(dom, uuid);
>  virDomainFree(dom);
>  dom = virDomainLookupByUUID(conn, uuid);
> 
>  virDomainSuspend(dom);
> 
> Daniel
> -- 
> |: Red Hat, Engineering, London   -o-   
> http://people.redhat.com/berrange/ :|
> |: http://libvirt.org  -o-  http://virt-manager.org  -o-  
> http://ovirt.org :|
> |: http://autobuild.org   -o- 
> http://search.cpan.org/~danberr/ :|
> |: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF 
> F742 7D3B 9505 :|
> 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] pausing / unpausing guests with libvirt

2008-09-21 Thread Matthew Donovan
r')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb
1)(usbdevice tablet)(parallel none)(serial pty)(device_model
'/usr/lib/xen/bin/qemu-dm')))(device (vbd (dev 'hda:disk')(uname
'phy:/dev/vgvms/Linux2')(mode 'w')))(device (vif (mac
'd6:5f:df:05:45:bb')(bridge 'Bridge2')(script 'vif-bridge')))(device
(vkbd))(device (vfb (type vnc)(vncunused 1)(vnclisten '192.168.1.226')
DEBUG: libvirt.c: virDomainLookupByName (conn=0x92ae478, name=Linux2)
DEBUG: hash.c: __virGetDomain (New hash entry 0x92bd1e0)
DEBUG: libvirt.c: virDomainCreate (domain=0x92bd1e0)
DEBUG: libvirt.c: virDomainSuspend (domain=0x92bd1e0)
virDomainSuspend() failed: 0





> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 19, 2008 2:21 PM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] pausing / unpausing guests with libvirt
> 
> On Fri, Sep 19, 2008 at 09:23:52AM -0400, Matthew Donovan wrote:
> > I'm working on a management application that will control 
> Xen guest vms
> > (HVMs) with libvirt Java bindings.  I want to be able to 
> pause and unpause
> > the VMs but doing so through the libvirt functions does not 
> seem to actually
> > pause the VM.  The suspend function returns true and 
> doesn't throw any
> > exceptions, however, the guest VM is still running and responsive.
> > 
> > Any pointers are greatly appreciated.
> 
> Is it possible you could isolate whether the problem is with libvirt
> or with the Java bindings?  One way would be to shell out to 'virsh'
> just to see if virsh fails to change the state (ie. a libvirt/C) or if
> the problem is in the Java bindings.
> 
> Pausing/resuming Xen domains is a very common and well-tested
> operation so I would be surprised if it's a libvirt problem, but you
> never know ...
> 
> Rich.
> 
> 
> -- 
> Richard Jones, Emerging Technologies, Red Hat  
> http://et.redhat.com/~rjones
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://et.redhat.com/~rjones/virt-df/
> 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] pausing / unpausing guests with libvirt

2008-09-19 Thread Matthew Donovan
I'm working on a management application that will control Xen guest vms
(HVMs) with libvirt Java bindings.  I want to be able to pause and unpause
the VMs but doing so through the libvirt functions does not seem to actually
pause the VM.  The suspend function returns true and doesn't throw any
exceptions, however, the guest VM is still running and responsive.

Any pointers are greatly appreciated.

Thanks
-matthew

I'm using:

libvirt 0.4.5 
libvirt-java 0.2.1 
Xen 3.1.2

The guest I'm working with is a Fedora Core 6 HVM (though I'd like it to
work with any guest.)
The host is Fedora Core 8.

Code to define and create the domain:

   try {
con = new Connect ("xen:///");
String xml = buildXMLConfig(config);// config is a
string of XML shown below
domain = con.domainDefineXML(xml);
domain.create ();

} catch (LibvirtException ex) {
logger.error ("Error starting VM", ex);
return false;
}


Code to pause the VM:

public boolean pause() throws RemoteException {
logger.info ("Pause operation in progress.  domain = "+domain);
if (domain == null)
return false;

try {
synchronized (domain) {
domain.suspend ();  // using suspend() because there is
no pause() function.
}

} catch (LibvirtException ex) {
logger.error ("Could not suspend "+vm.getName(), ex);
return false;
}
raiseComponentChangeEvent(new
ComponentStateChangeEvent(State.PAUSED));
return true;
}

(The synchronized() statement is because I was running a second thread
watching the state of the VM and I thought maybe that might be contributing
to the problem.  The VM is still not paused when there is only one thread
running.)


XML for the domain:


Linux2

hvm
/usr/lib/xen/boot/hvmloader


50
1
shutdown
restart
restart






/usr/lib/xen/bin/qemu-dm














--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] DISREGARD Problems starting XEN HVM with libvirt

2008-08-26 Thread Matthew Donovan
It turns out everything was booting, they just weren't configured to give a
console or display a GUI window.

-matthew 

> -Original Message-
> From: Matthew Donovan [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 26, 2008 9:25 AM
> To: libvir-list@redhat.com
> Subject: [libvirt] Problems starting XEN HVM with libvirt
> 
> I've been having trouble getting a Xen HVM guest started 
> using libvirt.
> I've tried Windows Vista, Fedora Core 8, and Fedora Core 6 
> guests.  Domain 0
> is FC 8.  The only guest that starts correctly is the FC 6 guest.  Has
> anyone else encountered something like this?  Is there a 
> master list of
> guest OS's that libvirt supports?
> 
> Thanks
> -matthew
> 
> 
> CODE:
> 
> #include 
> #include 
> #include 
> 
> 
> const char* foo = 
> ""
> "fc6"
> ""
> "hvm"
> "/usr/lib/xen/boot/hvmloader"
> ""
> ""
> "512000"
> "1"
> "shutdown"
> "restart"
> "restart"
> ""
> ""
> ""
> ""
> ""
> ""
> ""
>   "/usr/lib/xen/bin/qemu-dm"
>   ""
>   ""
>   ""
>   ""
> ""
> ""
> ""
> ""
> ""
> ""
> ""
> "";
> 
> 
> int main (int argc, char** argv) 
> {
> virConnectPtr con;  /* connection to the Xen hypervisor */
> virDomainPtr  domain;
> 
> virInitialize();
> 
> con = virConnectOpen ("xen:///");
> if (!con) {
> virErrorPtr err = virGetLastError ();
> printf ("virConnectOpen failed: %s\n",
> err->message);
> return -1;
> }
> 
> domain = virDomainDefineXML (con, foo);
> if (!domain) {
> virErrorPtr err = virConnGetLastError (con);
> printf ("virDomainDefineXML failed: %s\n",
> err->message);
> 
> } else {
> 
> if (virDomainCreate (domain) < 0) {
> virErrorPtr err = virConnGetLastError (con);
> printf ("virDomainCreate failed: %s\n",
> err->message);
> } else {
> virDomainInfo info = {0};
> virDomainGetInfo (domain, &info);
> printf ("state = %d\n", info.state);
> getchar ();
> }
> }
> 
> virConnectClose (con);
> return 0;
> }
> 
> --
> Libvir-list mailing list
> Libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Problems starting XEN HVM with libvirt

2008-08-26 Thread Matthew Donovan
I've been having trouble getting a Xen HVM guest started using libvirt.
I've tried Windows Vista, Fedora Core 8, and Fedora Core 6 guests.  Domain 0
is FC 8.  The only guest that starts correctly is the FC 6 guest.  Has
anyone else encountered something like this?  Is there a master list of
guest OS's that libvirt supports?

Thanks
-matthew


CODE:

#include 
#include 
#include 


const char* foo = 
""
"fc6"
""
"hvm"
"/usr/lib/xen/boot/hvmloader"
""
""
"512000"
"1"
"shutdown"
"restart"
"restart"
""
""
""
""
""
""
""
"/usr/lib/xen/bin/qemu-dm"
""
""
""
""
""
""
""
""
""
""
""
"";


int main (int argc, char** argv) 
{
virConnectPtr con;  /* connection to the Xen hypervisor */
virDomainPtr  domain;

virInitialize();

con = virConnectOpen ("xen:///");
if (!con) {
virErrorPtr err = virGetLastError ();
printf ("virConnectOpen failed: %s\n",
err->message);
return -1;
}

domain = virDomainDefineXML (con, foo);
if (!domain) {
virErrorPtr err = virConnGetLastError (con);
printf ("virDomainDefineXML failed: %s\n",
err->message);

} else {

if (virDomainCreate (domain) < 0) {
virErrorPtr err = virConnGetLastError (con);
printf ("virDomainCreate failed: %s\n",
err->message);
} else {
virDomainInfo info = {0};
virDomainGetInfo (domain, &info);
printf ("state = %d\n", info.state);
getchar ();
}
}

virConnectClose (con);
return 0;
}

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] Using Xen config files

2008-08-22 Thread Matthew Donovan
 Xen and Xen-devel are 3.1.2.

I'm using version 0.4.4 of libvirt.

-matthew

> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 22, 2008 4:19 AM
> To: Matthew Donovan
> Cc: Daniel P. Berrange; libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Thu, Aug 21, 2008 at 02:16:55PM -0400, Matthew Donovan wrote:
> > I'm still having problems with this.  I've dug around and 
> found errors in
> > the qemu-dm log.
> > 
> > When I try to start the VM with libvirt, the error I'm getting is:
> > 
> "xs_read(/vm/414e73de-cf1e-487c-87e0-d4ebf7a23576/rtc/timeoffs
> et): read
> > error"
> > 
> > I did a xenstore-ls on the /vm/414e73de-cf1e-487c-87e0-d4ebf7a23576
> > directory and sure enough, rtc/timeoffset is not there.  
> When I start the VM
> > with the Xen config file I used to generate the XML the 
> rtc/timeoffset is
> > there (timeoffset is set to "0").
> 
> Which version of xen, xen-devel, etc?
> 
> Rich.
> 
> -- 
> Richard Jones, Emerging Technologies, Red Hat  
> http://et.redhat.com/~rjones
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://et.redhat.com/~rjones/virt-df/
> 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] Using Xen config files

2008-08-21 Thread Matthew Donovan
I'm still having problems with this.  I've dug around and found errors in
the qemu-dm log.

When I try to start the VM with libvirt, the error I'm getting is:
"xs_read(/vm/414e73de-cf1e-487c-87e0-d4ebf7a23576/rtc/timeoffset): read
error"

I did a xenstore-ls on the /vm/414e73de-cf1e-487c-87e0-d4ebf7a23576
directory and sure enough, rtc/timeoffset is not there.  When I start the VM
with the Xen config file I used to generate the XML the rtc/timeoffset is
there (timeoffset is set to "0").

Is there a way to set that in the XML?  I didn't see it in the online XML
description.

I'm using a slightly different XML description than I had originally so I've
included here (along with the Xen Config file)

Thanks!
-matthew

const char* foo = 
""
"LinuxVM"
"414e73de-cf1e-487c-87e0-d4ebf7a23576"
""
"hvm"
"/usr/lib/xen/boot/hvmloader"
""
""
"512000"
"1"
"shutdown"
"restart"
"restart"
""
""
""
""
""
""
""
"/usr/lib/xen/bin/qemu-dm"
""
""
""
""
""
""
""
""
""
""
""
"";
//serial = "pty" 


int main (int argc, char** argv) 
{
virConnectPtr con;  /* connection to the Xen hypervisor */
virDomainPtr  domain;

virInitialize();

con = virConnectOpen ("xen:///");
if (!con) {
virErrorPtr err = virGetLastError ();
printf ("virConnectOpen failed: %s\n",
err->message);
return -1;
}

domain = virDomainDefineXML (con, foo);
if (!domain) {
virErrorPtr err = virConnGetLastError (con);
printf ("virDomainDefineXML failed: %s\n",
err->message);

} else {

if (virDomainCreate (domain) < 0) {
virErrorPtr err = virConnGetLastError (con);
printf ("virDomainCreate failed: %s\n",
err->message);
} else {
virDomainInfo info = {0};
virDomainGetInfo (domain, &info);
printf ("state = %d\n", info.state);
getchar ();
}
}

virConnectClose (con);
return 0;
}

# Automatically generated xen config file
name = "LinuxVM"
builder = "hvm"
memory = "500"
disk = [ 'phy:/dev/vgvms/LinuxVM,hda,w', ]
vif = [ 'type=ioemu, mac=7A:AB:D0:01:82:98', ]
uuid = "414e73de-cf1e-487c-87e0-d4ebf7a23576"
device_model = "/usr/lib/xen/bin/qemu-dm"
kernel = "/usr/lib/xen/boot/hvmloader"
vnc=1 

vnc=0
sdl=1
stdvga=0

boot="cda"

usbdevice="tablet"

vncunused=1
apic=1
acpi=1
pae=1

vcpus=1
serial = "pty" 
on_reboot   = 'restart'
on_crash= 'restart'





> -Original Message-
> From: Daniel P. Berrange [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 20, 2008 1:05 PM
> To: Richard W.M. Jones
> Cc: Matthew Donovan; libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Wed, Aug 20, 2008 at 04:44:04PM +0100, Richard W.M. Jones wrote:
> > On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> > 
> > It certainly looks OK, and it seems like the domain should run after
> > virDomainCreate.  Have you tried adding a delay of 30 
> seconds just to
> > check if the domain is starting up slowly?
> 
> Yep, that debug suggests the libvirt part of creation has 
> completed OK.
> I think if anything is going wrong, its going to be in XenD's 
> arena. I'd
> recommend looking in /var/log/xen for any further hints of trouble
> 
> Daniel
> -- 
> |: Red Hat, Engineering, London   -o-   
> http://people.redhat.com/berrange/ :|
> |: http://libvirt.org  -o-  http://virt-manager.org  -o-  
> http://ovirt.org :|
> |: http://autobuild.org   -o- 
> http://search.cpan.org/~danberr/ :|
> |: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF 
> F742 7D3B 9505 :|
> 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


RE: [libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
Found it!  I added serial and console devices to the XML and it appears to
be running.  It's not working completely as expcted but it's doing more than
it was.

Thanks for your help.
-matthew

> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 20, 2008 11:44 AM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> > Thanks for the quick reply!
> > 
> > I set the LIBVIRT_DEBUG flag to 1 and ran it again.  (The 
> output is below.)
> [...]
> > [EMAIL PROTECTED] ~]$ gcc -g virt_test.c -lvirt && ./a.out
> > DEBUG: libvirt.c: virInitialize (register drivers)
> > DEBUG: xen_internal.c: xenHypervisorInit (Using new 
> hypervisor call: 30001
> > )
> > DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor 
> call v2, sys ver3
> > dom ver5
> > )
> > DEBUG: libvirt.c: virConnectOpen (name=xen:///)
> > DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
> >   scheme xen
> >   opaque (null)
> >   authority (null)
> >   server (null)
> >   user (null)
> >   port 0
> >   path /
> > )
> > DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
> > DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
> > DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor 
> sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
> > DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
> > DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
> > DEBUG: remote_internal.c: doRemoteOpen (proceeding with 
> name = xen:///)
> > DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 1 storage 
> returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml= > 
> type='xen'>fc8.confhvm/u
> sr/lib/xen/boo
> > t/hvmloader > 
> dev='hd'/>10241 >destroy > 
> oweroff>restartrestart ash>
> >  > 
> sync="localtime"/>/usr/lib/xen/bin/qemu-dm<
> /emulator> > erface type='bridge'>

RE: [libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
Thanks for the quick reply!

I set the LIBVIRT_DEBUG flag to 1 and ran it again.  (The output is below.)


One other thing I can think to mention is that I'm using version 0.4.4-2,
installed with yum.  Maybe I should try compiling and installing from
source?

Thanks again!
-matthew

[EMAIL PROTECTED] ~]$ gcc -g virt_test.c -lvirt && ./a.out
DEBUG: libvirt.c: virInitialize (register drivers)
DEBUG: xen_internal.c: xenHypervisorInit (Using new hypervisor call: 30001
)
DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor call v2, sys ver3
dom ver5
)
DEBUG: libvirt.c: virConnectOpen (name=xen:///)
DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
  scheme xen
  opaque (null)
  authority (null)
  server (null)
  user (null)
  port 0
  path /
)
DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = xen:///)
DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 1 storage returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml=fc8.confhvm/usr/lib/xen/boo
t/hvmloader10241destroyrestartrestart
/usr/lib/xen/bin/qemu-dm)
DEBUG: libvirt.c: virDomainLookupByName (conn=0x96fe478, name=fc8.conf)
DEBUG: hash.c: __virGetDomain (New hash entry 0x9702a18)
DEBUG: libvirt.c: virDomainCreate (domain=0x9702a18)
DEBUG: libvirt.c: virDomainGetInfo (domain=0x9702a18, info=0xbfa2b658)
state = 0
DEBUG: libvirt.c: virConnectClose (conn=0x96fe478)
DEBUG: hash.c: virUnrefConnect (unref connection 0x96fe478 xen:/// 2)


> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 20, 2008 9:49 AM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Wed, Aug 20, 2008 at 08:35:46AM -0400, Matthew Donovan wrote:
> > I am trying to programmatically start Xen guest VMs (HVM) 
> with libvirt (on
> > Fedora Core 8) and I'm having some trouble with it. I've 
> included my code
> > below.  Essentially, the domain seems to get created 
> correctly but it
> > doesn't seem to run.
> >
> > I don't receive any error messages from the libvirt
> > functions but the VM does not get any CPU time (as shown 
> with "xm list").  
> > 
> > [EMAIL PROTECTED] ~]$ xm list
> > NameID   Mem VCPUs  
> State
> > Time(s)
> > Domain-0 0  1462 2  
>r-
> > 1313.5
> > fc8.conf 7   128 1  
>--
> > 0.0
> > 
> > Can someone explain what I'm doing wrong here?  I've tried 
> to get this
> > working with linux and windows guests with the same results.
> 
> That's really strange.  Your program looks correct to me (but see my
> comment about error handling below).  One thing you can do is to run
> your program after first setting the environment variable
> LIBVIRT_DEBUG=1 which will cause all calls to libvirt to be printed
> out.  Just to make sure you are actually calling the functions that
> you think you are calling.
> 
> > I've seen references on this mailing list to libvirt's 
> ability to handle Xen
> > configuration files but I haven't seen anything in the API 
> documentation or
> > public header files that refer to it.  Is there a public 
> interface to
> > specifying a configuration file?
> 
> No there isn't.  This ability refers to old versions of Xen which used
> /etc/xen.  We have a driver that can parse files from here and present
> those as inactive ("defined" but not running) domains, eg.  when you
> do "virsh list".
> 
> For all other uses, use the libvirt XML configuration format.  The
> advantage

[libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
I am trying to programmatically start Xen guest VMs (HVM) with libvirt (on
Fedora Core 8) and I'm having some trouble with it. I've included my code
below.  Essentially, the domain seems to get created correctly but it
doesn't seem to run.  I don't receive any error messages from the libvirt
functions but the VM does not get any CPU time (as shown with "xm list").  

[EMAIL PROTECTED] ~]$ xm list
NameID   Mem VCPUs  State
Time(s)
Domain-0 0  1462 2 r-
1313.5
fc8.conf 7   128 1 --
0.0

Can someone explain what I'm doing wrong here?  I've tried to get this
working with linux and windows guests with the same results.

I've seen references on this mailing list to libvirt's ability to handle Xen
configuration files but I haven't seen anything in the API documentation or
public header files that refer to it.  Is there a public interface to
specifying a configuration file?

Thanks 
-matthew


CODE:
#include 
#include 
#include 

  //""
//""

const char* fedora = 
""
"fc8.conf"
""
"hvm"
"/usr/lib/xen/boot/hvmloader"
""
""
"1024"
"1"
"destroy"
"restart"
"restart"
""
""
""
""
""
""
""
"/usr/lib/xen/bin/qemu-dm"
""
 ""
  ""
""
""
  ""
  ""
""
""
  ""
  ""
  ""
""
""
  ""
"";


int main (int argc, char** argv) 
{
virConnectPtr con;  /* connection to the Xen hypervisor */
virDomainPtr  domain;

virInitialize();
con = virConnectOpen ("xen:///");
if (!con) {
virErrorPtr err = virGetLastError ();
printf ("virConnectOpen failed: %s\n",
err->message);
return -1;
}

domain = virDomainDefineXML (con, fedora);
if (!domain) {
virErrorPtr err = virGetLastError ();
printf ("virDomainDefineXML failed: %s\n",
err->message);

} else {

if (virDomainCreate (domain) < 0) {
virErrorPtr err = virGetLastError ();
printf ("virDomainCreate failed: %s\n",
err->message);
} else {
virDomainInfo info = {0};
virDomainGetInfo (domain, &info);
printf ("state = %d\n", info.state);
}
}

virConnectClose (con);
return 0;
}

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list