[libvirt] Re: kexec/kdump of a kvm guest?
On Thu, Jul 24, 2008 at 03:03:33PM -0400, Mike Snitzer wrote: On Thu, Jul 24, 2008 at 9:15 AM, Vivek Goyal [EMAIL PROTECTED] wrote: On Thu, Jul 24, 2008 at 07:49:59AM -0400, Mike Snitzer wrote: On Thu, Jul 24, 2008 at 4:39 AM, Alexander Graf [EMAIL PROTECTED] wrote: As you're stating that the host kernel breaks with kvm modules loaded, maybe someone there could give a hint. OK, I can try using a newer kernel on the host too (e.g. 2.6.25.x) to see how kexec/kdump of the host fairs when kvm modules are loaded. On the guest side of things, as I mentioned in my original post, kexec/kdump wouldn't work within a 2.6.22.19 guest with the host running 2.6.25.4 (with kvm-70). Hi Mike, I have never tried kexec/kdump inside a kvm guest. So I don't know if historically they have been working or not. Avi indicated he seems to remember that at least kexec worked last he tried (didn't provide when/what he tried though). Having said that, Why do we need kdump to work inside the guest? In this case qemu should be knowing about the memory of guest kernel and should be able to capture a kernel crash dump? I am not sure if qemu already does that. If not, then probably we should think about it? To me, kdump is a good solution for baremetal but not for virtualized environment where we already have another piece of software running which can do the job for us. We will end up wasting memory in every instance of guest (memory reserved for kdump kernel in every guest). I haven't looked into what mechanics qemu provides for collecting the entire guest memory image; I'll dig deeper at some point. It seems the libvirt mid-layer (virsh dump - dump the core of a domain to a file for analysis) doesn't support saving a kvm guest core: # virsh dump guest10 guest10.dump libvir: error : this function is not supported by the hypervisor: virDomainCoreDump error: Failed to core dump domain guest10 to guest10.dump Seems that libvirt functionality isn't available yet with kvm (I'm using libvirt 0.4.2, I'll give libvirt 0.4.4 a try). cc'ing the libvirt-list to get their insight. That aside, having the crash dump collection be multi-phased really isn't workable (that is if it requires a crashed guest to be manually saved after the fact). The host system _could_ be rebooted; whereby losing the guest's core image. So automating qemu and/or libvirtd to trigger a dump would seem worthwhile (maybe its already done?). That's a good point. Ideally, one would like dump to be captured automatically if kernel crashes and then reboot back to production kernel. I am not sure what can we do to let qemu know after crash so that it can automatically save dump. What happens in the case of xen guests. Is dump automatically captured or one has to force the dump capture externally. So while I agree with you its ideal to not have to waste memory in each guest for the purposes of kdump; if users want to model a guest image as closely as possible to what will be deployed on bare metal it really would be ideal to support a 1:1 functional equivalent with kvm. Agreed. Making kdump work inside kvm guest does not harm. I work with people who refuse to use kvm because of the lack of kexec/kdump support. Interesting. I can do further research but welcome others' insight: do others have advice on how best to collect a crashed kvm guest's core? It will be interesting to look at your results with 2.6.25.x kernels with kvm module inserted. Currently I can't think what can possibly be wrong. If the host's 2.6.25.4 kernel has both the kvm and kvm-intel modules loaded kexec/kdump does _not_ work (simply hangs the system). If I only have the kvm module loaded kexec/kdump works as expected (likewise if no kvm modules are loaded at all). So it would appear that kvm-intel and kexec are definitely mutually exclusive at the moment (at least on both 2.6.22.x and 2.6.25.x). Ok. So first task is to fix host kexec/kdump with kvm-intel module inserted. Can you do little debugging to find out where system hangs. I generally try few things for kexec related issue debugging. 1. Specify earlyprintk= parameter for second kernel and see if control is reaching to second kernel. 2. Otherwise specify --console-serial parameter on kexec -l commandline and it should display a message I am in purgatory on serial console. This will just mean that control has reached at least till purgatory. 3. If that also does not work, then most likely first kernel itself got stuck somewhere and we need to put some printks in first kernel to find out what's wrong. Thanks Vivek -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] fix Relax-NG pattern matching
On Thu, Jul 24, 2008 at 05:40:33PM +0100, John Levon wrote: Don't use unescaped meta-characters. Signed-off-by: John Levon [EMAIL PROTECTED] Hum, right :-) Applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages
On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote: Hi, qemu_driver misses some conversions to a char* before printing the uuid. Possible fix attached. ACK, surprised that the printf() format checks don't complain about passing an unsigned char to a %s format in GCC. This is actually one of the things ICC flagged when i tried it, but I never fixed it 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] [PATCH]: libvirt.h: very xen centric
On Thu, Jul 24, 2008 at 03:50:32PM -0400, Guido G?nther wrote: Hi, while reading through that I noticed libvirt.h is quiet xen centric. Purely cosmetic patch attached, ACK 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] [PATCH] qemudOpenMonitor: fix open(2) error check
On Thu, Jul 24, 2008 at 03:48:47PM -0400, Guido G?nther wrote: Hi, open returns -1 on failure. Pointed out by Guido Trotter on: Opps, very embarrassing bug :-) ACK 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] [PATCH] qemudOpenMonitor: fix open(2) error check
On Thu, Jul 24, 2008 at 03:48:47PM -0400, Guido Günther wrote: Hi, open returns -1 on failure. Pointed out by Guido Trotter on: http://bugs.debian.org/492250 Patch against current CVS attached. Hum, good catch, I checked for other occurences of this mistake but everywhere else we use 0 or == -1 to detect the failure. Applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: libvirt.h: very xen centric
On Thu, Jul 24, 2008 at 03:50:32PM -0400, Guido Günther wrote: Hi, while reading through that I noticed libvirt.h is quiet xen centric. Purely cosmetic patch attached, -- Guido Good catch, remains from the very early days, blame me :-) Note that libvirt.h is generated so the patch really need to apply to libvirt.h.in, I fixed the documentation generation which got broken, and rebuilt the docs, all commited ! thanks a lot, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages
On Fri, Jul 25, 2008 at 09:29:43AM +0100, Daniel P. Berrange wrote: On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote: Hi, qemu_driver misses some conversions to a char* before printing the uuid. Possible fix attached. ACK, surprised that the printf() format checks don't complain about passing an unsigned char to a %s format in GCC. This is actually one of the things ICC flagged when i tried it, but I never fixed it Applied, i just had to add an include for uuid.h to avoid an undeclared function warning :-) thanks again Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Couple qemu driver bugs after xml refactoring
On Thu, Jul 24, 2008 at 09:39:36AM +0100, Daniel P. Berrange wrote: On Tue, Jul 22, 2008 at 05:23:00PM +0100, Daniel P. Berrange wrote: On Tue, Jul 22, 2008 at 04:53:19PM +0100, Daniel P. Berrange wrote: There was a good reason for removing the 127.0.0.1 from the XML parsing stage, but i can't remember what it is :-) Anyway this should really be handled at the point where we build the command line in the qemu driver code Oh I remember now - both Xen and QEMU have a global default setting for VNC listen (/etc/libvirt/qemu.conf and /etc/xen/xend-config.sxp). So, if we default to '127.0.0.1' in the parser, we'll always override the global hypervisor default setting. Hence we need to apply any defaults in the individual drivers at time of guest creation (if it is applicable). Here's a suggested patch for this: diff -r 59140de4e7a9 src/qemu_driver.c --- a/src/qemu_driver.c Mon Jul 21 18:27:29 2008 +0100 +++ b/src/qemu_driver.c Tue Jul 22 22:12:22 2008 +0100 @@ -769,9 +769,14 @@ maxcpu = nodeinfo.cpus; CPU_ZERO(mask); -for (i = 0 ; i maxcpu ; i++) -if (vm-def-cpumask[i]) +if (vm-def-cpumask) { +for (i = 0 ; i maxcpu ; i++) +if (vm-def-cpumask[i]) +CPU_SET(i, mask); +} else { +for (i = 0 ; i maxcpu ; i++) CPU_SET(i, mask); +} for (i = 0 ; i vm-nvcpupids ; i++) { if (sched_setaffinity(vm-vcpupids[i], NB, I explicitly set the affinity if none is specified - this makes sure the children don't inherit any bogus affinity from the libvirtd daemon itself I don't see how this relates to VNC listening parameters, but this still sounds a good idea :-) +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PATCH Remove unused openvz code
On Thu, Jul 24, 2008 at 11:48:42AM +0100, Daniel P. Berrange wrote: The openvz driver currrently generates a compile warning due to this unused function. If no one objects I'll shortly remove it. Sure fine ! I intend to turn on openvz and LXC driver compilation for the nightly builds to get more testing coverage yes good idea ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Problems when using libvirt-cim provider
Hi,all: I am trying to use libvirt API and libvirt-cim now. After installed them successfully, I can see the Virt_* providers using cimprovider -l -scommond. My cimom is pegasus. Then I used wbemcli as cim client. But when I used wbemcli ei to enumerate instances of a specified class,for example,Xen_DiskPool, error code was: wbemcli:Cim(1) CIM_ERR_FAILED: A general error occurred that is not covered by a more specific error code:For provider Virt_DevicePool the library name was empty. Check provider registered location. Could you please help me to solve this problem? Did it mean that the providers were not registered correctly? But I make postinstall the provider and no errors occourred. Thank you! Regards, Chun Shan Disclaimer: The contents of this e-mail, and its attachments, if any, are confidential and may be protected by law against any unauthorized use. If you have received this e-mail by mistake or have reason to believe that you are not the intended recipient, please notify the sender by reply e-mail as soon as possible and delete it from your computer system immediately thereafter. If you are not the intended recipient, you must not copy this e-mail or attachment or disclose the contents to any other person. While we have made every effort to keep our network virus free, we take no responsibility for any computer virus which might be transferred by way of this e-mail. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PATCH: 11/14: Change XM driver in-memory objects
On Thu, Jul 24, 2008 at 10:44:18AM -0400, Daniel Veillard wrote: On Tue, Jul 08, 2008 at 05:40:17PM +0100, Daniel P. Berrange wrote: This is a refactoring of the XM driver. Previously we would store the virConfPtr objects as our master 'in memory' representation of inactive domains. This switch it over to using virDomainDefPtr objects instead. The code for reading/writing the config files is unchanged at this time. [...] @@ -1291,9 +1217,10 @@ int xenXMDomainPinVcpu(virDomainPtr doma xenXMConfCachePtr entry; virBuffer mapbuf = VIR_BUFFER_INITIALIZER; char *mapstr = NULL; -char *ranges = NULL; int i, j, n, comma = 0; int ret = -1; +char *cpuset = NULL; +int maxcpu = 4096; hum, we use MAX_VIRT_CPUS at places I've checked up on this now - MAX_VIRT_CPUS refers to the Xen hypervisor and kernel limits on virtual CPUs - this is currently 32 or 64 depending on the architecture. The libvirt code here is refering to physical CPUs, whose limit is independant of virtual CPU limit, so we shouldnt' use the MAX_VIRT_CPUS constant here. I'll just #define a constant at the top of this file for now. 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] PATCH: 12/14: Convert XM driver XML formatter to generic API
On Thu, Jul 24, 2008 at 11:53:48AM -0400, Daniel Veillard wrote: -type arch='i686' machine='xenfv'hvm/type +typehvm/type Hum the previous patch was changing things the way around ... devices -emulator/usr/lib/xen/bin/qemu-dm/emulator disk type='block' device='disk' and removing the extra emulator Yes were indeed both bugs - I'm fixing them as I commit, so there'll be no changes to test suite needed for this patch 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
[libvirt] [PATCH] OpenVZ xml refactoring
Patch switch OpenVZ XML format to generic. main changes: - I used generic virDomainNetDef to define network in container. And wrote function to apply virDomainNetDef for container. Method virDomainNetDefParseXML is public now. - tag container is changed to devices - changed format of tag filesystem - added processing vcpu tag. Index: src/domain_conf.c === RCS file: /data/cvs/libvirt/src/domain_conf.c,v retrieving revision 1.5 diff -u -p -r1.5 domain_conf.c --- src/domain_conf.c 19 Jul 2008 07:42:34 - 1.5 +++ src/domain_conf.c 25 Jul 2008 12:40:17 - @@ -633,7 +633,7 @@ static void virDomainNetRandomMAC(virDom * @param node XML nodeset to parse for net definition * @return 0 on success, -1 on failure */ -static virDomainNetDefPtr +virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn, xmlNodePtr node) { virDomainNetDefPtr def; Index: src/domain_conf.h === RCS file: /data/cvs/libvirt/src/domain_conf.h,v retrieving revision 1.1 diff -u -p -r1.1 domain_conf.h --- src/domain_conf.h 11 Jul 2008 16:23:36 - 1.1 +++ src/domain_conf.h 25 Jul 2008 12:40:17 - @@ -472,6 +472,9 @@ int virDomainLoadAllConfigs(virConnectPt int virDomainDeleteConfig(virConnectPtr conn, virDomainObjPtr dom); +virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn, +xmlNodePtr node); + VIR_ENUM_DECL(virDomainVirt) VIR_ENUM_DECL(virDomainBoot) VIR_ENUM_DECL(virDomainFeature) Index: src/openvz_conf.c === RCS file: /data/cvs/libvirt/src/openvz_conf.c,v retrieving revision 1.30 diff -u -p -r1.30 openvz_conf.c --- src/openvz_conf.c 21 Jul 2008 13:34:19 - 1.30 +++ src/openvz_conf.c 25 Jul 2008 12:40:17 - @@ -56,6 +56,8 @@ #include buf.h #include memory.h #include util.h +#include xml.h +#include domain_conf.h static char *openvzLocateConfDir(void); static struct openvz_vm_def *openvzParseXML(virConnectPtr conn, xmlDocPtr xml); @@ -136,6 +138,34 @@ strtoI(const char *str) return val; } +/* function checks MAC address is empty + return 0 - empty + 1 - not +*/ +int openvzCheckEmptyMac(const unsigned char *mac) +{ +int i; +for (i = 0; i VIR_DOMAIN_NET_MAC_SIZE; i++) +if (mac[i] != 0x00) +return 1; + +return 0; +} + +/* convert mac address to string + return pointer to string or NULL +*/ +char *openvzMacToString(const unsigned char *mac) +{ +char str[20]; +if (snprintf(str, 18, %02X:%02X:%02X:%02X:%02X:%02X, + mac[0], mac[1], mac[2], + mac[3], mac[4], mac[5]) = 18) +return NULL; + +return strdup(str); +} + void openvzRemoveInactiveVM(struct openvz_driver *driver, struct openvz_vm *vm) { @@ -148,30 +178,7 @@ void openvzFreeVMDef(struct openvz_vm_def *def) { if (def) { -struct ovz_quota *quota = def-fs.quota; -struct ovz_ip *ip = def-net.ips; -struct ovz_ns *ns = def-net.ns; - -while (quota) { -struct ovz_quota *prev = quota; - -quota = quota-next; -VIR_FREE(prev); -} -while (ip) { -struct ovz_ip *prev = ip; - -ip = ip-next; -VIR_FREE(prev); -} -while (ns) { -struct ovz_ns *prev = ns; - -ns = ns-next; -VIR_FREE(prev); -} - -VIR_FREE(def); +virDomainNetDefFree(def-net); } } @@ -285,6 +292,74 @@ struct openvz_vm_def return def; } +/* Parse filesystem section +Sample: +filesystem type=template + source name=fedora-core-5-i386/ + quota type=size max=1/ + quota type=inodes max=100/ +/filesystem +*/ +static int openvzParseDomainFS(virConnectPtr conn, + struct openvz_fs_def *fs, + xmlXPathContextPtr ctxt) +{ +xmlNodePtr cur, obj; +char *type; + +obj = virXPathNode(/domain/devices/filesystem[1], ctxt); +if (obj == NULL) { +openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _(missing filesystem tag)); +return -1; +} + +/*check template type*/ +type = virXMLPropString(obj, type); +if (!type) { + openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _(missing type attribute)); + return -1; +} + +if (STRNEQ(type, template)) { + openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _(Unknown type attribute %s), type); + return -1; +} +VIR_FREE(type); + +cur = obj-children; +while(cur != NULL) +{ +if (cur-type == XML_ELEMENT_NODE) { +if (xmlStrEqual(cur-name, BAD_CAST source)) { + char * name = virXMLPropString(cur,
Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages
On Fri, Jul 25, 2008 at 05:02:43AM -0400, Daniel Veillard wrote: On Fri, Jul 25, 2008 at 09:29:43AM +0100, Daniel P. Berrange wrote: On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote: Hi, qemu_driver misses some conversions to a char* before printing the uuid. Possible fix attached. ACK, surprised that the printf() format checks don't complain about passing an unsigned char to a %s format in GCC. This is actually one of the things ICC flagged when i tried it, but I never fixed it Applied, i just had to add an include for uuid.h to avoid an undeclared function warning :-) The hunk including uuid.h accidently endet up in 0001-also-check-domain-uuid-on-create.patch, sorry about that. -- Guido -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages
On Fri, Jul 25, 2008 at 09:56:27AM -0400, Guido Günther wrote: On Fri, Jul 25, 2008 at 05:02:43AM -0400, Daniel Veillard wrote: On Fri, Jul 25, 2008 at 09:29:43AM +0100, Daniel P. Berrange wrote: On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote: Hi, qemu_driver misses some conversions to a char* before printing the uuid. Possible fix attached. ACK, surprised that the printf() format checks don't complain about passing an unsigned char to a %s format in GCC. This is actually one of the things ICC flagged when i tried it, but I never fixed it Applied, i just had to add an include for uuid.h to avoid an undeclared function warning :-) The hunk including uuid.h accidently endet up in 0001-also-check-domain-uuid-on-create.patch, sorry about that. Hum, i don't find it. Can you regenerate/repost please ? thanks, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH]: Utterly trivial comment cleanups in src/domain_conf.c
The subject pretty much says it all, except for the minor fact of using domain.xml in the xmlReadDoc(). This cleanup really just makes the code easier to read. Signed-off-by: Chris Lalancette [EMAIL PROTECTED] Index: src/domain_conf.c === RCS file: /data/cvs/libvirt/src/domain_conf.c,v retrieving revision 1.8 diff -u -r1.8 domain_conf.c --- a/src/domain_conf.c 25 Jul 2008 14:27:25 - 1.8 +++ b/src/domain_conf.c 25 Jul 2008 16:14:05 - @@ -1396,7 +1396,7 @@ } def-id = -1; -/* Find out what type of QEMU virtualization to use */ +/* Find out what type of virtualization to use */ if (!(tmp = virXPathString(conn, string(./@type), ctxt))) { virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, _(missing domain type attribute)); @@ -1762,7 +1762,7 @@ } VIR_FREE(nodes); -/* analysis of the input devices */ +/* analysis of the graphics devices */ if ((n = virXPathNodeSet(conn, ./devices/graphics, ctxt, nodes)) 0) { virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, _(cannot extract graphics devices)); @@ -1847,7 +1847,7 @@ xmlNodePtr root; virDomainDefPtr def = NULL; -if (!(xml = xmlReadDoc(BAD_CAST xmlStr, network.xml, NULL, +if (!(xml = xmlReadDoc(BAD_CAST xmlStr, domain.xml, NULL, XML_PARSE_NOENT | XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) { virDomainReportError(conn, VIR_ERR_XML_ERROR, NULL); -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] OpenVZ xml refactoring
On Fri, Jul 25, 2008 at 04:44:09PM +0400, Evgeniy Sokolov wrote: Patch switch OpenVZ XML format to generic. main changes: - I used generic virDomainNetDef to define network in container. And wrote function to apply virDomainNetDef for container. Method virDomainNetDefParseXML is public now. - tag container is changed to devices - changed format of tag filesystem - added processing vcpu tag. Generally looks fine to me, just a few remarks +/* Parse filesystem section +Sample: +filesystem type=template + source name=fedora-core-5-i386/ + quota type=size max=1/ + quota type=inodes max=100/ +/filesystem +*/ +static int openvzParseDomainFS(virConnectPtr conn, + struct openvz_fs_def *fs, + xmlXPathContextPtr ctxt) +{ +xmlNodePtr cur, obj; +char *type; + +obj = virXPathNode(/domain/devices/filesystem[1], ctxt); +if (obj == NULL) { +openvzError(conn, VIR_ERR_INTERNAL_ERROR, + _(missing filesystem tag)); +return -1; +} hum, maybe use virXPathNodeSet and checking you won't get more than one ? /* Extract domain uuid */ -obj = xmlXPathEval(BAD_CAST string(/domain/uuid[1]), ctxt); -if ((obj == NULL) || (obj-type != XPATH_STRING) || -(obj-stringval == NULL) || (obj-stringval[0] == 0)) { +prop = virXPathString(string(./uuid[1]), ctxt); +if (!prop) { int err; Hum, if you start using relative XPath queries like that it's a good idea to make sure ctxt-node is set to the node you're starting the lookup from I don't see that in the patch, maybe I missed it... +} else { +if (virUUIDParse(prop, def-uuid) 0) { +openvzError(conn, VIR_ERR_INTERNAL_ERROR, +_(malformed uuid element)); +goto bail_out; +} +VIR_FREE(prop); [...] +//TODO: processing NAT and phisical device typo physical :-) In general that looks way cleaner to me, I will give it a few nmore days and apply, unless you suggest another version, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: Utterly trivial comment cleanups in src/domain_conf.c
On Fri, Jul 25, 2008 at 06:16:12PM +0200, Chris Lalancette wrote: The subject pretty much says it all, except for the minor fact of using domain.xml in the xmlReadDoc(). This cleanup really just makes the code easier to read. Signed-off-by: Chris Lalancette [EMAIL PROTECTED] Looks fine to me, +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: Utterly trivial comment cleanups in src/domain_conf.c
On Fri, Jul 25, 2008 at 06:16:12PM +0200, Chris Lalancette wrote: The subject pretty much says it all, except for the minor fact of using domain.xml in the xmlReadDoc(). This cleanup really just makes the code easier to read. Signed-off-by: Chris Lalancette [EMAIL PROTECTED] Thanks, have commited this. 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] [PATCH] OpenVZ xml refactoring
On Fri, Jul 25, 2008 at 04:44:09PM +0400, Evgeniy Sokolov wrote: Patch switch OpenVZ XML format to generic. main changes: - I used generic virDomainNetDef to define network in container. And wrote function to apply virDomainNetDef for container. Method virDomainNetDefParseXML is public now. - tag container is changed to devices - changed format of tag filesystem - added processing vcpu tag. Index: src/domain_conf.c === RCS file: /data/cvs/libvirt/src/domain_conf.c,v retrieving revision 1.5 diff -u -p -r1.5 domain_conf.c --- src/domain_conf.c 19 Jul 2008 07:42:34 - 1.5 +++ src/domain_conf.c 25 Jul 2008 12:40:17 - @@ -633,7 +633,7 @@ static void virDomainNetRandomMAC(virDom * @param node XML nodeset to parse for net definition * @return 0 on success, -1 on failure */ -static virDomainNetDefPtr +virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn, xmlNodePtr node) { virDomainNetDefPtr def; Index: src/domain_conf.h === RCS file: /data/cvs/libvirt/src/domain_conf.h,v retrieving revision 1.1 diff -u -p -r1.1 domain_conf.h --- src/domain_conf.h 11 Jul 2008 16:23:36 - 1.1 +++ src/domain_conf.h 25 Jul 2008 12:40:17 - @@ -472,6 +472,9 @@ int virDomainLoadAllConfigs(virConnectPt int virDomainDeleteConfig(virConnectPtr conn, virDomainObjPtr dom); +virDomainNetDefPtr virDomainNetDefParseXML(virConnectPtr conn, +xmlNodePtr node); + This is not needed - we already export a generic virDOmainDeviceDefParse method, which allows parsing of an individual device of any type. That said, I don't think you need to use that either.. diff -u -p -r1.9 openvz_conf.h --- src/openvz_conf.h 10 Jul 2008 12:21:09 - 1.9 +++ src/openvz_conf.h 25 Jul 2008 12:40:17 - @@ -29,6 +29,7 @@ #define OPENVZ_CONF_H #include openvz_driver.h +#include domain_conf.h enum { OPENVZ_WARN, OPENVZ_ERR }; @@ -61,33 +62,16 @@ struct vps_props { struct openvz_fs_def { char tmpl[OPENVZ_TMPL_MAX]; -struct ovz_quota *quota; -}; - -struct ovz_ip { -char ip[OPENVZ_IP_MAX]; -char netmask[OPENVZ_IP_MAX]; -struct ovz_ip *next; -}; - -struct ovz_ns { -char ip[OPENVZ_IP_MAX]; -struct ovz_ns *next; -}; - -struct openvz_net_def { -char hostname[OPENVZ_HOSTNAME_MAX]; -char def_gw[OPENVZ_IP_MAX]; -struct ovz_ip *ips; -struct ovz_ns *ns; +long int disksize, diskinodes; }; struct openvz_vm_def { char name[OPENVZ_NAME_MAX]; unsigned char uuid[VIR_UUID_BUFLEN]; char profile[OPENVZ_PROFILE_MAX]; +unsigned long vcpus; struct openvz_fs_def fs; -struct openvz_net_def net; +virDomainNetDefPtr net; }; Rather than doing this 50/50 port, we should just switch over to the virDomainDefPtr/virDomainObjPtr objects entirely and do away with openvz_vm and openvz_vm_def objects completely. This will require the addition of my filesystem patch to the generic parser, but that's less effort that maintaining the custom parser in openvz code. This will allowing 95% of the openvz_conf.c file to go away entirely Regards, 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
[libvirt] virsh
Hi, I have virsh running in a remote ssh session in a dom0 xen VM, it is presenting a virtual console for a domU vm running a RHEL5 installer The RHEL5 is going astray setting up the network using DHCP, I want to do Ctrl-Alt-Fn to view the installer log files, and access a shell prompt. But the Ctrl-Alt-Fn is being consumed by the laptop running the remote ssh ssh session. How do I get the virsh to send Ctrl-Alt-Fn to the domU console? -- Drew Einhorn -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH/RFC]: hostdev passthrough support
Hi, attached is some basic support for host device passthrough. It enables you to passthrough usb devices in qemu/kvm via: devices hostdev type='usb' vendor='0204' product='6025'/ hostdev type='usb' bus='001' device='007'/ /devices I didn't implement unplug yet since this needs some modifications to qemu/kvm to be able to identify the correct device to unplug. Does this look reasonable? -- Guido --- src/domain_conf.c | 119 - src/domain_conf.h | 33 +++ src/qemu_conf.c | 26 src/qemu_driver.c | 110 + 4 files changed, 260 insertions(+), 28 deletions(-) diff --git a/src/domain_conf.c b/src/domain_conf.c index cd4a3da..d36caeb 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -125,6 +125,9 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, sdl, vnc) +VIR_ENUM_IMPL(virDomainHostdev, VIR_DOMAIN_HOSTDEV_TYPE_LAST, + usb, + pci) static void virDomainReportError(virConnectPtr conn, int code, const char *fmt, ...) @@ -314,6 +317,15 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def) VIR_FREE(def); } +void virDomainHostdevDefFree(virDomainHostdevDefPtr def) +{ +if (!def) +return; + +virDomainHostdevDefFree(def-next); +VIR_FREE(def); +} + void virDomainDeviceDefFree(virDomainDeviceDefPtr def) { if (!def) @@ -332,6 +344,9 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) case VIR_DOMAIN_DEVICE_SOUND: virDomainSoundDefFree(def-data.sound); break; +case VIR_DOMAIN_DEVICE_HOST: +virDomainHostdevDefFree(def-data.hostdev); +break; } VIR_FREE(def); @@ -350,7 +365,7 @@ void virDomainDefFree(virDomainDefPtr def) virDomainChrDefFree(def-parallels); virDomainChrDefFree(def-console); virDomainSoundDefFree(def-sounds); - +virDomainHostdevDefFree(def-hostdevs); VIR_FREE(def-os.type); VIR_FREE(def-os.arch); @@ -1297,6 +1312,88 @@ error: } +static virDomainHostdevDefPtr +virDomainHostdevDefParseXML(virConnectPtr conn, +const xmlNodePtr node) { + +virDomainHostdevDefPtr def; +char *type, *vendor; + +if (VIR_ALLOC(def) 0) { +virDomainReportError(conn, VIR_ERR_NO_MEMORY, NULL); +return NULL; +} +type = virXMLPropString(node, type); +if (type) { +if ((def-type = virDomainHostdevTypeFromString(type)) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(unknown host device type '%s'), type); +goto error; +} else { +type = VIR_DOMAIN_HOSTDEV_TYPE_USB; +} +} +vendor = virXMLPropString(node, vendor); +if (vendor) { +char *product; + +def-usb.byModel = 1; +if (virStrToLong_ui(vendor, NULL, 16, def-usb.vendor) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(cannot parse vendor %s), vendor); +VIR_FREE(vendor); +goto error; + } + VIR_FREE(vendor); + +product = virXMLPropString(node, product); +if (product) { +if (virStrToLong_ui(product, NULL, 16, def-usb.product) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(cannot parse product %s), product); +VIR_FREE(product); +goto error; +} +VIR_FREE(product); +} +} else { +char *bus, *device; + +def-usb.byModel = 0; +bus = virXMLPropString(node, bus); +if (bus) { +if (virStrToLong_ui(bus, NULL, 16, def-usb.bus) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(cannot parse bus %s), bus); +VIR_FREE(bus); +goto error; +} +VIR_FREE(bus); +} + +device = virXMLPropString(node, device); +if (device) { + if (virStrToLong_ui(device, NULL, 16, def-usb.device) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(cannot parse device %s), device); +VIR_FREE(device); +goto error; +} +VIR_FREE(device); +} +} + +cleanup: +/* NOP */ +return def; + +error: +virDomainHostdevDefFree(def); +def = NULL; +goto cleanup; +} + + static int virDomainLifecycleParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, const char *xpath, @@ -1363,6 +1460,10 @@ virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn, dev-type = VIR_DOMAIN_DEVICE_SOUND;
Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages
On Fri, Jul 25, 2008 at 11:46:48AM -0400, Daniel Veillard wrote: On Fri, Jul 25, 2008 at 09:56:27AM -0400, Guido Günther wrote: On Fri, Jul 25, 2008 at 05:02:43AM -0400, Daniel Veillard wrote: On Fri, Jul 25, 2008 at 09:29:43AM +0100, Daniel P. Berrange wrote: On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote: Hi, qemu_driver misses some conversions to a char* before printing the uuid. Possible fix attached. ACK, surprised that the printf() format checks don't complain about passing an unsigned char to a %s format in GCC. This is actually one of the things ICC flagged when i tried it, but I never fixed it Applied, i just had to add an include for uuid.h to avoid an undeclared function warning :-) The hunk including uuid.h accidently endet up in 0001-also-check-domain-uuid-on-create.patch, sorry about that. Hum, i don't find it. Can you regenerate/repost please ? Attached. It also dropped the check if the domain is running or not, since a transient domain with of a currently offline domain is just to confusing. -- Guido [PATCH] also check domain uuid on create and don't care if domain is active or not - it confuses users both ways --- src/qemu_driver.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 81bde4e..3c04e09 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -2013,13 +2013,24 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, return NULL; vm = virDomainFindByName(driver-domains, def-name); -if (vm virDomainIsActive(vm)) { +if (vm) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _(domain %s is already defined and running), + _(domain '%s' is already defined and running), def-name); virDomainDefFree(def); return NULL; } +vm = virDomainFindByUUID(driver-domains, def-uuid); +if (vm) { +char uuidstr[VIR_UUID_STRING_BUFLEN]; + +virUUIDFormat(def-uuid, uuidstr); +qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, + _(domain with uuid '%s' is already defined and running), + uuidstr); +virDomainDefFree(def); +return NULL; +} if (!(vm = virDomainAssignDef(conn, driver-domains, -- 1.5.6.3 -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list