Re: [libvirt] How to start a defined domain

nope. "vm01" can be seen after I started it using "xm create vm01". But, if I shut it down using "xm shutdown vm01", it can't be seen using "virsh list --all" I assume that, "vm01" only have a xm config file stored in /etc/xen/, and libvirt or virsh need a XML style config file. So I can't start vm01 using "virsh start vm01" nor can I see it using "virsh list --all". Is it like this? Do correct me if I'm wrong :-) 2010-10-27 黄亮 发件人: Osier 发送时间: 2010-10-27 10:56:54 收件人: 黄亮 抄送: 主题: Re: [libvirt] How to start a defined domain ----- "黄亮" <lancerhuang@163.com> wrote:
Oh, yeah, you're right, it's "make uninstall" :-)
after uninstall 0.8.4 and reinstall 0.6.3, it still won't work.
but one thing I should mention is that while using "virsh start vm01", it reports the same error, saying can't find domain "vm01" with "xenUnifiedDomainLookupByName ". So I think maybe there is something I'm missing in define a domain.
Would you give me some hints so I can see where I go wrong? Really appreciated
ah, well, so let us check lower, can you see the guest "vm01" by "virsh list --all"? - Osier
2010-10-27
黄亮
发件人: Osier 发送时间: 2010-10-26 22:29:40 收件人: 黄亮 抄送: libvir-list 主题: Re: [libvirt] How to start a defined domain
----- "黄亮" <lancerhuang@163.com> wrote:
Well, after "make clean", I run the compiled start.c, still won't work.
"make clean" won't uninstall the installed stuffs, use "make uninstall" instead, or you just made a typo? :-)
after that, suggest re-installing 0.6.3 if you are not sure if it's injured.
- Osier
And I forget to metion, an error msg is shown:
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
is that means I missed something?
2010-10-26
黄亮
发件人: Osier 发送时间: 2010-10-26 18:05:46 收件人: 黄亮 抄送: 主题: Re: [libvirt] How to start a defined domain
----- "黄亮" <lancerhuang@163.com> wrote:
Accroding to your case, it seems I have no need to upgrade libvirt to 0.8.4 Will that work if I erase 0.8.4 using "make clean" and draw back to 0.6.3 ?
yep, think so, if you don't need the new features, and 0.6.3 is enough for your project requirement.. :-)
- Osier
2010-10-26
黄亮
发件人: Osier 发送时间: 2010-10-26 17:10:40 收件人: 黄亮 抄送: 主题: Re: [libvirt] How to start a defined domain
----- "黄亮" <lancerhuang@163.com> wrote:
Thanks for your reply, Osier.
The distro I'm using is CentOS release 5.5 (Final)
I'm not quite sure about the version of libvirt. At first, it
to
be 0.6.3, because /usr/lib64/libvirt.so.0 points to /usr/lib64/libvirt.so.0.6.3 Then I downloaded the src of libvirt_0.8.4 from offical website, and configure, make, make install. But now it show errors when I type "virsh". The error message
seems lies
below:
virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.8.2' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.1' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.5' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.8.1' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.0' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.2' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.3' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.8.0' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_PRIVATE_0.8.4' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.7.7' not found (required by virsh) virsh: /usr/local/lib/libvirt.so.0: version `LIBVIRT_0.6.4' not found (required by virsh)
probly you should try to erase the 0.6.3, then compile and install libvirt like:
# ./configure --prefix=/usr --libdir=/usr/lib64 # make # make install
your test program has no problem on my box. the libvirt on my box also is 0.6.3.
Regards
- Osier
As for xen, it is 3.3.2. The full "xm info" message is listed
below:
host : testbed01 release : 2.6.18-194.11.4.el5xen version : #1 SMP Tue Sep 21 05:40:24 EDT 2010 machine : x86_64 nr_cpus : 8 nr_nodes : 1 cores_per_socket : 4 threads_per_core : 2 cpu_mhz : 2793 hw_caps :
bfebfbff:28100800:00000000:00000140:0098e3fd:00000000:00000001:00000000
virt_caps : hvm total_memory : 4055 free_memory : 533 node_to_cpu : node0:0-7 node_to_memory : node0:533 xen_major : 3 xen_minor : 3 xen_extra : .2 xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 xen_scheduler : credit xen_pagesize : 4096 platform_params : virt_start=0xffff800000000000 xen_changeset : unavailable cc_compiler : gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) cc_compile_by : root cc_compile_domain : gitco.tld cc_compile_date : Tue Aug 18 21:07:28 CEST 2009 xend_config_format : 4
I've write a simple c program to test the api, and it is listed below:
1 // This program aims to test the api which can start the VM 2 3 #include "stdio.h" 4 #include "stdlib.h" 5 #include "libvirt/libvirt.h" 6 7 int main(int argc ,char* argv[]) 8 { 9 virConnectPtr conn; 10 conn = virConnectOpen( "xen+tcp://localhost?no_Verify=1" ); 11 if( conn == NULL ) 12 { 13 printf( "Failed to Connect\n" ); 14 return 1; 15 } 16 const char* host = "vm01"; 17 virDomainPtr dom; 18 dom = virDomainLookupByName( conn, host ); 19 if( dom == NULL ) 20 { 21 printf( "can't find dom\n" ); 22 return 1; 23 } 24 // else 25 // { 26 // virDomainFree( dom ); 27 // virConnectClose( conn ); 28 // printf("done\n"); 29 // return 0; 30 // } 31 if( virDomainCreate( dom ) == -1 ) 32 { 33 printf( "failed to Start\n" ); 34 virDomainFree( dom ); 35 virConnectClose( conn ); 36 return 1; 37 } 38 else 39 { 40 printf( "Started\n" ); 41 virDomainFree( dom ); 42 virConnectClose( conn ); 43 return 0; 44 } 45 }
2010-10-26
Lancer
发件人: Osier 发送时间: 2010-10-26 11:35:31 收件人: 黄亮 抄送: libvir-list 主题: Re: [libvirt] How to start a defined domain
----- "黄亮" <lancerhuang@163.com> wrote:
I've create a domain called "vm01" using Virt-Manager, the GUI tool. Now I wanna use libvirt api to control the life cycle of vm01. It went on well with shutdown and reboot, but how to start it became a problem.
I was intended to get the virDomainPtr by using virDomainLookupByName api, and then start it using virDomainCreate api. But it turns out that virDomainLookupByName api cannot return a virDomainPtr for a defined but not running domain.
no, it can :-)
If it really doesn't work for you, could you write a simple program to reproduce it? and try to explain what's the version of libvirt you use, on which distro, etc, any helpful info is welcomed. :-)
Thanks
- Osier
That's my situation, what do you suggest I do now? Thanks in advance.
2010-10-26
Lancer -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
__________ Information from ESET Smart Security, version of virus signature database 5562 (20101025) __________
The message was checked by ESET Smart Security.
__________ Information from ESET Smart Security, version of virus signature database 5562 (20101025) __________
The message was checked by ESET Smart Security.
__________ Information from ESET Smart Security, version of virus signature database 5563 (20101026) __________
The message was checked by ESET Smart Security.
__________ Information from ESET Smart Security, version of virus signature database 5565 (20101026) __________
The message was checked by ESET Smart Security.
__________ Information from ESET Smart Security, version of virus signature database 5566 (20101027) __________ The message was checked by ESET Smart Security. http://www.eset.com
participants (1)
-
黄亮