[libvirt] libvirt question
Hello,I wrote a program using libvirt API to get vm information like this: /*dom is virDomainPtr type*/ dom=virDomainLookupByID(conn,activeDomains[i]); if(dom!=NULL) printf("%d--%s\n",activeDomains[i],dom->name); .. but when compile it,error occured like this: vm_eraser_detect.c:125:54: error: dereferencing pointer to incomplete type printf("%d--%s\n",activeDomains[i],dom->name); what is the reason of it??? thanka a lot! zhun...@gmail.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt question
Thanks a lot! zhun...@gmail.com From: Martin Kletzander Date: 2017-05-19 14:16 To: zhun...@gmail.com CC: libvir-list Subject: Re: [libvirt] libvirt question On Fri, May 19, 2017 at 10:52:32AM +0800, zhun...@gmail.com wrote: >Hello,I wrote a program using libvirt API to get vm information like this: >/*dom is virDomainPtr type*/ >dom=virDomainLookupByID(conn,activeDomains[i]); >if(dom!=NULL) >printf("%d--%s\n",activeDomains[i],dom->name); >.. >but when compile it,error occured like this: >vm_eraser_detect.c:125:54: error: dereferencing pointer to incomplete type >printf("%d--%s\n",activeDomains[i],dom->name); >what is the reason of it??? >thanka a lot! > TL;DR s/dom->name/virDomainGetName(dom)/ Explanation: Where did you get the idea that virDomainPtr has a name in it? Is that in some of our documentation? Even if you saw it in the sources, the compiler has no way of knowing that because you haven't included that structure definition anywhere. That's because we don't expose it in any public header files. That way we can change it at any point in the future. And for callers to access it, we just expose a function to get the name. > >zhun...@gmail.com >-- >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] libvirt-question
Hello,does libvirt provides API to get qemu process ID by vm ID or name??or is there any methods to do this?? thanks!! zhun...@gmail.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt-question
thanks a lot! zhun...@gmail.com From: Erik Skultety Date: 2017-05-23 15:09 To: zhun...@gmail.com CC: libvir-list Subject: Re: [libvirt] libvirt-question On Tue, May 23, 2017 at 10:29:14AM +0800, zhun...@gmail.com wrote: > Hello,does libvirt provides API to get qemu process ID by vm ID or name??or > is there any methods to do this?? > thanks!! No, libvirt doesn't provide such API. Depends on what you really want to do. Libvirt uses domain objects to identify a domain and that's all you need to operate on domains. If you want to operate on the process level, for whatever administration reasons, that's out of libvirt's scope. Erik > > > > zhun...@gmail.com > -- > 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] How libvirt address qemu command line args
Now I want to add some args about TPM to domain's XML,so I can start a domain by virt-manager or other virsh command,and then ,I would like to use sVIrt security context to label vTPM and correspondingVM,But I do not know how to get these XML args in libvirt. the key problem is that how can i get and recognize these args!!! related XML content : zhun...@gmail.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] 转发: Re: How libvirt address qemu command line args
zhun...@gmail.com 发件人: zhun...@gmail.com 发送时间: 2016-10-23 17:42 收件人: berrange 主题: Re: Re: [libvirt] How libvirt address qemu command line args Thanks,However,I have to use this method.Now I wander how get the VM xml contents in Libvirt source code,I try output some message in qemuProcessStart function like this ,but I get nothing,anyone can help me?? thanks! my code is : in qemuStartProcess function char *str=qemuDomainDefFormatXML(driver, vm->def, 0); FILE *op=fopen("/root/libvirt.log","a"); if(op!=NULL){ if(str!=NULL) fprintf(op,"strcmd : %s\n",str); else fprintf(op,"str is null\n"); fclose(op); }else{ fprintf(op,"open file error!\n"); } zhun...@gmail.com From: Daniel P. Berrange Date: 2016-10-19 15:35 To: Michal Privoznik CC: zhun...@gmail.com; libvir-list Subject: Re: [libvirt] How libvirt address qemu command line args On Wed, Oct 19, 2016 at 10:17:21AM +0800, Michal Privoznik wrote: > On 18.10.2016 14:59, zhun...@gmail.com wrote: > > Now I want to add some args about TPM to domain's XML,so I can start a > > domain by virt-manager or other virsh command,and then ,I would like to use > > sVIrt security context to label vTPM and correspondingVM,But I do not know > > how to get these XML args in libvirt. > > the key problem is that how can i get and recognize these args!!! > > related XML content : > > Usually, grepping the code for cmd name <-> XML element/attribute > translation is sufficient (esp. if you grep tests/) > > > > > > > > > Firstly, this is obsolete in favour of "-machine accel=kvm". In any > case, will do the trick (libvirt will use whatever > is supported by qemu binary in your system). > > > > > > value='file=/root/nvram_2.0-jin.qcow2,if=none,id=nvram0-0-0,format=qcow2'/> > > Okay, this is not supported by libvirt yet. We don't really have a way > how to specify NVRAM in anything other than a raw file. BTW: isn't qcow > too big gun for NVRAM? I mean, NVRAM has a fixed size of what ~190 KB? > QCOW header is about the same size. > > > > > > > > > > > I'm not sure there's a way how to put startup=clean on the cmd line. I'm > not even sure what it does. > And I have not idea what libtpms is either :-) > > > > > > > > > On top of all that - QEMU is likely to fail to start since libvirt by default runs it as qemu:qemu user/group, and so it won't have permission to read any of the files in /root. If you have selinux/apparmour that will also block permission. This is an example of why usage of qemu:commandline is discouraged - it will always have problems with permissions if you pass files using it. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o-http://search.cpan.org/~danberr/ :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] how to install and remove Libvirt cleanly
I just want to know how to uninstall Libvirt which installed by source code cleanly.because I found make uninstall can not remove all the installed file.so that I install it later failed. zhun...@gmail.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] libvirt label qemu process problem
I found that when using souce code to install libvirt,it labeled qemu process with label "unconfined_u:unconfined_r:svirt_t:s0:c53,c366" instead of "system_u:system_r:svirt_t:s0:c53,c366",is this a bug??can anyone explain it ?? thanks! zhun...@gmail.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list