Re: [libvirt] SPAM-LOW: Re: Re: Node.GetInfo error
?Hi, I think the solution is in the last patches I have send (which are not yet in the git). Have you tried the NodeInfoStructure I have sended yesterday ? Arnaud From: 黄亮 Sent: Monday, November 01, 2010 3:01 AM To: arnaud.champ...@devatom.fr Cc: libvir-list Subject: SPAM-LOW: Re: Re: Node.GetInfo error HI, I tried Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); But IDE shows compilation errors that there is no Error defination in Errors, and Errors.GetLastError() returns int. I made a guess that maybe it was like this: Error err = Errors.SaveLastError(); MessageBox.Show(Get Info error: + err.Message); It can be compiled but err.Message has nothing in it. Did I make a wrong assumption? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-10-31 16:48:15 收件人: 黄亮 抄送: libvir-list@redhat.com 主题: Re: Node.GetInfo error Ok, at first GetLastError return an Error object. So you should anything like : Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); For the NodeInfo structure, I think the problem is the same that was for DomainInfo, I'll check marshaling. Then respond you with the correct infos. Arnaud PS : can you also put libvirt-l...@redhat.com in copy of your mails, to keep everyone in the loop ? From: 黄亮 Sent: Sunday, October 31, 2010 8:20 AM To: arnaud.champion Subject: Node.GetInfo error Hi, Sorry for disturbing again. But I get error while using Node.GetInfo. Code: NodeInfo aNodeInfo = new NodeInfo(); if (Node.GetInfo(con, aNodeInfo) 0) { //MessageBox.Show(Node Info Error); MessageBox.Show(Errors.GetLastError().ToString()); return 0f; } I'm sure con != IntPtr.Zero. I tried to use Errors.GetLastError(), it returns int. But I don't know what to do with it. So, any suggestions ? Thanks Regards 2010-10-31 Lancer __ Information from ESET Smart Security, version of virus signature database 5577 (20101030) __ The message was checked by ESET Smart Security. http://www.eset.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] SPAM-LOW: Re: Re: Node.GetInfo error
?Ok, if you are under windows (like me), use GitExtension (http://sourceforge.net/projects/gitextensions/) It works, not perfect, but it works. Arnaud From: 黄亮 Sent: Monday, November 01, 2010 9:52 AM To: arnaud.champ...@devatom.fr Subject: Re: Re: SPAM-LOW: Re: Re: Node.GetInfo error Hi Arnaud, The NodeInfoStructure you sent to me yesterday works, thank you. I saw your patch file, should I manually apply it to the source code or is there some tools I can use to automatically apply the changes? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-11-01 16:37:17 收件人: 黄亮 抄送: libvir-list 主题: Re: SPAM-LOW: Re: Re: Node.GetInfo error Hi, I think the solution is in the last patches I have send (which are not yet in the git). Have you tried the NodeInfoStructure I have sended yesterday ? Arnaud From: 黄亮 Sent: Monday, November 01, 2010 3:01 AM To: arnaud.champ...@devatom.fr Cc: libvir-list Subject: SPAM-LOW: Re: Re: Node.GetInfo error HI, I tried Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); But IDE shows compilation errors that there is no Error defination in Errors, and Errors.GetLastError() returns int. I made a guess that maybe it was like this: Error err = Errors.SaveLastError(); MessageBox.Show(Get Info error: + err.Message); It can be compiled but err.Message has nothing in it. Did I make a wrong assumption? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-10-31 16:48:15 收件人: 黄亮 抄送: libvir-list@redhat.com 主题: Re: Node.GetInfo error Ok, at first GetLastError return an Error object. So you should anything like : Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); For the NodeInfo structure, I think the problem is the same that was for DomainInfo, I'll check marshaling. Then respond you with the correct infos. Arnaud PS : can you also put libvirt-l...@redhat.com in copy of your mails, to keep everyone in the loop ? From: 黄亮 Sent: Sunday, October 31, 2010 8:20 AM To: arnaud.champion Subject: Node.GetInfo error Hi, Sorry for disturbing again. But I get error while using Node.GetInfo. Code: NodeInfo aNodeInfo = new NodeInfo(); if (Node.GetInfo(con, aNodeInfo) 0) { //MessageBox.Show(Node Info Error); MessageBox.Show(Errors.GetLastError().ToString()); return 0f; } I'm sure con != IntPtr.Zero. I tried to use Errors.GetLastError(), it returns int. But I don't know what to do with it. So, any suggestions ? Thanks Regards 2010-10-31 Lancer __ Information from ESET Smart Security, version of virus signature database 5577 (20101030) __ The message was checked by ESET Smart Security. http://www.eset.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: add the USB devices to the cgroup whitelist
On Sat, Oct 30, 2010 at 12:25:30AM +0200, Diego Elio Pettenò wrote: Add a new interface to hostusb.h to add an USB device abstraction to a cgroup whitelist; then use it both when attaching a new USB device and when adding it to the commandline so that the device can be accessed by the QEmu-specific cgroup. --- src/libvirt_private.syms |1 + src/qemu/qemu_driver.c | 36 src/util/hostusb.c |6 ++ src/util/hostusb.h |4 +++- 4 files changed, 46 insertions(+), 1 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cf06256..0c6f308 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -707,6 +707,7 @@ virMutexUnlock; # usb.h +usbAllowDeviceCgroup; usbDeviceFileIterate; usbDeviceGetBus; usbDeviceGetDevno; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1eea3a9..acf319e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3505,6 +3505,23 @@ static int qemuSetupCgroup(struct qemud_driver *driver, qemuSetupChardevCgroup, cgroup) 0) goto cleanup; + +for (i = 0; i vm-def-nhostdevs; i++) { + virDomainHostdevDefPtr hostdev = vm-def-hostdevs[i]; + usbDevice *usb; + + if (hostdev-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) +continue; + if (hostdev-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) +continue; + + if ((usb = usbFindDevice(hostdev-source.subsys.u.usb.vendor, + hostdev-source.subsys.u.usb.product)) == NULL) +goto cleanup; This should actually use usbGetDevice with bus+device, since the (optional) vendor+product has already been resolved into a bus+device ID pair. + if (usbAllowDeviceCgroup(usb, cgroup) 0) +goto cleanup; +} } This should call out to usbDeviceFileIterate, passing a callback todo the cgroup relabelling. if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) { @@ -8454,6 +8471,25 @@ static int qemudDomainAttachHostUsbDevice(struct qemud_driver *driver, goto error; } +if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { + virCgroupPtr cgroup = NULL; + usbDevice *usb; + + if (virCgroupForDomain(driver-cgroup, vm-def-name, cgroup, 0) !=0 ) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(Unable to find cgroup for %s\n), +vm-def-name); +goto error; + } + + if ((usb = usbFindDevice(hostdev-source.subsys.u.usb.vendor, + hostdev-source.subsys.u.usb.product)) == NULL) +goto error; Likewise here. + + if (usbAllowDeviceCgroup(usb, cgroup) 0) +goto error; +} Also usbDeviceFileIterate. + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) ret = qemuMonitorAddDevice(priv-mon, devstr); diff --git a/src/util/hostusb.c b/src/util/hostusb.c index 2d6e414..2cbe1fb 100644 --- a/src/util/hostusb.c +++ b/src/util/hostusb.c @@ -225,3 +225,9 @@ int usbDeviceFileIterate(usbDevice *dev, { return (actor)(dev, dev-path, opaque); } + +int usbAllowDeviceCgroup(usbDevice *dev, + virCgroupPtr group) +{ +return virCgroupAllowDevicePath(group, dev-path); +} This introduces a strict coupling between the usb + cgroups code which isn't something we want. Using the usbDeviceFileIterate API avoids this coupling. One general point is that the indentation in your patch is not correct - needs to be 4 space indented rather than 2. See the HACKING file for .emacs rules. Regards, Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] [TCK] network: create networks and check for exected results
On 10/29/2010 11:33 AM, Eric Blake wrote: On 10/26/2010 05:27 PM, Stefan Berger wrote: On 10/26/2010 07:08 PM, Eric Blake wrote: Sorry for sounding so depressing; I'm very pleased to see your efforts in providing tests for the code you've written. Even though this test is intended to be skipped on non-Linux, you still have to worry about merely parsing through the test on other platforms like Solaris, where /bin/sh won't understand the bash-isms and where /bin/bash is not guaranteed to exist. But if we decide that requiring the presence of /bin/bash is acceptable for the TCK, then a lot of my review becomes irrelevant; but my comments about your mkstemp replacement being insecure are still applicable even in that case. Ok. Well, I hope for bash then... IRC verdict - Dan and I are both okay with assuming /bin/bash exists. So, that just leaves cleaning up the temporary file management. Would you like me to tackle that as an incremental diff on top of your original patch? Yes, you can put it in on top of it. So is this an ACK now so I can push? I just currently don't have the time to convert it into a generic shell script, but put that on a future todo list. Also the original nwfilter test should probably be converted then as well... Stefan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] qemu: add the USB devices to the cgroup whitelist
Make sure that the QEmu process within the cgroup can access the device file for the USB device that has to be connected to the virtual domain. --- src/qemu/qemu_driver.c | 55 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..0612e69 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3434,6 +3434,25 @@ static int qemuSetupChardevCgroup(virDomainDefPtr def, } +static int qemuSetupHostUsbDeviceCgroup(usbDevice *dev ATTRIBUTE_UNUSED, +const char *path, +void *opaque) +{ +virCgroupPtr cgroup = opaque; +int rc; + +VIR_DEBUG(Process path '%s' for USB device, path); +rc = virCgroupAllowDevicePath(cgroup, path); +if (rc != 0) { +virReportSystemError(-rc, + _(Unable to allow device %s), + path); +return -1; +} + +return 0; +} + static int qemuSetupCgroup(struct qemud_driver *driver, virDomainObjPtr vm) { @@ -3507,6 +3526,23 @@ static int qemuSetupCgroup(struct qemud_driver *driver, qemuSetupChardevCgroup, cgroup) 0) goto cleanup; + +for (i = 0; i vm-def-nhostdevs; i++) { +virDomainHostdevDefPtr hostdev = vm-def-hostdevs[i]; +usbDevice *usb; + +if (hostdev-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) +continue; +if (hostdev-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) +continue; + +if ((usb = usbGetDevice(hostdev-source.subsys.u.usb.bus, +hostdev-source.subsys.u.usb.device)) == NULL) +goto cleanup; + +if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, cgroup) 0 ) +goto cleanup; +} } if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) { @@ -8511,6 +8547,25 @@ static int qemudDomainAttachHostUsbDevice(struct qemud_driver *driver, goto error; } +if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { +virCgroupPtr cgroup = NULL; +usbDevice *usb; + +if (virCgroupForDomain(driver-cgroup, vm-def-name, cgroup, 0) !=0 ) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(Unable to find cgroup for %s\n), +vm-def-name); +goto error; +} + +if ((usb = usbGetDevice(hostdev-source.subsys.u.usb.bus, +hostdev-source.subsys.u.usb.device)) == NULL) +goto error; + +if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, cgroup) 0 ) +goto error; +} + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) ret = qemuMonitorAddDevice(priv-mon, devstr); -- 1.7.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: add the USB devices to the cgroup whitelist
On Mon, Nov 01, 2010 at 11:32:25AM +0100, Diego Elio Pettenò wrote: Il giorno lun, 01/11/2010 alle 10.26 +, Daniel P. Berrange ha scritto: This introduces a strict coupling between the usb + cgroups code which isn't something we want. Using the usbDeviceFileIterate API avoids this coupling. Okay I'll rework this today; for now at least I guess my users won't find themselves stonewalled by libvirt :P One general point is that the indentation in your patch is not correct - needs to be 4 space indented rather than 2. See the HACKING file for .emacs rules. Gha missed that; would it be useful if I sent a patch to add a .dir-locals.el so that us Emacs users would get it out of the box? ;) Sure, sounds fine. Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] xen: work with ia64 MAX_VIRT_CPUS of 64
On Fri, Oct 29, 2010 at 11:19:50AM -0600, Eric Blake wrote: * src/xen/xen_hypervisor.c (MAX_VIRT_CPUS): Move... * src/xen/xen_driver.h (MAX_VIRT_CPUS): ...so all xen code can see same value. * src/xen/xend_internal.c (sexpr_to_xend_domain_info) (xenDaemonDomainGetVcpusFlags, xenDaemonParseSxpr) (xenDaemonFormatSxpr): Work if MAX_VIRT_CPUS is 64 on a platform where long is 64-bits. * src/xen/xm_internal.c (xenXMDomainConfigParse) (xenXMDomainConfigFormat): Likewise. ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] misc: encode the Emacs suggstions from HACKING into a .dir-locals.el file
With this file in place, opening any source file in libvirt will set up Emacs for proper indentation. --- .dir-locals.el |8 1 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 000..7c483d2 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,8 @@ +( + (c-mode . ( +(c-file-style . KR) +(indent-tabs-mode . nil) +(c-indent-level . 4) +(c-basic-offset . 4) +)) + ) -- 1.7.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: add the USB devices to the cgroup whitelist
Il giorno lun, 01/11/2010 alle 10.26 +, Daniel P. Berrange ha scritto: This introduces a strict coupling between the usb + cgroups code which isn't something we want. Using the usbDeviceFileIterate API avoids this coupling. Okay I'll rework this today; for now at least I guess my users won't find themselves stonewalled by libvirt :P One general point is that the indentation in your patch is not correct - needs to be 4 space indented rather than 2. See the HACKING file for .emacs rules. Gha missed that; would it be useful if I sent a patch to add a .dir-locals.el so that us Emacs users would get it out of the box? ;) -- Diego Elio Pettenò — “Flameeyes” http://blog.flameeyes.eu/ If you found a .asc file in this mail and know not what it is, it's a GnuPG digital signature: http://www.gnupg.org/ signature.asc Description: This is a digitally signed message part -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: Record timestamp for qemu domain log
Currently only support domain start and domain shutdown, for domain start, adding timestamp before qemu command line, for domain shutdown, just say it's shutting down with timestamp. * src/qemu/qemu_driver.c --- src/qemu/qemu_driver.c | 42 +- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..963b70c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3830,6 +3830,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, char ebuf[1024]; char *pidfile = NULL; int logfile = -1; +char *timestamp; qemuDomainObjPrivatePtr priv = vm-privateData; struct qemudHookData hookData; @@ -4017,7 +4018,17 @@ static int qemudStartVMDaemon(virConnectPtr conn, goto cleanup; } +if ((timestamp = virTimestamp()) == NULL) { +virReportOOMError(); +goto cleanup; +} else if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_FREE(timestamp); +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} + tmp = progenv; + while (*tmp) { if (safewrite(logfile, *tmp, strlen(*tmp)) 0) VIR_WARN(Unable to write envv to logfile: %s, @@ -4168,7 +4179,6 @@ cleanup: return -1; } - static void qemudShutdownVMDaemon(struct qemud_driver *driver, virDomainObjPtr vm, int migrated) { @@ -4178,6 +4188,31 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver, virErrorPtr orig_err; virDomainDefPtr def; int i; +int logfile = -1; +char *timestamp; +char ebuf[1024]; + +VIR_DEBUG0(Creating domain log file); +if ((logfile = qemudLogFD(driver, vm-def-name)) 0) { +/* To not break the normal domain shutdown process, skip the + * timestamp log writing if failed on opening log file. */ +VIR_WARN(Unable to open logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} else { +if ((timestamp = virTimestamp()) == NULL) { +virReportOOMError(); +goto cleanup; +} else { +strcat(timestamp, shutting down\n); + +if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} + +VIR_FREE(timestamp); +} +} VIR_DEBUG(Shutting down VM '%s' pid=%d migrated=%d, vm-def-name, vm-pid, migrated); @@ -4315,6 +4350,11 @@ retry: virSetError(orig_err); virFreeError(orig_err); } + +cleanup: +if (VIR_CLOSE(logfile) 0) +VIR_WARN(Unable to close logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); } -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] qemu: Record timestamp for qemu domain log
于 2010年11月01日 12:17, Osier Yang 写道: Currently only support domain start and domain shutdown, for domain start, adding timestamp before qemu command line, for domain shutdown, just say it's shutting down with timestamp. * src/qemu/qemu_driver.c --- src/qemu/qemu_driver.c | 42 +- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..963b70c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3830,6 +3830,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, char ebuf[1024]; char *pidfile = NULL; int logfile = -1; +char *timestamp; qemuDomainObjPrivatePtr priv = vm-privateData; struct qemudHookData hookData; @@ -4017,7 +4018,17 @@ static int qemudStartVMDaemon(virConnectPtr conn, goto cleanup; } +if ((timestamp = virTimestamp()) == NULL) { +virReportOOMError(); +goto cleanup; +} else if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_FREE(timestamp); +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} + tmp = progenv; + while (*tmp) { if (safewrite(logfile, *tmp, strlen(*tmp)) 0) VIR_WARN(Unable to write envv to logfile: %s, @@ -4168,7 +4179,6 @@ cleanup: return -1; } - static void qemudShutdownVMDaemon(struct qemud_driver *driver, virDomainObjPtr vm, int migrated) { @@ -4178,6 +4188,31 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver, virErrorPtr orig_err; virDomainDefPtr def; int i; +int logfile = -1; +char *timestamp; +char ebuf[1024]; + +VIR_DEBUG0(Creating domain log file); +if ((logfile = qemudLogFD(driver, vm-def-name)) 0) { +/* To not break the normal domain shutdown process, skip the + * timestamp log writing if failed on opening log file. */ +VIR_WARN(Unable to open logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} else { +if ((timestamp = virTimestamp()) == NULL) { +virReportOOMError(); +goto cleanup; +} else { +strcat(timestamp, shutting down\n); + +if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} + +VIR_FREE(timestamp); +} +} VIR_DEBUG(Shutting down VM '%s' pid=%d migrated=%d, vm-def-name, vm-pid, migrated); @@ -4315,6 +4350,11 @@ retry: virSetError(orig_err); virFreeError(orig_err); } + +cleanup: +if (close(logfile) 0) ah, I need to use VIR_CLOSE instead.. will update. - Osier +VIR_WARN(Unable to close logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); } -- 1.7.2.3 -- 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] PCI/USB devices documentation
Hello, so far unsuccessfully, I'm trying to attach PCI/USB devices to Guests (via virt-manager, soon via virsh because - whatever :]). Anyway, there is hostdev managed='yes' where I'm wondering what 'managed' means, because it's not documented here[1]. Is it a bug or is it documented elsewhere? btw also, 'Node devices XML format'[2] page is empty Thanks, Zdenek References: --- [1] http://libvirt.org/formatdomain.html#elementsUSB [2] http://libvirt.org/formatnode.html PS: I haven't forgotten about Slackware SSH how-to, but- *sigh* I promise! -- Zdenek Styblik Net/Linux admin OS TurnovFree.net email: sty...@turnovfree.net jabber: sty...@jabber.turnovfree.net -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PCI/USB devices documentation
于 2010年11月01日 21:38, Zdenek Styblik 写道: Hello, so far unsuccessfully, I'm trying to attach PCI/USB devices to Guests (via virt-manager, soon via virsh because - whatever :]). Anyway, there ishostdev managed='yes' where I'm wondering what 'managed' means, because it's not documented here[1]. Is it a bug or is it documented elsewhere? [quote] In managed mode, the configured device will be automatically detached from the host OS drivers when the guest is started, and then re-attached when the guest shuts down. In unmanaged mode, the device must be explicit detached ahead of booting the guest. The guest will refuse to start if the device is still attached to the host OS. [/quote] see: http://libvirt.org/guide/html/Application_Development_Guide-Device_Config-PCI_Pass.html think we need document it in nodedev xml.. :-) - Osier btw also, 'Node devices XML format'[2] page is empty Thanks, Zdenek References: --- [1] http://libvirt.org/formatdomain.html#elementsUSB [2] http://libvirt.org/formatnode.html PS: I haven't forgotten about Slackware SSH how-to, but- *sigh* I promise! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] qemu: add the USB devices to the cgroup whitelist
On Mon, Nov 01, 2010 at 12:03:16PM +0100, Diego Elio Pettenò wrote: Make sure that the QEmu process within the cgroup can access the device file for the USB device that has to be connected to the virtual domain. --- src/qemu/qemu_driver.c | 55 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..0612e69 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3434,6 +3434,25 @@ static int qemuSetupChardevCgroup(virDomainDefPtr def, } +static int qemuSetupHostUsbDeviceCgroup(usbDevice *dev ATTRIBUTE_UNUSED, +const char *path, +void *opaque) +{ +virCgroupPtr cgroup = opaque; +int rc; + +VIR_DEBUG(Process path '%s' for USB device, path); +rc = virCgroupAllowDevicePath(cgroup, path); +if (rc != 0) { +virReportSystemError(-rc, + _(Unable to allow device %s), + path); +return -1; +} + +return 0; +} + static int qemuSetupCgroup(struct qemud_driver *driver, virDomainObjPtr vm) { @@ -3507,6 +3526,23 @@ static int qemuSetupCgroup(struct qemud_driver *driver, qemuSetupChardevCgroup, cgroup) 0) goto cleanup; + +for (i = 0; i vm-def-nhostdevs; i++) { +virDomainHostdevDefPtr hostdev = vm-def-hostdevs[i]; +usbDevice *usb; + +if (hostdev-mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) +continue; +if (hostdev-source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) +continue; + +if ((usb = usbGetDevice(hostdev-source.subsys.u.usb.bus, +hostdev-source.subsys.u.usb.device)) == NULL) +goto cleanup; + +if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, cgroup) 0 ) +goto cleanup; +} } if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) { @@ -8511,6 +8547,25 @@ static int qemudDomainAttachHostUsbDevice(struct qemud_driver *driver, goto error; } +if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { +virCgroupPtr cgroup = NULL; +usbDevice *usb; + +if (virCgroupForDomain(driver-cgroup, vm-def-name, cgroup, 0) !=0 ) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(Unable to find cgroup for %s\n), +vm-def-name); +goto error; +} + +if ((usb = usbGetDevice(hostdev-source.subsys.u.usb.bus, +hostdev-source.subsys.u.usb.device)) == NULL) +goto error; + +if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, cgroup) 0 ) +goto error; +} + qemuDomainObjEnterMonitorWithDriver(driver, vm); if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) ret = qemuMonitorAddDevice(priv-mon, devstr); ACK, looks fine now. Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 2/2] misc: encode the Emacs suggstions from HACKING into a .dir-locals.el file
On Mon, Nov 01, 2010 at 12:03:17PM +0100, Diego Elio Pettenò wrote: With this file in place, opening any source file in libvirt will set up Emacs for proper indentation. --- .dir-locals.el |8 1 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 000..7c483d2 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,8 @@ +( + (c-mode . ( +(c-file-style . KR) +(indent-tabs-mode . nil) +(c-indent-level . 4) +(c-basic-offset . 4) +)) + ) ACK Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] xen: work with ia64 MAX_VIRT_CPUS of 64
On 11/01/2010 03:36 AM, Daniel Veillard wrote: On Fri, Oct 29, 2010 at 11:19:50AM -0600, Eric Blake wrote: * src/xen/xen_hypervisor.c (MAX_VIRT_CPUS): Move... * src/xen/xen_driver.h (MAX_VIRT_CPUS): ...so all xen code can see same value. * src/xen/xend_internal.c (sexpr_to_xend_domain_info) (xenDaemonDomainGetVcpusFlags, xenDaemonParseSxpr) (xenDaemonFormatSxpr): Work if MAX_VIRT_CPUS is 64 on a platform where long is 64-bits. * src/xen/xm_internal.c (xenXMDomainConfigParse) (xenXMDomainConfigFormat): Likewise. ACK, Thanks; pushed. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] PCI/USB devices documentation
On 11/01/10 14:59, Osier wrote: 于 2010年11月01日 21:38, Zdenek Styblik 写道: Hello, so far unsuccessfully, I'm trying to attach PCI/USB devices to Guests (via virt-manager, soon via virsh because - whatever :]). Anyway, there ishostdev managed='yes' where I'm wondering what 'managed' means, because it's not documented here[1]. Is it a bug or is it documented elsewhere? [quote] In managed mode, the configured device will be automatically detached from the host OS drivers when the guest is started, and then re-attached when the guest shuts down. In unmanaged mode, the device must be explicit detached ahead of booting the guest. The guest will refuse to start if the device is still attached to the host OS. [/quote] see: http://libvirt.org/guide/html/Application_Development_Guide-Device_Config-PCI_Pass.html thanks :) think we need document it in nodedev xml.. :-) Should I file bug report then? :P Zdenek - Osier btw also, 'Node devices XML format'[2] page is empty Thanks, Zdenek References: --- [1] http://libvirt.org/formatdomain.html#elementsUSB [2] http://libvirt.org/formatnode.html PS: I haven't forgotten about Slackware SSH how-to, but- *sigh* I promise! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Zdenek Styblik Net/Linux admin OS TurnovFree.net email: sty...@turnovfree.net jabber: sty...@jabber.turnovfree.net -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 01/10] Change calling conventions in remote driver client internals
The remoteIO() method has wierd calling conventions, where it is passed a pre-allocated 'struct remote_call *' but then free()s it itself, instead of letting the caller free(). This fixes those weird semantics * src/remote/remote_driver.c: Sanitize semantics of remoteIO method wrt to memory release --- src/remote/remote_driver.c | 25 + 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index c8d9a4d..1c874b2 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8156,6 +8156,7 @@ remoteStreamPacket(virStreamPtr st, XDR xdr; struct remote_thread_call *thiscall; remote_message_header hdr; +int ret; memset(hdr, 0, sizeof hdr); @@ -8225,8 +8226,9 @@ remoteStreamPacket(virStreamPtr st, } xdr_destroy (xdr); -/* remoteIO frees 'thiscall' for us (XXX that's dubious semantics) */ -if (remoteIO(st-conn, priv, 0, thiscall) 0) +ret = remoteIO(st-conn, priv, 0, thiscall); +VIR_FREE(thiscall); +if (ret 0) return -1; return nbytes; @@ -8334,6 +8336,7 @@ remoteStreamRecv(virStreamPtr st, if (!privst-incomingOffset) { struct remote_thread_call *thiscall; +int ret; if (VIR_ALLOC(thiscall) 0) { virReportOOMError(); @@ -8354,8 +8357,9 @@ remoteStreamRecv(virStreamPtr st, goto cleanup; } -/* remoteIO frees 'thiscall' for us (XXX that's dubious semantics) */ -if (remoteIO(st-conn, priv, 0, thiscall) 0) +ret = remoteIO(st-conn, priv, 0, thiscall); +VIR_FREE(thiscall); +if (ret 0) goto cleanup; } @@ -10056,12 +10060,10 @@ remoteIO(virConnectPtr conn, remoteError(VIR_ERR_INTERNAL_ERROR, _(failed to wake up polling thread: %s), virStrerror(errno, errout, sizeof errout)); -VIR_FREE(thiscall); return -1; } else if (s != sizeof(ignore)) { remoteError(VIR_ERR_INTERNAL_ERROR, %s, _(failed to wake up polling thread)); -VIR_FREE(thiscall); return -1; } @@ -10081,7 +10083,6 @@ remoteIO(virConnectPtr conn, } remoteError(VIR_ERR_INTERNAL_ERROR, %s, _(failed to wait on condition)); -VIR_FREE(thiscall); return -1; } @@ -10132,10 +10133,8 @@ remoteIO(virConnectPtr conn, if (priv-watch = 0) virEventUpdateHandle(priv-watch, VIR_EVENT_HANDLE_READABLE); -if (rv 0) { -VIR_FREE(thiscall); +if (rv 0) return -1; -} cleanup: DEBUG(All done with our call %d %p %p, thiscall-proc_nr, priv-waitDispatch, thiscall); @@ -10188,7 +10187,6 @@ cleanup: } else { rv = 0; } -VIR_FREE(thiscall); return rv; } @@ -10205,6 +10203,7 @@ call (virConnectPtr conn, struct private_data *priv, xdrproc_t ret_filter, char *ret) { struct remote_thread_call *thiscall; +int rv; thiscall = prepareCall(priv, flags, proc_nr, args_filter, args, ret_filter, ret); @@ -10214,7 +10213,9 @@ call (virConnectPtr conn, struct private_data *priv, return -1; } -return remoteIO(conn, priv, flags, thiscall); +rv = remoteIO(conn, priv, flags, thiscall); +VIR_FREE(thiscall); +return rv; } -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 00/10] Allow access to text console with virStream APIs (v2)
An update of the patches in http://www.redhat.com/archives/libvir-list/2010-August/msg00379.html The end goal is to allow 'virsh console' to work unprivileged, and/or over remote connections. The main change in this version, is that the streams code has been pulled out of the QEMU driver, into a 'fdstream.h' file, so that 90% of the code can be shared across LXC/UML/Xen drivers. .x-sc_avoid_write |1 daemon/remote.c | 95 +++ daemon/remote_dispatch_args.h |2 daemon/remote_dispatch_prototypes.h | 16 + daemon/remote_dispatch_table.h | 10 daemon/stream.c |7 include/libvirt/libvirt.h.in| 16 + include/libvirt/virterror.h |3 src/Makefile.am |1 src/driver.h| 10 src/esx/esx_driver.c|1 src/fdstream.c | 472 src/fdstream.h | 44 +++ src/libvirt.c | 96 +++ src/libvirt_private.syms|7 src/libvirt_public.syms |2 src/lxc/lxc_driver.c| 66 + src/opennebula/one_driver.c |1 src/openvz/openvz_driver.c |1 src/phyp/phyp_driver.c |1 src/qemu/qemu_driver.c | 359 ++- src/remote/remote_driver.c | 324 +--- src/remote/remote_protocol.c| 37 ++ src/remote/remote_protocol.h| 28 ++ src/remote/remote_protocol.x| 21 + src/remote_protocol-structs |5 src/test/test_driver.c |1 src/uml/uml_driver.c| 76 + src/util/virterror.c|3 src/vbox/vbox_tmpl.c|1 src/xen/xen_driver.c| 58 src/xenapi/xenapi_driver.c |1 tools/Makefile.am |1 tools/console.c | 330 +++-- tools/console.h |2 tools/virsh.c | 76 + 36 files changed, 1712 insertions(+), 463 deletions(-) Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 10/10] Wire up virDomainOpenConsole for LXC, Xen and UML
* src/lxc/lxc_driver.c, src/lxc/lxc_driver.c, src/xen/xen_driver.c: Wire up virDomainOpenConsole --- src/lxc/lxc_driver.c | 67 ++- src/uml/uml_driver.c | 77 ++ src/xen/xen_driver.c | 59 +- 3 files changed, 195 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 48a38d1..f0d16a7 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -51,6 +51,7 @@ #include uuid.h #include stats_linux.h #include hooks.h +#include fdstream.h #define VIR_FROM_THIS VIR_FROM_LXC @@ -2738,6 +2739,70 @@ cleanup: return ret; } +static int +lxcDomainOpenConsole(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags) +{ +lxc_driver_t *driver = dom-conn-privateData; +virDomainObjPtr vm = NULL; +char uuidstr[VIR_UUID_STRING_BUFLEN]; +int ret = -1; +virDomainChrDefPtr chr = NULL; + +virCheckFlags(0, -1); + +lxcDriverLock(driver); +virUUIDFormat(dom-uuid, uuidstr); +vm = virDomainFindByUUID(driver-domains, dom-uuid); +if (!vm) { +lxcError(VIR_ERR_NO_DOMAIN, + _(no domain with matching uuid '%s'), uuidstr); +goto cleanup; +} + +if (!virDomainObjIsActive(vm)) { +lxcError(VIR_ERR_OPERATION_INVALID, + %s, _(domain is not running)); +goto cleanup; +} + +if (devname) { +/* XXX support device aliases in future */ +lxcError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Named device aliases are not supported)); +goto cleanup; +} else { +if (vm-def-console) +chr = vm-def-console; +else if (vm-def-nserials) +chr = vm-def-serials[0]; +} + +if (!chr) { +lxcError(VIR_ERR_INTERNAL_ERROR, %s, + _(cannot find default console device)); +goto cleanup; +} + +if (chr-type != VIR_DOMAIN_CHR_TYPE_PTY) { +lxcError(VIR_ERR_INTERNAL_ERROR, + _(character device %s is not using a PTY), devname); +goto cleanup; +} + +if (virFDStreamOpenFile(st, chr-data.file.path, O_RDWR) 0) +goto cleanup; + +ret = 0; +cleanup: +if (vm) +virDomainObjUnlock(vm); +lxcDriverUnlock(driver); +return ret; +} + /* Function Tables */ static virDriver lxcDriver = { @@ -2844,7 +2909,7 @@ static virDriver lxcDriver = { NULL, /* qemuDomainMonitorCommand */ lxcDomainSetMemoryParameters, /* domainSetMemoryParameters */ lxcDomainGetMemoryParameters, /* domainGetMemoryParameters */ -NULL, /* domainOpenConsole */ +lxcDomainOpenConsole, /* domainOpenConsole */ }; static virStateDriver lxcStateDriver = { diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index e0bb4e5..e54db3d 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -59,6 +59,7 @@ #include datatypes.h #include logging.h #include domain_nwfilter.h +#include fdstream.h #define VIR_FROM_THIS VIR_FROM_UML @@ -2025,11 +2026,11 @@ cleanup: static int -umlDomainBlockPeek (virDomainPtr dom, - const char *path, - unsigned long long offset, size_t size, - void *buffer, - unsigned int flags ATTRIBUTE_UNUSED) +umlDomainBlockPeek(virDomainPtr dom, + const char *path, + unsigned long long offset, size_t size, + void *buffer, + unsigned int flags ATTRIBUTE_UNUSED) { struct uml_driver *driver = dom-conn-privateData; virDomainObjPtr vm; @@ -2095,6 +2096,70 @@ cleanup: } +static int +umlDomainOpenConsole(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags) +{ +struct uml_driver *driver = dom-conn-privateData; +virDomainObjPtr vm = NULL; +char uuidstr[VIR_UUID_STRING_BUFLEN]; +int ret = -1; +virDomainChrDefPtr chr = NULL; + +virCheckFlags(0, -1); + +umlDriverLock(driver); +virUUIDFormat(dom-uuid, uuidstr); +vm = virDomainFindByUUID(driver-domains, dom-uuid); +if (!vm) { +umlReportError(VIR_ERR_NO_DOMAIN, + _(no domain with matching uuid '%s'), uuidstr); +goto cleanup; +} + +if (!virDomainObjIsActive(vm)) { +umlReportError(VIR_ERR_OPERATION_INVALID, +%s, _(domain is not running)); +goto cleanup; +} + +if (devname) { +/* XXX support device aliases in future */ +umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Named device aliases are not supported)); +goto cleanup; +} else { +if (vm-def-console) +chr = vm-def-console; +else if
[libvirt] [PATCH 03/10] Introduce a virDomainOpenConsole API
To enable virsh console (or equivalent) to be used remotely it is necessary to provide remote access to the /dev/pts/XXX pseudo-TTY associated with the console/serial/parallel device in the guest. The virStream API provide a bi-directional I/O stream capability that can be used for this purpose. This patch thus introduces a virDomainOpenConsole API that uses the stream APIs. * src/libvirt.c, src/libvirt_public.syms, include/libvirt/libvirt.h.in, src/driver.h: Define the new virDomainOpenConsole API * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_driver.c, src/phyp/phyp_driver.c, src/qemu/qemu_driver.c, src/remote/remote_driver.c, src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub API entry point --- include/libvirt/libvirt.h.in |6 src/driver.h |6 src/esx/esx_driver.c |1 + src/libvirt.c| 53 ++ src/libvirt_public.syms |1 + src/lxc/lxc_driver.c |4 +++ src/opennebula/one_driver.c |1 + src/openvz/openvz_driver.c |1 + src/phyp/phyp_driver.c |1 + src/qemu/qemu_driver.c |1 + src/remote/remote_driver.c |1 + src/test/test_driver.c |1 + src/uml/uml_driver.c |1 + src/vbox/vbox_tmpl.c |1 + src/xen/xen_driver.c |1 + src/xenapi/xenapi_driver.c |1 + 16 files changed, 81 insertions(+), 0 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 81db3a2..cc82e5c 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -2400,6 +2400,12 @@ int virNWFilterGetUUIDString (virNWFilterPtr nwfilter, char * virNWFilterGetXMLDesc(virNWFilterPtr nwfilter, int flags); + +int virDomainOpenConsole(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags); + #ifdef __cplusplus } #endif diff --git a/src/driver.h b/src/driver.h index 79a96c1..6417ee9 100644 --- a/src/driver.h +++ b/src/driver.h @@ -480,6 +480,11 @@ typedef int (*virDrvQemuDomainMonitorCommand)(virDomainPtr domain, const char *cmd, char **result, unsigned int flags); +typedef int +(*virDrvDomainOpenConsole)(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags); /** @@ -598,6 +603,7 @@ struct _virDriver { virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand; virDrvDomainSetMemoryParameters domainSetMemoryParameters; virDrvDomainGetMemoryParameters domainGetMemoryParameters; +virDrvDomainOpenConsole domainOpenConsole; }; typedef int diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index b3e1284..861247f 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -4253,6 +4253,7 @@ static virDriver esxDriver = { NULL,/* qemuDomainMonitorCommand */ NULL,/* domainSetMemoryParameters */ NULL,/* domainGetMemoryParameters */ +NULL,/* domainOpenConsole */ }; diff --git a/src/libvirt.c b/src/libvirt.c index aebd3bc..eb68377 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -13118,3 +13118,56 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot) } return 0; } + +/** + * virDomainOpenConsole: + * @domain: a domain object + * @devname: the console, serial or parallel port device alias, or NULL + * @st: a stream to associate with the console + * @flags: unused, pass 0 + * + * This opens the backend associated with a console, serial or + * parallel port device on a guest, if the backend is supported. + * If the @devname is omitted, then the first console or serial + * device is opened. The console is associated with the passed + * in @st stream, which should have been opened in non-blocking + * mode for bi-directional I/O. + * + * returns 0 if the console was opened, -1 on error + */ +int virDomainOpenConsole(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags) +{ +virConnectPtr conn; +DEBUG(dom=%p devname=%s, st=%p flags=%u, dom, NULLSTR(devname), st, flags); + +virResetLastError(); + +if (!VIR_IS_DOMAIN(dom)) { +virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); +virDispatchError(NULL); +return -1; +} + +conn = dom-conn; +if (conn-flags VIR_CONNECT_RO) { +virLibDomainError(dom, VIR_ERR_OPERATION_DENIED, __FUNCTION__); +goto error; +} + +if
[libvirt] [PATCH 02/10] Support callbacks on virStream APIs in remote driver client
The current remote driver code for streams only supports blocking I/O mode. This is fine for the usage with migration but is a problem for more general use cases, in particular bi-directional streams. This adds supported for the stream callbacks and non-blocking I/O. with the minor caveat is that it doesn't actually do non-blocking I/O for sending stream data, only receiving it. A future patch will try to do non-blocking sends, but this is quite tricky to get right. * src/remote/remote_driver.c: Allow non-blocking I/O for streams and support callbacks --- src/remote/remote_driver.c | 188 1 files changed, 172 insertions(+), 16 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 1c874b2..61da8ff 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -132,6 +132,13 @@ struct private_stream_data { unsigned int serial; unsigned int proc_nr; +virStreamEventCallback cb; +void *cbOpaque; +virFreeCallback cbFree; +int cbEvents; +int cbTimer; +int cbDispatch; + /* XXX this is potentially unbounded if the client * app has domain events registered, since packets * may be read off wire, while app isn't ready to @@ -200,9 +207,10 @@ struct private_data { }; enum { -REMOTE_CALL_IN_OPEN = (1 0), +REMOTE_CALL_IN_OPEN = (1 0), REMOTE_CALL_QUIET_MISSING_RPC = (1 1), -REMOTE_QEMU_CALL = (1 2), +REMOTE_CALL_QEMU = (1 2), +REMOTE_CALL_NONBLOCK = (1 3), }; @@ -8144,6 +8152,20 @@ remoteStreamOpen(virStreamPtr st, } +static void +remoteStreamEventTimerUpdate(struct private_stream_data *privst) +{ +if (!privst-cb) +return; + +if (!privst-cbEvents) +virEventUpdateTimeout(privst-cbTimer, -1); +else if (privst-incoming + (privst-cbEvents VIR_STREAM_EVENT_READABLE)) +virEventUpdateTimeout(privst-cbTimer, 0); +} + + static int remoteStreamPacket(virStreamPtr st, int status, @@ -8338,6 +8360,12 @@ remoteStreamRecv(virStreamPtr st, struct remote_thread_call *thiscall; int ret; +if (st-flags VIR_STREAM_NONBLOCK) { +DEBUG0(Non-blocking mode and no data available); +rv = -2; +goto cleanup; +} + if (VIR_ALLOC(thiscall) 0) { virReportOOMError(); goto cleanup; @@ -8381,6 +8409,8 @@ remoteStreamRecv(virStreamPtr st, rv = 0; } +remoteStreamEventTimerUpdate(privst); + DEBUG(Done %d, rv); cleanup: @@ -8391,28 +8421,153 @@ cleanup: return rv; } + +static void +remoteStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque) +{ +virStreamPtr st = opaque; +struct private_data *priv = st-conn-privateData; +struct private_stream_data *privst = st-privateData; + +remoteDriverLock(priv); +if (privst-cb +(privst-cbEvents VIR_STREAM_EVENT_READABLE) +privst-incomingOffset) { +virStreamEventCallback cb = privst-cb; +void *cbOpaque = privst-cbOpaque; +virFreeCallback cbFree = privst-cbFree; + +privst-cbDispatch = 1; +remoteDriverUnlock(priv); +(cb)(st, VIR_STREAM_EVENT_READABLE, cbOpaque); +remoteDriverLock(priv); +privst-cbDispatch = 0; + +if (!privst-cb cbFree) +(cbFree)(cbOpaque); +} +remoteDriverUnlock(priv); +} + + +static void +remoteStreamEventTimerFree(void *opaque) +{ +virStreamPtr st = opaque; +virUnrefStream(st); +} + + static int -remoteStreamEventAddCallback(virStreamPtr stream ATTRIBUTE_UNUSED, - int events ATTRIBUTE_UNUSED, - virStreamEventCallback cb ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED, - virFreeCallback ff ATTRIBUTE_UNUSED) +remoteStreamEventAddCallback(virStreamPtr st, + int events, + virStreamEventCallback cb, + void *opaque, + virFreeCallback ff) { -return -1; +struct private_data *priv = st-conn-privateData; +struct private_stream_data *privst = st-privateData; +int ret = -1; + +remoteDriverLock(priv); + +if (events ~VIR_STREAM_EVENT_READABLE) { +remoteError(VIR_ERR_INTERNAL_ERROR, +_(unsupported stream events %d), events); +goto cleanup; +} + +if (privst-cb) { +remoteError(VIR_ERR_INTERNAL_ERROR, +_(multiple stream callbacks not supported)); +goto cleanup; +} + +virStreamRef(st); +if ((privst-cbTimer = + virEventAddTimeout(-1, +remoteStreamEventTimer, +st, +remoteStreamEventTimerFree)) 0) { +
[libvirt] [PATCH 04/10] Remote driver client and server for virDomainOpenConsole
This provides an implementation of the virDomainOpenConsole API for the remote driver client and server. * daemon/remote.c: Server side impl * src/remote/remote_driver.c: Client impl * src/remote/remote_protocol.x: Wire definition --- daemon/remote.c | 52 ++ daemon/remote_dispatch_args.h |1 + daemon/remote_dispatch_prototypes.h |8 +++ daemon/remote_dispatch_table.h |5 ++ src/lxc/lxc_driver.c|3 - src/remote/remote_driver.c | 82 +++ src/remote/remote_protocol.c| 13 ++ src/remote/remote_protocol.h| 10 src/remote/remote_protocol.x|9 +++- src/remote_protocol-structs |5 ++ 10 files changed, 165 insertions(+), 23 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 886d53d..c3e6c3a 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -6906,6 +6906,58 @@ qemuDispatchMonitorCommand (struct qemud_server *server ATTRIBUTE_UNUSED, } +static int +remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED, +struct qemud_client *client, +virConnectPtr conn, +remote_message_header *hdr, +remote_error *rerr, +remote_domain_open_console_args *args, +void *ret ATTRIBUTE_UNUSED) +{ +int r; +struct qemud_client_stream *stream; +virDomainPtr dom; + +CHECK_CONN (client); + +dom = get_nonnull_domain (conn, args-domain); +if (dom == NULL) { +remoteDispatchConnError(rerr, conn); +return -1; +} + +stream = remoteCreateClientStream(conn, hdr); +if (!stream) { +virDomainFree(dom); +remoteDispatchOOMError(rerr); +return -1; +} + +r = virDomainOpenConsole(dom, + args-devname ? *args-devname : NULL, + stream-st, + args-flags); +if (r == -1) { +virDomainFree(dom); +remoteFreeClientStream(client, stream); +remoteDispatchConnError(rerr, conn); +return -1; +} + +if (remoteAddClientStream(client, stream, 1) 0) { +virDomainFree(dom); +remoteDispatchConnError(rerr, conn); +virStreamAbort(stream-st); +remoteFreeClientStream(client, stream); +return -1; +} + +virDomainFree(dom); +return 0; +} + + /*- Helpers. -*/ /* get_nonnull_domain and get_nonnull_network turn an on-wire diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index 9583e9c..971af80 100644 --- a/daemon/remote_dispatch_args.h +++ b/daemon/remote_dispatch_args.h @@ -169,3 +169,4 @@ remote_domain_get_memory_parameters_args val_remote_domain_get_memory_parameters_args; remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args; remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args; +remote_domain_open_console_args val_remote_domain_open_console_args; diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index 6b35851..15c7ec7 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -466,6 +466,14 @@ static int remoteDispatchDomainMigrateSetMaxDowntime( remote_error *err, remote_domain_migrate_set_max_downtime_args *args, void *ret); +static int remoteDispatchDomainOpenConsole( +struct qemud_server *server, +struct qemud_client *client, +virConnectPtr conn, +remote_message_header *hdr, +remote_error *err, +remote_domain_open_console_args *args, +void *ret); static int remoteDispatchDomainPinVcpu( struct qemud_server *server, struct qemud_client *client, diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index dd2adc7..4cfa1b1 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -1007,3 +1007,8 @@ .args_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args, .ret_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret, }, +{ /* DomainOpenConsole = 201 */ +.fn = (dispatch_fn) remoteDispatchDomainOpenConsole, +.args_filter = (xdrproc_t) xdr_remote_domain_open_console_args, +.ret_filter = (xdrproc_t) xdr_void, +}, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index b36d8d8..48a38d1 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2842,12 +2842,9 @@ static virDriver lxcDriver = { NULL, /* domainRevertToSnapshot */ NULL, /* domainSnapshotDelete */ NULL, /* qemuDomainMonitorCommand */ - HEAD lxcDomainSetMemoryParameters, /* domainSetMemoryParameters */ lxcDomainGetMemoryParameters, /* domainGetMemoryParameters */ -=== NULL, /* domainOpenConsole */ -
[libvirt] [PATCH 06/10] Add a generic internal API for handling any FD based stream
To avoid the need for duplicating implementations of virStream drivers, provide a generic implementation that can handle any FD based stream. This code is copied from the existing impl in the QEMU driver, with the locking moved into the stream impl, and addition of a read callback The FD stream code will refuse to operate on regular files or block devices, since those can't report EAGAIN properly when they would block on I/O * include/libvirt/virterror.h, include/libvirt/virterror.h: Add VIR_FROM_STREAM error domain * src/qemu/qemu_driver.c: Remove code obsoleted by the new generic streams driver. * src/fdstream.h, src/fdstream.c, src/fdstream.c, src/libvirt_private.syms: Generic reusable FD based streams --- include/libvirt/virterror.h |3 +- src/Makefile.am |1 + src/fdstream.c | 472 +++ src/fdstream.h | 44 src/libvirt_private.syms|7 + src/qemu/qemu_driver.c | 284 +- src/util/virterror.c|3 + 7 files changed, 534 insertions(+), 280 deletions(-) create mode 100644 src/fdstream.c create mode 100644 src/fdstream.h diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 94d686c..abf6945 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -73,7 +73,8 @@ typedef enum { VIR_FROM_NWFILTER, /* Error from network filter driver */ VIR_FROM_HOOK, /* Error from Synchronous hooks */ VIR_FROM_DOMAIN_SNAPSHOT, /* Error from domain snapshot */ -VIR_FROM_AUDIT /* Error from auditing subsystem */ +VIR_FROM_AUDIT, /* Error from auditing subsystem */ +VIR_FROM_STREAMS, /* Error from I/O streams */ } virErrorDomain; diff --git a/src/Makefile.am b/src/Makefile.am index 4a11c37..2022b85 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -94,6 +94,7 @@ DRIVER_SOURCES = \ driver.c driver.h \ internal.h \ datatypes.c datatypes.h \ + fdstream.c fdstream.h \ $(NODE_INFO_SOURCES)\ libvirt.c libvirt_internal.h diff --git a/src/fdstream.c b/src/fdstream.c new file mode 100644 index 000..1ad2454 --- /dev/null +++ b/src/fdstream.c @@ -0,0 +1,472 @@ +/* + * fdstream.h: generic streams impl for file descriptors + * + * Copyright (C) 2009-2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include config.h + +#include sys/types.h +#include sys/stat.h +#include fcntl.h +#include unistd.h +#include sys/socket.h +#include sys/un.h +#include netinet/in.h +#include netinet/tcp.h + +#include fdstream.h +#include virterror_internal.h +#include datatypes.h +#include memory.h +#include event.h +#include util.h + +#define VIR_FROM_THIS VIR_FROM_STREAMS +#define streamsReportError(code, ...)\ +virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__,\ + __FUNCTION__, __LINE__, __VA_ARGS__) + +/* Tunnelled migration stream support */ +struct virFDStreamData { +int fd; + +int watch; +unsigned int cbRemoved; +unsigned int dispatching; +virStreamEventCallback cb; +void *opaque; +virFreeCallback ff; + +virMutex lock; +}; + +static int virFDStreamRemoveCallback(virStreamPtr stream) +{ +struct virFDStreamData *fdst = stream-privateData; +int ret = -1; + +if (!fdst) { +streamsReportError(VIR_ERR_INTERNAL_ERROR, + %s, _(stream is not open)); +return -1; +} + +virMutexLock(fdst-lock); +if (fdst-watch == 0) { +streamsReportError(VIR_ERR_INTERNAL_ERROR, + %s, _(stream does not have a callback registered)); +goto cleanup; +} + +virEventRemoveHandle(fdst-watch); +if (fdst-dispatching) +fdst-cbRemoved = 1; +else if (fdst-ff) +(fdst-ff)(fdst-opaque); + +fdst-watch = 0; +fdst-ff = NULL; +fdst-cb = NULL; +fdst-opaque = NULL; + +ret = 0; + +cleanup: +
[libvirt] [PATCH 07/10] Support virDomainOpenConsole with QEMU
This provides an implementation of the virDomainOpenConsole API with the QEMU driver. For the streams code, this reuses most of the code previously added for the tunnelled migration streams since it is generic. * src/qemu/qemu_driver.c: Support virDomainOpenConsole --- src/qemu/qemu_driver.c | 76 +++- 1 files changed, 75 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2c07ac7..022b8e9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12977,6 +12977,80 @@ cleanup: return ret; } + +static int +qemuDomainOpenConsole(virDomainPtr dom, + const char *devname, + virStreamPtr st, + unsigned int flags) +{ +struct qemud_driver *driver = dom-conn-privateData; +virDomainObjPtr vm = NULL; +char uuidstr[VIR_UUID_STRING_BUFLEN]; +int ret = -1; +int i; +virDomainChrDefPtr chr = NULL; + +virCheckFlags(0, -1); + +qemuDriverLock(driver); +virUUIDFormat(dom-uuid, uuidstr); +vm = virDomainFindByUUID(driver-domains, dom-uuid); +if (!vm) { +qemuReportError(VIR_ERR_NO_DOMAIN, +_(no domain with matching uuid '%s'), uuidstr); +goto cleanup; +} + +if (!virDomainObjIsActive(vm)) { +qemuReportError(VIR_ERR_OPERATION_INVALID, +%s, _(domain is not running)); +goto cleanup; +} + +if (devname) { +if (vm-def-console +STREQ(devname, vm-def-console-info.alias)) +chr = vm-def-console; +for (i = 0 ; !chr i vm-def-nserials ; i++) { +if (STREQ(devname, vm-def-serials[i]-info.alias)) +chr = vm-def-serials[i]; +} +for (i = 0 ; !chr i vm-def-nparallels ; i++) { +if (STREQ(devname, vm-def-parallels[i]-info.alias)) +chr = vm-def-parallels[i]; +} +} else { +if (vm-def-console) +chr = vm-def-console; +else if (vm-def-nserials) +chr = vm-def-serials[0]; +} + +if (!chr) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(cannot find character device %s), devname); +goto cleanup; +} + +if (chr-type != VIR_DOMAIN_CHR_TYPE_PTY) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(character device %s is not using a PTY), devname); +goto cleanup; +} + +if (virFDStreamOpenFile(st, chr-data.file.path, O_RDWR) 0) +goto cleanup; + +ret = 0; +cleanup: +if (vm) +virDomainObjUnlock(vm); +qemuDriverUnlock(driver); +return ret; +} + + static virDriver qemuDriver = { VIR_DRV_QEMU, QEMU, @@ -13081,7 +13155,7 @@ static virDriver qemuDriver = { qemuDomainMonitorCommand, /* qemuDomainMonitorCommand */ qemuDomainSetMemoryParameters, /* domainSetMemoryParameters */ qemuDomainGetMemoryParameters, /* domainGetMemoryParameters */ -NULL, /* domainOpenConsole */ +qemuDomainOpenConsole, /* domainOpenConsole */ }; -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 09/10] Fix busy-wait loop on closed file descriptor
When closing open streams after a client quits, the event callback was not removed. This mean that poll() was using a closed FD and returning POLLNVAL in a busy-wait loop. * daemon/stream.c: Disconnect stream callbacks --- daemon/stream.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/daemon/stream.c b/daemon/stream.c index d64fe73..cac54ea 100644 --- a/daemon/stream.c +++ b/daemon/stream.c @@ -108,6 +108,7 @@ remoteStreamEvent(virStreamPtr st, int events, void *opaque) remote_error rerr; memset(rerr, 0, sizeof rerr); stream-closed = 1; +virStreamEventRemoveCallback(stream-st); virStreamAbort(stream-st); if (events VIR_STREAM_EVENT_HANGUP) remoteDispatchFormatError(rerr, %s, _(stream had unexpected termination)); @@ -345,8 +346,10 @@ remoteRemoveClientStream(struct qemud_client *client, } } -if (!stream-closed) +if (!stream-closed) { +virStreamEventRemoveCallback(stream-st); virStreamAbort(stream-st); +} while (curr) { if (curr == stream) { @@ -429,6 +432,7 @@ remoteStreamHandleFinish(struct qemud_client *client, memset(rerr, 0, sizeof rerr); stream-closed = 1; +virStreamEventRemoveCallback(stream-st); ret = virStreamFinish(stream-st); if (ret 0) { @@ -462,6 +466,7 @@ remoteStreamHandleAbort(struct qemud_client *client, memset(rerr, 0, sizeof rerr); stream-closed = 1; +virStreamEventRemoveCallback(stream-st); virStreamAbort(stream-st); if (msg-hdr.status == REMOTE_ERROR) -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 05/10] Lower logging level in remote driver streams
Now that bi-directional, non-blocking streams are supported in the remote driver, some of the VIR_WARN statements need to be reduced to VIR_DEBUG. * src/remote/remote_driver.c: Lower logging level --- src/remote/remote_driver.c | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 57aec96..0ec8c39 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8273,7 +8273,7 @@ remoteStreamHasError(virStreamPtr st) { return 0; } -VIR_WARN0(Raising async error); +VIR_DEBUG0(Raising async error); virRaiseErrorFull(st-conn, __FILE__, __FUNCTION__, __LINE__, privst-err.domain, @@ -9893,8 +9893,8 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, privst = privst-next; if (!privst) { -VIR_WARN(No registered stream matching serial=%d, proc=%d, - hdr-serial, hdr-proc); +VIR_DEBUG(No registered stream matching serial=%d, proc=%d, + hdr-serial, hdr-proc); return -1; } @@ -9913,7 +9913,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, case REMOTE_CONTINUE: { int avail = privst-incomingLength - privst-incomingOffset; int need = priv-bufferLength - priv-bufferOffset; -VIR_WARN0(Got a stream data packet); +VIR_DEBUG0(Got a stream data packet); /* XXX flag stream as complete somwhere if need==0 */ @@ -9921,7 +9921,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, int extra = need - avail; if (VIR_REALLOC_N(privst-incoming, privst-incomingLength + extra) 0) { -VIR_WARN0(Out of memory); +VIR_DEBUG0(Out of memory handling stream data); return -1; } privst-incomingLength += extra; @@ -9933,19 +9933,19 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, privst-incomingOffset += (priv-bufferLength - priv-bufferOffset); if (thecall thecall-want_reply) { -VIR_WARN(Got sync data packet offset=%d, privst-incomingOffset); +VIR_DEBUG(Got sync data packet offset=%d, privst-incomingOffset); thecall-mode = REMOTE_MODE_COMPLETE; } else { -VIR_WARN(Got aysnc data packet offset=%d, privst-incomingOffset); +VIR_DEBUG(Got aysnc data packet offset=%d, privst-incomingOffset); remoteStreamEventTimerUpdate(privst); } return 0; } case REMOTE_OK: -VIR_WARN0(Got a synchronous confirm); +VIR_DEBUG0(Got a synchronous confirm); if (!thecall) { -VIR_WARN0(Got unexpected stream finish confirmation); +VIR_DEBUG0(Got unexpected stream finish confirmation); return -1; } thecall-mode = REMOTE_MODE_COMPLETE; @@ -9953,7 +9953,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, case REMOTE_ERROR: if (thecall thecall-want_reply) { -VIR_WARN0(Got a synchronous error); +VIR_DEBUG0(Got a synchronous error); /* Give the error straight to this call */ memset (thecall-err, 0, sizeof thecall-err); if (!xdr_remote_error (xdr, thecall-err)) { @@ -9962,16 +9962,16 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED, } thecall-mode = REMOTE_MODE_ERROR; } else { -VIR_WARN0(Got a asynchronous error); +VIR_DEBUG0(Got a asynchronous error); /* No call, so queue the error against the stream */ if (privst-has_error) { -VIR_WARN0(Got unexpected duplicate stream error); +VIR_DEBUG0(Got unexpected duplicate stream error); return -1; } privst-has_error = 1; memset (privst-err, 0, sizeof privst-err); if (!xdr_remote_error (xdr, privst-err)) { -VIR_WARN0(Failed to unmarshall error); +VIR_DEBUG0(Failed to unmarshall error); return -1; } } -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] qemu: add the USB devices to the cgroup whitelist
On 11/01/2010 08:29 AM, Daniel P. Berrange wrote: On Mon, Nov 01, 2010 at 12:03:16PM +0100, Diego Elio Pettenò wrote: Make sure that the QEmu process within the cgroup can access the device file for the USB device that has to be connected to the virtual domain. --- src/qemu/qemu_driver.c | 55 1 files changed, 55 insertions(+), 0 deletions(-) ACK, looks fine now. Pushed, as well as the emace directive file. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] xen: work with ia64 MAX_VIRT_CPUS of 64
On Fri, Oct 29, 2010 at 11:19:50AM -0600, Eric Blake wrote: diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 974e96b..614c036 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -5770,10 +5770,11 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferVSprintf(buf, (memory %lu)(maxmem %lu), def-mem.cur_balloon/1024, def-mem.max_balloon/1024); virBufferVSprintf(buf, (vcpus %u), def-maxvcpus); -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */ -verify(MAX_VIRT_CPUS = sizeof(1U) * CHAR_BIT); +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus) -virBufferVSprintf(buf, (vcpu_avail %u), (1U def-vcpus) - 1); +virBufferVSprintf(buf, (vcpu_avail %lu), (1UL def-vcpus) - 1); if (def-cpumask) { char *ranges = virDomainCpuSetFormat(def-cpumask, def-cpumasklen); This chunk causes a compile error for me CC libvirt_driver_xen_la-xend_internal.lo cc1: warnings being treated as errors xen/xend_internal.c: In function 'xenDaemonFormatSxpr': xen/xend_internal.c:5775: error: nested extern declaration of 'verify_function2' [-Wnested-externs] make[3]: *** [libvirt_driver_xen_la-xend_internal.lo] Error 1 Also, what was commited, looks different to this diff here @@ -5770,9 +5770,11 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferVSprintf(buf, (memory %lu)(maxmem %lu), def-mem.cur_balloon/1024, def-mem.max_balloon/1024); virBufferVSprintf(buf, (vcpus %u), def-maxvcpus); -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */ +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus) -virBufferVSprintf(buf, (vcpu_avail %u), (1U def-vcpus) - 1); +virBufferVSprintf(buf, (vcpu_avail %lu), (1UL def-vcpus) - 1); if (def-cpumask) { char *ranges = virDomainCpuSetFormat(def-cpumask, def-cpumasklen); eg, main GIT repo didn't have any existing use of 'verify' removed, whereas your patch did ?!?!? diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index f80e252..6c5df0f 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -2336,10 +2336,11 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus) 0) goto no_memory; -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */ -verify(MAX_VIRT_CPUS = sizeof(1U) * CHAR_BIT); +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus -xenXMConfigSetInt(conf, vcpu_avail, (1U def-vcpus) - 1) 0) +xenXMConfigSetInt(conf, vcpu_avail, (1UL def-vcpus) - 1) 0) goto no_memory; if ((def-cpumask != NULL) The same with this chunk Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 08/10] Re-write virsh console to use streams
This re-writes the 'virsh console' command so that it uses the new streams API. This lets it run remotely and/or as a non-root user. This requires that virsh be linked against the simple event loop from libvirtd in daemon/event.c As an added bonus, it can now connect to any console device, not just the first one. * tools/Makefile.am: Link to event.c * tools/console.c, tools/console.h: Rewrite to use the virDomainOpenConsole() APIs with streams * tools/virsh.c: Support choosing the console name via --devname $NAME --- .x-sc_avoid_write |1 + tools/Makefile.am |1 + tools/console.c | 330 - tools/console.h |2 +- tools/virsh.c | 76 - 5 files changed, 275 insertions(+), 135 deletions(-) diff --git a/.x-sc_avoid_write b/.x-sc_avoid_write index 1f893b8..7bb8078 100644 --- a/.x-sc_avoid_write +++ b/.x-sc_avoid_write @@ -5,3 +5,4 @@ ^src/xen/xend_internal\.c$ ^daemon/libvirtd.c$ ^gnulib/ +^tools/console.c$ diff --git a/tools/Makefile.am b/tools/Makefile.am index bfe4455..f6f19bd 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -38,6 +38,7 @@ virt-pki-validate.1: virt-pki-validate virsh_SOURCES =\ console.c console.h \ + ../daemon/event.c ../daemon/event.h \ virsh.c virsh_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS) diff --git a/tools/console.c b/tools/console.c index 60e62e2..d003ab4 100644 --- a/tools/console.c +++ b/tools/console.c @@ -34,15 +34,41 @@ # include errno.h # include unistd.h # include signal.h +# include stdbool.h -# include console.h # include internal.h +# include console.h # include logging.h # include util.h +# include memory.h +# include virterror_internal.h + +# include daemon/event.h /* ie Ctrl-] as per telnet */ # define CTRL_CLOSE_BRACKET '\35' +# define VIR_FROM_THIS VIR_FROM_NONE + +struct virConsoleBuffer { +size_t length; +size_t offset; +char *data; +}; + +typedef struct virConsole virConsole; +typedef virConsole *virConsolePtr; +struct virConsole { +virStreamPtr st; +bool quit; + +int stdinWatch; +int stdoutWatch; + +struct virConsoleBuffer streamToTerminal; +struct virConsoleBuffer terminalToStream; +}; + static int got_signal = 0; static void do_signal(int sig ATTRIBUTE_UNUSED) { got_signal = 1; @@ -61,22 +87,191 @@ cfmakeraw (struct termios *attr) } # endif /* !HAVE_CFMAKERAW */ -int vshRunConsole(const char *tty) { -int ttyfd, ret = -1; +static void +virConsoleEventOnStream(virStreamPtr st, +int events, void *opaque) +{ +virConsolePtr con = opaque; + +if (events VIR_STREAM_EVENT_READABLE) { +size_t avail = con-streamToTerminal.length - +con-streamToTerminal.offset; +int got; + +if (avail 1024) { +if (VIR_REALLOC_N(con-streamToTerminal.data, + con-streamToTerminal.length + 1024) 0) { +virReportOOMError(); +con-quit = true; +return; +} +con-streamToTerminal.length += 1024; +avail += 1024; +} + +got = virStreamRecv(st, +con-streamToTerminal.data + +con-streamToTerminal.offset, +avail); +if (got == -2) +return; /* blocking */ +if (got = 0) { +con-quit = true; +return; +} +con-streamToTerminal.offset += got; +if (con-streamToTerminal.offset) +virEventUpdateHandleImpl(con-stdoutWatch, + VIR_EVENT_HANDLE_WRITABLE); +} + +if (events VIR_STREAM_EVENT_WRITABLE +con-terminalToStream.offset) { +ssize_t done; +size_t avail; +done = virStreamSend(con-st, + con-terminalToStream.data, + con-terminalToStream.offset); +if (done == -2) +return; /* blocking */ +if (done 0) { +con-quit = true; +return; +} +memmove(con-terminalToStream.data, +con-terminalToStream.data + done, +con-terminalToStream.offset - done); +con-terminalToStream.offset -= done; + +avail = con-terminalToStream.length - con-terminalToStream.offset; +if (avail 1024) { +if (VIR_REALLOC_N(con-terminalToStream.data, + con-terminalToStream.offset + 1024) 0) +{} +con-terminalToStream.length = con-terminalToStream.offset + 1024; +} +} +if (!con-terminalToStream.offset) +virStreamEventUpdateCallback(con-st, + VIR_STREAM_EVENT_READABLE); + +if (events
Re: [libvirt] [PATCH] xen: work with ia64 MAX_VIRT_CPUS of 64
On Mon, Nov 01, 2010 at 10:48:34AM -0600, Eric Blake wrote: On 11/01/2010 10:35 AM, Daniel P. Berrange wrote: On Fri, Oct 29, 2010 at 11:19:50AM -0600, Eric Blake wrote: diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 974e96b..614c036 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -5770,10 +5770,11 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferVSprintf(buf, (memory %lu)(maxmem %lu), def-mem.cur_balloon/1024, def-mem.max_balloon/1024); virBufferVSprintf(buf, (vcpus %u), def-maxvcpus); -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */ -verify(MAX_VIRT_CPUS = sizeof(1U) * CHAR_BIT); +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus) -virBufferVSprintf(buf, (vcpu_avail %u), (1U def-vcpus) - 1); +virBufferVSprintf(buf, (vcpu_avail %lu), (1UL def-vcpus) - 1); if (def-cpumask) { char *ranges = virDomainCpuSetFormat(def-cpumask, def-cpumasklen); This chunk causes a compile error for me CC libvirt_driver_xen_la-xend_internal.lo cc1: warnings being treated as errors xen/xend_internal.c: In function 'xenDaemonFormatSxpr': xen/xend_internal.c:5775: error: nested extern declaration of 'verify_function2' [-Wnested-externs] make[3]: *** [libvirt_driver_xen_la-xend_internal.lo] Error 1 Which version of gcc? This may be a bug in gnulib's verify module. I tested successfully on F13, gcc 4.4.4. It fails on F12 gcc-4.4.3-4.fc12.x86_64, and on F 14 gcc-4.5.0-4.fc14.x86_64 Making it use verify_true() instead, works though Daniel -- |: Red Hat, Engineering, London-o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] SPAM-LOW: Re: Re: Node.GetInfo error
I sometimes get a similar error with git patches from email, if I use Thunderbird to save them. Thunderbird spreads the header information into several lines, so I need to manually adjust that after saving, with a text editor. Maybe that's the problem here too? :) On 02/11/2010, at 3:00 AM, arnaud.champ...@devatom.fr wrote: :S I'm far away from a git expert :S Maybe anyone on the list can help us ? Arnaud From: 黄亮 Sent: Monday, November 01, 2010 2:42 PM To: arnaud.champ...@devatom.fr Subject: Re: Re: Re: SPAM-LOW: Re: Re: Node.GetInfo error Hi Arnaud, I tried GitExtension, but while applying patch, it returns Patch format detection failed. Should I change some settings or is there something not right in the patch file? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-11-01 16:55:51 收件人: 黄亮 抄送: libvir-list@redhat.com 主题: Re: Re: SPAM-LOW: Re: Re: Node.GetInfo error Ok, if you are under windows (like me), use GitExtension (http://sourceforge.net/projects/gitextensions/) It works, not perfect, but it works. Arnaud From: 黄亮 Sent: Monday, November 01, 2010 9:52 AM To: arnaud.champ...@devatom.fr Subject: Re: Re: SPAM-LOW: Re: Re: Node.GetInfo error Hi Arnaud, The NodeInfoStructure you sent to me yesterday works, thank you. I saw your patch file, should I manually apply it to the source code or is there some tools I can use to automatically apply the changes? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-11-01 16:37:17 收件人: 黄亮 抄送: libvir-list 主题: Re: SPAM-LOW: Re: Re: Node.GetInfo error Hi, I think the solution is in the last patches I have send (which are not yet in the git). Have you tried the NodeInfoStructure I have sended yesterday ? Arnaud From: 黄亮 Sent: Monday, November 01, 2010 3:01 AM To: arnaud.champ...@devatom.fr Cc: libvir-list Subject: SPAM-LOW: Re: Re: Node.GetInfo error HI, I tried Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); But IDE shows compilation errors that there is no Error defination in Errors, and Errors.GetLastError() returns int. I made a guess that maybe it was like this: Error err = Errors.SaveLastError(); MessageBox.Show(Get Info error: + err.Message); It can be compiled but err.Message has nothing in it. Did I make a wrong assumption? Regards 2010-11-01 Lancer 发件人: arnaud.champ...@devatom.fr 发送时间: 2010-10-31 16:48:15 收件人: 黄亮 抄送: libvir-list@redhat.com 主题: Re: Node.GetInfo error Ok, at first GetLastError return an Error object. So you should anything like : Errors.Error err = Errors.GetLastError(); MessageBox.Show(err.Message); For the NodeInfo structure, I think the problem is the same that was for DomainInfo, I'll check marshaling. Then respond you with the correct infos. Arnaud PS : can you also put libvirt-l...@redhat.com in copy of your mails, to keep everyone in the loop ? From: 黄亮 Sent: Sunday, October 31, 2010 8:20 AM To: arnaud.champion Subject: Node.GetInfo error Hi, Sorry for disturbing again. But I get error while using Node.GetInfo. Code: NodeInfo aNodeInfo = new NodeInfo(); if (Node.GetInfo(con, aNodeInfo) 0) { //MessageBox.Show(Node Info Error); MessageBox.Show(Errors.GetLastError().ToString()); return 0f; } I'm sure con != IntPtr.Zero. I tried to use Errors.GetLastError(), it returns int. But I don't know what to do with it. So, any suggestions ? Thanks Regards 2010-10-31 Lancer __ Information from ESET Smart Security, version of virus signature database 5577 (20101030) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5580 (20101031) __ The message was checked by ESET Smart Security. http://www.eset.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
Re: [libvirt] [PATCH] xen: work with ia64 MAX_VIRT_CPUS of 64
On 11/01/2010 11:05 AM, Daniel P. Berrange wrote: +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); Which version of gcc? This may be a bug in gnulib's verify module. I tested successfully on F13, gcc 4.4.4. It fails on F12 gcc-4.4.3-4.fc12.x86_64, and on F 14 gcc-4.5.0-4.fc14.x86_64 Making it use verify_true() instead, works though The difference being that verify() is a declaration, while verify_true() is an integer constant expression. OK, I'll prepare the patch along those lines. In the meantime, I'm also seeing a failure when trying to compile in rawhide: xen/xend_internal.c: In function 'xenDaemonFormatSxpr': xen/xend_internal.c:5775:112: error: 'MAX_VIRT_CPUS' undeclared (first use in this function) which was exactly what my patch was supposed to avoid, so I have to figure out how to convince things to work with xen-devel-4.0.1-6.fc15 headers. :( -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/4] Fix handling of errors with disk labelling on NFS
The previous commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090 masked a flaw with handling of errors for NFS disk labels. If you had multiple devices that required labelling, and an disk on root squashing NFS, then when the failure occurred for the NFS file, all further devices would be skipped. The caller would then ignore the error and try to launch the guest anyway, unless there was a stdin_path on NFS. Since NFS error handling was not dealt with in the correct place, this in turn meant that disk hotplug failed with root squashing NFS. All in all a bit of a mess. This tries to clean up the code handling errors closer to the point of occurrance libvirt_private.syms|1 + qemu/qemu_driver.c |3 +-- qemu/qemu_monitor_text.c| 28 +++- security/security_selinux.c | 11 +++ util/storage_file.c | 32 +--- util/storage_file.h |9 + 6 files changed, 62 insertions(+), 22 deletions(-) Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/4] Revert commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090
Commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090 attempted to make QEMU driver ignore the failure to relabel 'stdin_path' if it was on NFS. The actual result was that it ignores *all* failures to label any aspect of the VM, unless stdin_path is non-NULL and is not on NFS. * src/qemu/qemu_driver.c: Treat all relabel failures as terminal --- src/qemu/qemu_driver.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..9945f5d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3876,8 +3876,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, driver-securityDriver-domainSetSecurityAllLabel driver-securityDriver-domainSetSecurityAllLabel(driver-securityDriver, vm, stdin_path) 0) { -if (stdin_path virStorageFileIsSharedFS(stdin_path) != 1) -goto cleanup; +goto cleanup; } /* Ensure no historical cgroup for this VM is lying around bogus -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/4] Treat failure to relabel stdin_path as non-fatal on NFS
NFS does not support file labelling, so ignore this error for stdin_path when on NFS. * src/security/security_selinux.c: Ignore failures on labelling stdin_path on NFS * src/util/storage_file.c, src/util/storage_file.h: Refine virStorageFileIsSharedFS() to allow it to check for a specific FS type. --- src/libvirt_private.syms|1 + src/security/security_selinux.c |9 ++--- src/util/storage_file.c | 32 +--- src/util/storage_file.h |9 + 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cf64bd3..003d1a0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -689,6 +689,7 @@ virStorageFileFormatTypeToString; virStorageFileGetMetadata; virStorageFileGetMetadataFromFD; virStorageFileIsSharedFS; +virStorageFileIsSharedFSType; virStorageFileProbeFormat; virStorageFileProbeFormatFromFD; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index a9dd836..0612ce3 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1023,9 +1023,12 @@ SELinuxSetSecurityAllLabel(virSecurityDriverPtr drv, SELinuxSetFilecon(vm-def-os.initrd, default_content_context) 0) return -1; -if (stdin_path -SELinuxSetFilecon(stdin_path, default_content_context) 0) -return -1; +if (stdin_path) { +if (SELinuxSetFilecon(stdin_path, default_content_context) 0 +virStorageFileIsSharedFSType(stdin_path, + VIR_STORAGE_FILE_SHFS_NFS) != 1) +return -1; +} return 0; } diff --git a/src/util/storage_file.c b/src/util/storage_file.c index 3cd5dbc..0dc9f99 100644 --- a/src/util/storage_file.c +++ b/src/util/storage_file.c @@ -804,7 +804,8 @@ virStorageFileGetMetadata(const char *path, # endif -int virStorageFileIsSharedFS(const char *path) +int virStorageFileIsSharedFSType(const char *path, + int fstypes) { char *dirpath, *p; struct statfs sb; @@ -853,19 +854,36 @@ int virStorageFileIsSharedFS(const char *path) VIR_DEBUG(Check if path %s with FS magic %lld is shared, path, (long long int)sb.f_type); -if (sb.f_type == NFS_SUPER_MAGIC || -sb.f_type == GFS2_MAGIC || -sb.f_type == OCFS2_SUPER_MAGIC || -sb.f_type == AFS_FS_MAGIC) { +if ((fstypes VIR_STORAGE_FILE_SHFS_NFS) +(sb.f_type == NFS_SUPER_MAGIC)) +return 1; + +if ((fstypes VIR_STORAGE_FILE_SHFS_GFS2) +(sb.f_type == GFS2_MAGIC)) +return 1; +if ((fstypes VIR_STORAGE_FILE_SHFS_OCFS) +(sb.f_type == OCFS2_SUPER_MAGIC)) +return 1; +if ((fstypes VIR_STORAGE_FILE_SHFS_AFS) +(sb.f_type == AFS_FS_MAGIC)) return 1; -} return 0; } #else -int virStorageFileIsSharedFS(const char *path ATTRIBUTE_UNUSED) +int virStorageFileIsSharedFSType(const char *path ATTRIBUTE_UNUSED, + int fstypes ATTRIBUTE_UNUSED) { /* XXX implement me :-) */ return 0; } #endif + +int virStorageFileIsSharedFS(const char *path) +{ +return virStorageFileIsSharedFSType(path, +VIR_STORAGE_FILE_SHFS_NFS | +VIR_STORAGE_FILE_SHFS_GFS2 | +VIR_STORAGE_FILE_SHFS_OCFS | +VIR_STORAGE_FILE_SHFS_AFS); +} diff --git a/src/util/storage_file.h b/src/util/storage_file.h index 6853182..ba44111 100644 --- a/src/util/storage_file.h +++ b/src/util/storage_file.h @@ -68,6 +68,15 @@ int virStorageFileGetMetadataFromFD(const char *path, int format, virStorageFileMetadata *meta); +enum { +VIR_STORAGE_FILE_SHFS_NFS = (1 0), +VIR_STORAGE_FILE_SHFS_GFS2 = (1 1), +VIR_STORAGE_FILE_SHFS_OCFS = (1 2), +VIR_STORAGE_FILE_SHFS_AFS = (1 3), +}; + int virStorageFileIsSharedFS(const char *path); +int virStorageFileIsSharedFSType(const char *path, + int fstypes); #endif /* __VIR_STORAGE_FILE_H__ */ -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/4] Ignore open failures when relabelling disk images
NFS in root squash mode may prevent opening disk images to determine backing store. Ignore errors in this scenario. * src/security/security_selinux.c: Ignore open failures on disk images --- src/security/security_selinux.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 0612ce3..edeff10 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -482,7 +482,7 @@ SELinuxSetSecurityImageLabel(virSecurityDriverPtr drv, return virDomainDiskDefForeachPath(disk, allowDiskFormatProbing, - false, + true, SELinuxSetSecurityFileLabel, secdef); } -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/4] Misc error handling fixes in text mode monitor commands
A couple of places in the text monitor were overwriting the 'ret' variable with a = 0 value before success was actually determined. So later error paths would not correctly return the -1 value. The drive_add code was not checking for errors like missing command * src/qemu/qemu_monitor_text.c: Misc error handling fixes --- src/qemu/qemu_monitor_text.c | 28 +++- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index d7e128c..7f15008 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2094,11 +2094,10 @@ int qemuMonitorTextAttachDrive(qemuMonitorPtr mon, } try_command: -ret = virAsprintf(cmd, drive_add %s%.2x:%.2x:%.2x %s, - (tryOldSyntax ? : pci_addr=), - controllerAddr-domain, controllerAddr-bus, - controllerAddr-slot, safe_str); -if (ret == -1) { +if (virAsprintf(cmd, drive_add %s%.2x:%.2x:%.2x %s, +(tryOldSyntax ? : pci_addr=), +controllerAddr-domain, controllerAddr-bus, +controllerAddr-slot, safe_str) 0) { virReportOOMError(); goto cleanup; } @@ -2109,6 +2108,12 @@ try_command: goto cleanup; } +if (strstr(reply, unknown command:)) { +qemuReportError(VIR_ERR_OPERATION_FAILED, %s, +_(drive hotplug is not supported)); +goto cleanup; +} + if (qemudParseDriveAddReply(reply, driveAddr) 0) { if (!tryOldSyntax strstr(reply, invalid char in expression)) { VIR_FREE(reply); @@ -2360,8 +2365,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon, /* 'dummy' here is just a placeholder since there is no PCI * address required when attaching drives to a controller */ -ret = virAsprintf(cmd, drive_add dummy %s, safe_str); -if (ret == -1) { +if (virAsprintf(cmd, drive_add dummy %s, safe_str) 0) { virReportOOMError(); goto cleanup; } @@ -2372,6 +2376,12 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon, goto cleanup; } +if (strstr(reply, unknown command:)) { +qemuReportError(VIR_ERR_OPERATION_FAILED, %s, +_(drive hotplug is not supported)); +goto cleanup; +} + ret = 0; cleanup: @@ -2397,8 +2407,8 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon, return -1; } -ret = virAsprintf(cmd, block_passwd %s%s \%s\, QEMU_DRIVE_HOST_PREFIX, alias, safe_str); -if (ret == -1) { +if (virAsprintf(cmd, block_passwd %s%s \%s\, +QEMU_DRIVE_HOST_PREFIX, alias, safe_str) 0) { virReportOOMError(); goto cleanup; } -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/10] Support callbacks on virStream APIs in remote driver client
On 11/01/2010 10:11 AM, Daniel P. Berrange wrote: The current remote driver code for streams only supports blocking I/O mode. This is fine for the usage with migration but is a problem for more general use cases, in particular bi-directional streams. This adds supported for the stream callbacks and non-blocking I/O. with the minor caveat is that it doesn't actually do non-blocking I/O for sending stream data, only receiving it. A future patch will try to do non-blocking sends, but this is quite tricky to get right. * src/remote/remote_driver.c: Allow non-blocking I/O for streams and support callbacks + +static void +remoteStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque) +{ +virStreamPtr st = opaque; +struct private_data *priv = st-conn-privateData; +struct private_stream_data *privst = st-privateData; + +remoteDriverLock(priv); +if (privst-cb +(privst-cbEvents VIR_STREAM_EVENT_READABLE) +privst-incomingOffset) { +virStreamEventCallback cb = privst-cb; +void *cbOpaque = privst-cbOpaque; +virFreeCallback cbFree = privst-cbFree; + +privst-cbDispatch = 1; +remoteDriverUnlock(priv); +(cb)(st, VIR_STREAM_EVENT_READABLE, cbOpaque); Any reason you aren't using the simpler style? cp(st, ...); But not a show-stopper. Looks good to me, so ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] xen: work with ia64 MAX_VIRT_CPUS of 64
On 11/01/2010 10:48 AM, Eric Blake wrote: cc1: warnings being treated as errors xen/xend_internal.c: In function 'xenDaemonFormatSxpr': xen/xend_internal.c:5775: error: nested extern declaration of 'verify_function2' [-Wnested-externs] make[3]: *** [libvirt_driver_xen_la-xend_internal.lo] Error 1 Which version of gcc? This may be a bug in gnulib's verify module. I tested successfully on F13, gcc 4.4.4. Oops - I found out (the hard way) that --enable-compiler-warnings=error is not the same as --enable-compile-warnings=error. (We only support the latter). Once I fixed my devel build to turn on -Werror, I'm also seeing this failure with my setup (which was to be expected, since Daniel's F12 and F14 tests both failed). -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample
2010/10/30 arnaud.champ...@devatom.fr: Hi, here is a new patch, it add/correct some comments. It also make virDomainInfo marshaling working. It also add a new sample virConnectSetErrorFunc to show usage of virConnectSetErrorFunc, virError struct, virDomainInfo struct. Regards, Arnaud Actually this patch contains 3 independent things: - Add / cleaning comments - New sample virConnectSetErrorFunc - Correct virDomainInfo marshaling Therefore, I'd like to see this split up into 3 separate patches. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 02/10] Add a QXL graphics card type to domain XML schema
* src/qemu_conf.c: Add dummy entry in enumeration * docs/schemas/domain.rng: Add 'qxl' as a type for the video tag * src/domain_conf.c, src/domain_conf.h: Add QXL to video type enumerations --- docs/schemas/domain.rng |1 + src/conf/domain_conf.c |3 ++- src/conf/domain_conf.h |1 + src/qemu/qemu_conf.c|3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index aaf9667..c8beffc 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1163,6 +1163,7 @@ valuevmvga/value valuexen/value valuevbox/value + valueqxl/value /choice /attribute optional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fe93711..8907563 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -243,7 +243,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, cirrus, vmvga, xen, - vbox) + vbox, + qxl) VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST, mouse, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5499f28..78f28d0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -481,6 +481,7 @@ enum virDomainVideoType { VIR_DOMAIN_VIDEO_TYPE_VMVGA, VIR_DOMAIN_VIDEO_TYPE_XEN, VIR_DOMAIN_VIDEO_TYPE_VBOX, +VIR_DOMAIN_VIDEO_TYPE_QXL, VIR_DOMAIN_VIDEO_TYPE_LAST }; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b5c17b5..149dcee 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -92,7 +92,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, cirrus, vmware, , /* no arg needed for xen */ - /* don't support vbox */); + , /* don't support vbox */ + , /* Not implemented QXL yet */); int qemudLoadDriverConfig(struct qemud_driver *driver, const char *filename) { -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 00/10] Core support for SPICE configuration
This wires up the core support for SPICE configuration and QXL graphics devices. It also introduces a syntax for setting password expiry times for VNC/SPICE servers, although this isn't yet supported in upstream QEMU. Also not yet included here is seemless migration of SPICE clients, which is also pending QEMU work. docs/schemas/domain.rng | 66 src/conf/domain_conf.c | 248 +++- src/conf/domain_conf.h | 42 ++ src/esx/esx_vmx.c |6 src/libvirt_private.syms|4 src/opennebula/one_conf.c |4 src/qemu/qemu.conf | 40 ++ src/qemu/qemu_conf.c| 192 +++- src/qemu/qemu_conf.h|6 src/qemu/qemu_driver.c | 67 ++-- src/xen/xend_internal.c | 12 src/xen/xm_internal.c | 12 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args |1 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml | 35 ++ tests/qemuxml2argvtest.c|9 tests/qemuxml2xmltest.c |1 16 files changed, 682 insertions(+), 63 deletions(-) Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 01/10] Fix comment for video tag in domain RNG schema
The comment for the video tag was a cut+paste error duplicating info about the graphics tag * docs/schemas/domain.rng: Fix comment for video tag --- docs/schemas/domain.rng |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a934a77..aaf9667 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1149,10 +1149,8 @@ /element /define !-- - A graphic description, currently in Xen only 2 types are supported: - - sdl with optional display, xauth and fullscreen - - vnc with a required port and optional listen IP address, password - and keymap + A video adapter description, allowing configuration of device + model, number of virtual heads, and video ram size -- define name=video element name=video -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 03/10] Add a graphics type for SPICE protocol
This adds an element graphics type='spice' port='5903' tlsPort='5904' autoport='yes' listen='127.0.0.1'/ This is the bare minimum that should be exposed in the guest config for SPICE. Other parameters are better handled as per host level configuration tunables * docs/schemas/domain.rng: Define the SPICE graphics schema * src/domain_conf.h, src/domain_conf.c: Add parsing and formatting for SPICE graphics config * src/qemu_conf.c: Complain about unsupported graphics types --- docs/schemas/domain.rng | 38 ++ src/conf/domain_conf.c | 80 ++- src/conf/domain_conf.h |9 + src/qemu/qemu_conf.c|2 +- 4 files changed, 127 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index c8beffc..3163257 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1090,6 +1090,44 @@ /group group attribute name=type +valuespice/value + /attribute + optional +attribute name=port + ref name=PortNumber/ +/attribute + /optional + optional +attribute name=tlsPort + ref name=PortNumber/ +/attribute + /optional + optional +attribute name=autoport + choice +valueyes/value +valueno/value + /choice +/attribute + /optional + optional +attribute name=listen + ref name=addrIP/ +/attribute + /optional + optional +attribute name=passwd + text/ +/attribute + /optional + optional +attribute name=keymap + text/ +/attribute + /optional +/group +group + attribute name=type valuerdp/value /attribute optional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8907563..a3ea217 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -259,7 +259,8 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, sdl, vnc, rdp, - desktop) + desktop, + spice) VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST, subsystem, @@ -446,6 +447,12 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: VIR_FREE(def-data.desktop.display); break; + +case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: +VIR_FREE(def-data.spice.listenAddr); +VIR_FREE(def-data.spice.keymap); +VIR_FREE(def-data.spice.passwd); +break; } VIR_FREE(def); @@ -3202,6 +3209,50 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { def-data.desktop.fullscreen = 0; def-data.desktop.display = virXMLPropString(node, display); +} else if (def-type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { +char *port = virXMLPropString(node, port); +char *tlsPort; +char *autoport; + +if (port) { +if (virStrToLong_i(port, NULL, 10, def-data.spice.port) 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(cannot parse spice port %s), port); +VIR_FREE(port); +goto error; +} +VIR_FREE(port); +} else { +def-data.spice.port = 5900; +} + +tlsPort = virXMLPropString(node, tlsPort); +if (tlsPort) { +if (virStrToLong_i(tlsPort, NULL, 10, def-data.spice.tlsPort) 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(cannot parse spice tlsPort %s), tlsPort); +VIR_FREE(tlsPort); +goto error; +} +VIR_FREE(tlsPort); +} else { +def-data.spice.tlsPort = 0; +} + +if ((autoport = virXMLPropString(node, autoport)) != NULL) { +if (STREQ(autoport, yes)) { +if (flags VIR_DOMAIN_XML_INACTIVE) { +def-data.spice.port = 0; +def-data.spice.tlsPort = 0; +} +def-data.spice.autoport = 1; +} +VIR_FREE(autoport); +} + +def-data.spice.listenAddr = virXMLPropString(node, listen); +def-data.spice.passwd = virXMLPropString(node, passwd); +def-data.spice.keymap = virXMLPropString(node, keymap); } cleanup: @@ -6355,6 +6406,33 @@ virDomainGraphicsDefFormat(virBufferPtr buf, break; +case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: +if (def-data.spice.port) +virBufferVSprintf(buf, port='%d', +
[libvirt] [PATCH 07/10] Add SPICE support for QEMU driver configuration file
In common with VNC, the QEMU driver configuration file is used specify the host level TLS certificate location and a default password / listen address * src/qemu/qemu.conf: Add spice_listen, spice_tls, spice_tls_x509_cert_dir spice_password config params * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Parsing of spice config parameters and updating -spice arg generation to use them * tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-rhel6.args, tests/qemuxml2argvtest.c: Expand test case to cover driver level configuration --- src/qemu/qemu.conf | 40 + src/qemu/qemu_conf.c | 62 +++- src/qemu/qemu_conf.h |4 + src/qemu/qemu_driver.c | 15 - .../qemuxml2argv-graphics-spice.args |2 +- tests/qemuxml2argvtest.c |5 ++ 6 files changed, 123 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index e2c581e..f4f965e 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -80,6 +80,46 @@ +# SPICE is configured to listen on 127.0.0.1 by default. +# To make it listen on all public interfaces, uncomment +# this next option. +# +# NB, strong recommendation to enable TLS + x509 certificate +# verification when allowing public access +# +# spice_listen = 0.0.0.0 + + +# Enable use of TLS encryption on the SPICE server. +# +# It is necessary to setup CA and issue a server certificate +# before enabling this. +# +# spice_tls = 1 + + +# Use of TLS requires that x509 certificates be issued. The +# default it to keep them in /etc/pki/libvirt-spice. This directory +# must contain +# +# ca-cert.pem - the CA master certificate +# server-cert.pem - the server certificate signed with ca-cert.pem +# server-key.pem - the server private key +# +# This option allows the certificate directory to be changed +# +# spice_tls_x509_cert_dir = /etc/pki/libvirt-spice + + +# The default SPICE password. This parameter is only used if the +# per-domain XML config does not already provide a password. To +# allow access without passwords, leave this commented out. An +# empty string will still enable passwords, but be rejected by +# QEMU effectively preventing any use of SPICE. Obviously change +# this example here before you set this +# +# spice_password = XYZ12345 + # The default security driver is SELinux. If SELinux is disabled # on the host, then the security driver will automatically disable diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b551b8d..c76893c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -116,6 +116,15 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, return -1; } +if (!(driver-spiceListen = strdup(127.0.0.1))) { +virReportOOMError(); +return -1; +} +if (!(driver-spiceTLSx509certdir = strdup(SYSCONF_DIR /pki/libvirt-spice))) { +virReportOOMError(); +return -1; +} + #if defined HAVE_MNTENT_H defined HAVE_GETMNTENT_R /* For privileged driver, try and find hugepage mount automatically. * Non-privileged driver requires admin to create a dir for the @@ -219,6 +228,43 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, } } +p = virConfGetValue (conf, spice_tls); +CHECK_TYPE (spice_tls, VIR_CONF_LONG); +if (p) driver-spiceTLS = p-l; + +p = virConfGetValue (conf, spice_tls_x509_cert_dir); +CHECK_TYPE (spice_tls_x509_cert_dir, VIR_CONF_STRING); +if (p p-str) { +VIR_FREE(driver-spiceTLSx509certdir); +if (!(driver-spiceTLSx509certdir = strdup(p-str))) { +virReportOOMError(); +virConfFree(conf); +return -1; +} +} + +p = virConfGetValue (conf, spice_listen); +CHECK_TYPE (spice_listen, VIR_CONF_STRING); +if (p p-str) { +VIR_FREE(driver-spiceListen); +if (!(driver-spiceListen = strdup(p-str))) { +virReportOOMError(); +virConfFree(conf); +return -1; +} +} + +p = virConfGetValue (conf, spice_password); +CHECK_TYPE (spice_password, VIR_CONF_STRING); +if (p p-str) { +VIR_FREE(driver-spicePassword); +if (!(driver-spicePassword = strdup(p-str))) { +virReportOOMError(); +virConfFree(conf); +return -1; +} +} + p = virConfGetValue (conf, user); CHECK_TYPE (user, VIR_CONF_STRING); if (!(user = strdup(p p-str ? p-str : QEMU_USER))) { @@ -4959,11 +5005,25 @@ int qemudBuildCommandLine(virConnectPtr conn, virBufferVSprintf(opt, port=%u, def-graphics[0]-data.spice.port); -if (def-graphics[0]-data.spice.tlsPort) +if (driver-spiceTLS def-graphics[0]-data.spice.tlsPort != -1) virBufferVSprintf(opt, ,tls-port=%u, def-graphics[0]-data.spice.tlsPort);
[libvirt] [PATCH 09/10] Support multiple QXL video cards
QEMU crashes burns if you try multiple Cirrus video cards, but QXL copes fine. Adapt QEMU config code to allow multiple QXL video cards * src/qemu/qemu_conf.c: Support multiple QXL video cards --- src/qemu/qemu_conf.c | 64 +-- .../qemuxml2argv-graphics-spice.args |2 +- .../qemuxml2argv-graphics-spice.xml|3 + 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index f0b4296..5b50b27 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -3249,6 +3249,36 @@ error: } +static char * +qemuBuildVideoDevStr(virDomainVideoDefPtr video) +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; +const char *model = qemuVideoTypeToString(video-type); + +if (!model) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +%s, _(invalid video model)); +goto error; +} + +virBufferVSprintf(buf, %s, model); +virBufferVSprintf(buf, ,id=%s, video-info.alias); +if (qemuBuildDeviceAddressStr(buf, video-info) 0) +goto error; + +if (virBufferError(buf)) { +virReportOOMError(); +goto error; +} + +return virBufferContentAndReset(buf); + +error: +virBufferFreeAndReset(buf); +return NULL; +} + + int qemudOpenPCIConfig(virDomainHostdevDefPtr dev) { @@ -5048,13 +5078,7 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } -if (def-nvideos) { -if (def-nvideos 1) { -qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, -%s, _(only one video card is currently supported)); -goto error; -} - +if (def-nvideos 0) { if (qemuCmdFlags QEMUD_CMD_FLAG_VGA) { if (def-videos[0]-type == VIR_DOMAIN_VIDEO_TYPE_XEN) { /* nothing - vga has no effect on Xen pvfb */ @@ -5100,6 +5124,32 @@ int qemudBuildCommandLine(virConnectPtr conn, goto error; } } + +if (def-nvideos 1) { +if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) { +for (i = 1 ; i def-nvideos ; i++) { +char *str; +if (def-videos[i]-type != VIR_DOMAIN_VIDEO_TYPE_QXL) { +qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, +_(video type %s is only valid as primary video card), + virDomainVideoTypeToString(def-videos[0]-type)); +goto error; +} + +ADD_ARG_LIT(-device); + +if (!(str = qemuBuildVideoDevStr(def-videos[i]))) +goto error; + +ADD_ARG(str); +} +} else { +qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, +%s, _(only one video card is currently supported)); +goto error; +} +} + } else { /* If we have -device, then we set -nodefault already */ if (!(qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args index e412fdb..44809b0 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice -vga qxl -device qxl,id=video1,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml index 08dfb26..6fe9a60 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml @@ -25,5 +25,8 @@ video model type='qxl' vram='65536' heads='1'/ /video +video + model type='qxl' vram='65536' heads='1'/ +/video /devices /domain -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 04/10] Implement QEMU/KVM QXL video card support in QEMU driver
This supports the '-vga qxl' parameter in upstream QEMU/KVM which has SPICE support added. This isn't particularly useful until you get the next patch for -spice support. Also note that while the libvirt XML supports multiple video devices, this patch only supports a single one. A later patch can add support for 2nd, 3rd, etc PCI devices for QXL * src/qemu/qemu_conf.h: Flag for QXL support * src/qemu/qemu_conf.c: Probe for '-vga qxl' support and implement it * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args, tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Test case for generating spice args with RHEL6 kvm --- src/qemu/qemu_conf.c | 15 +- src/qemu/qemu_conf.h |1 + .../qemuxml2argv-graphics-spice.args |1 + .../qemuxml2argv-graphics-spice.xml| 27 tests/qemuxml2argvtest.c |4 +++ tests/qemuxml2xmltest.c|1 + 6 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index aa42e04..88a330d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -93,7 +93,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, vmware, , /* no arg needed for xen */ , /* don't support vbox */ - , /* Not implemented QXL yet */); + qxl); int qemudLoadDriverConfig(struct qemud_driver *driver, const char *filename) { @@ -1202,8 +1202,12 @@ static unsigned long long qemudComputeCmdFlags(const char *help, if (strstr(help, readonly=)) flags |= QEMUD_CMD_FLAG_DRIVE_READONLY; } -if (strstr(help, -vga) !strstr(help, -std-vga)) +if (strstr(help, -vga) !strstr(help, -std-vga)) { flags |= QEMUD_CMD_FLAG_VGA; + +if (strstr(help, |qxl)) +flags |= QEMUD_CMD_FLAG_VGA_QXL; +} if (strstr(help, boot=on)) flags |= QEMUD_CMD_FLAG_DRIVE_BOOT; if (strstr(help, serial=s)) @@ -4958,6 +4962,13 @@ int qemudBuildCommandLine(virConnectPtr conn, if (def-videos[0]-type == VIR_DOMAIN_VIDEO_TYPE_XEN) { /* nothing - vga has no effect on Xen pvfb */ } else { +if ((def-videos[0]-type == VIR_DOMAIN_VIDEO_TYPE_QXL) +!(qemuCmdFlags QEMUD_CMD_FLAG_VGA_QXL)) { +qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, +_(This QEMU does not support QXL graphics adapters)); +goto error; +} + const char *vgastr = qemuVideoTypeToString(def-videos[0]-type); if (!vgastr || STREQ(vgastr, )) { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index bbe6887..86f9c8c 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -97,6 +97,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NESTING = (1LL 41), /* -enable-nesting (SVM/VMX) */ QEMUD_CMD_FLAG_NAME_PROCESS = (1LL 42), /* Is -name process= available */ QEMUD_CMD_FLAG_DRIVE_READONLY= (1LL 43), /* -drive readonly=on|off */ +QEMUD_CMD_FLAG_VGA_QXL = (1LL 44), /* The 'qxl' arg for '-vga' */ }; /* Main driver state */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args new file mode 100644 index 000..94cd90e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -0,0 +1 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml new file mode 100644 index 000..031a622 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml @@ -0,0 +1,27 @@ +domain type='qemu' + nameQEMUGuest1/name + uuidc7a5fdbd-edaf-9455-926a-d65c16db1809/uuid + memory219200/memory + currentMemory219200/currentMemory + vcpu1/vcpu + os +type arch='i686' machine='pc'hvm/type +boot dev='hd'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashdestroy/on_crash + devices +emulator/usr/bin/qemu/emulator +disk type='block' device='disk' + source dev='/dev/HostVG/QEMUGuest1'/ + target dev='hda' bus='ide'/ + address type='drive'
[libvirt] [PATCH 05/10] Implement QEMU/KVM support for SPICE graphics
This supports the -spice argument posted for review against the latest upstream QEMU/KVM. This supports the bare minimum config with port, TLS port listen address. The x509 bits are added in a later patch. * src/qemu_conf.c, src/qemu_conf.h: Add SPICE flag. Check for -spice availability. Format -spice arg for command line * qemuhelptest.c: Add SPICE flag * qemuxml2argvdata/qemuxml2argv-graphics-spice.args: Add graphics for spice * qemuxml2argvdata/qemuxml2argv-graphics-spice.xml: Add -spice arg * qemuxml2argvtest.c: Add SPICE flag --- src/qemu/qemu_conf.c | 37 src/qemu/qemu_conf.h |1 + .../qemuxml2argv-graphics-spice.args |2 +- .../qemuxml2argv-graphics-spice.xml|2 + tests/qemuxml2argvtest.c |2 +- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 88a330d..b551b8d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1208,6 +1208,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help, if (strstr(help, |qxl)) flags |= QEMUD_CMD_FLAG_VGA_QXL; } +if (strstr(help, -spice)) +flags |= QEMUD_CMD_FLAG_SPICE; if (strstr(help, boot=on)) flags |= QEMUD_CMD_FLAG_DRIVE_BOOT; if (strstr(help, serial=s)) @@ -4944,6 +4946,41 @@ int qemudBuildCommandLine(virConnectPtr conn, if (qemuCmdFlags QEMUD_CMD_FLAG_SDL) ADD_ARG_LIT(-sdl); +} else if ((def-ngraphics == 1) + def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { +virBuffer opt = VIR_BUFFER_INITIALIZER; +char *optstr; + +if (!(qemuCmdFlags QEMUD_CMD_FLAG_SPICE)) { +qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, +_(spice graphics are not supported with this QEMU)); +goto error; +} + +virBufferVSprintf(opt, port=%u, def-graphics[0]-data.spice.port); + +if (def-graphics[0]-data.spice.tlsPort) +virBufferVSprintf(opt, ,tls-port=%u, def-graphics[0]-data.spice.tlsPort); + +if (def-graphics[0]-data.spice.listenAddr) +virBufferVSprintf(opt, ,addr=%s, def-graphics[0]-data.spice.listenAddr); + +if (virBufferError(opt)) +goto no_memory; + +optstr = virBufferContentAndReset(opt); + +ADD_ARG_LIT(-spice); +ADD_ARG(optstr); +if (def-graphics[0]-data.spice.keymap) { +ADD_ARG_LIT(-k); +ADD_ARG_LIT(def-graphics[0]-data.spice.keymap); +} +/* SPICE includes native support for tunnelling audio, so we + * set the audio backend to point at SPICE's own driver + */ +ADD_ENV_LIT(QEMU_AUDIO_DRV=spice); + } else if ((def-ngraphics == 1)) { qemuReportError(VIR_ERR_INTERNAL_ERROR, _(unsupported graphics type '%s'), diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 86f9c8c..6cfbfe0 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -98,6 +98,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_NAME_PROCESS = (1LL 42), /* Is -name process= available */ QEMUD_CMD_FLAG_DRIVE_READONLY= (1LL 43), /* -drive readonly=on|off */ QEMUD_CMD_FLAG_VGA_QXL = (1LL 44), /* The 'qxl' arg for '-vga' */ +QEMUD_CMD_FLAG_SPICE = (1LL 45), /* Is -spice avail */ }; /* Main driver state */ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args index 94cd90e..8d195e5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1 -vga qxl -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml index 031a622..08dfb26 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml @@ -20,6 +20,8 @@ address type='drive' controller='0' bus='0' unit='0'/ /disk controller type='ide' index='0'/ +input type='mouse' bus='ps2'/ +graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'/ video
[libvirt] [PATCH 06/10] Support automatic port number allocation for SPICE
* src/qemu/qemu_driver.c: Allocate the TCP ports for SPICE before starting guest --- src/qemu/qemu_driver.c | 38 ++ 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..fbb0a68 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2949,10 +2949,12 @@ qemuInitPCIAddresses(struct qemud_driver *driver, return ret; } -static int qemudNextFreeVNCPort(struct qemud_driver *driver) { + +static int qemudNextFreePort(struct qemud_driver *driver, + int startPort) { int i; -for (i = QEMU_VNC_PORT_MIN; i QEMU_VNC_PORT_MAX; i++) { +for (i = startPort ; i 65535 ; i++) { int fd; int reuse = 1; struct sockaddr_in addr; @@ -3885,17 +3887,29 @@ static int qemudStartVMDaemon(virConnectPtr conn, DEBUG0(Ensuring no historical cgroup is lying around); qemuRemoveCgroup(driver, vm, 1); -if ((vm-def-ngraphics == 1) -vm-def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_VNC -vm-def-graphics[0]-data.vnc.autoport) { -DEBUG0(Determining VNC port); -int port = qemudNextFreeVNCPort(driver); -if (port 0) { -qemuReportError(VIR_ERR_INTERNAL_ERROR, -%s, _(Unable to find an unused VNC port)); -goto cleanup; +if (vm-def-ngraphics == 1) { +if (vm-def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_VNC +vm-def-graphics[0]-data.vnc.autoport) { +int port = qemudNextFreePort(driver, 5900); +if (port 0) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +%s, _(Unable to find an unused VNC port)); +goto cleanup; +} +vm-def-graphics[0]-data.vnc.port = port; +} else if (vm-def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE + vm-def-graphics[0]-data.spice.autoport) { +int port = qemudNextFreePort(driver, 5900); +int tlsPort = port == -1 ? -1 : qemudNextFreePort(driver, port + 1); +if (port 0 || tlsPort 0) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +%s, _(Unable to find unused SPICE ports)); +goto cleanup; +} + +vm-def-graphics[0]-data.spice.port = port; +vm-def-graphics[0]-data.spice.tlsPort = tlsPort; } -vm-def-graphics[0]-data.vnc.port = port; } if (virFileMakePath(driver-logDir) != 0) { -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 08/10] Define XML syntax for password expiry
This extends the XML syntax for graphics to allow a password expiry time to be set eg graphics type='vnc' port='5900' autoport='yes' keymap='en-us' passwd='12345' passwdValidTo='2010-04-09T15:51:00'/ The timestamp is in UTC. * src/conf/domain_conf.h: Pull passwd out into separate struct virDomainGraphicsAuthDef to allow sharing between VNC SPICE * src/conf/domain_conf.c: Add parsing/formatting of new passwdValidTo argument * src/opennebula/one_conf.c, src/qemu/qemu_conf.c, src/qemu/qemu_driver.c, src/xen/xend_internal.c, src/xen/xm_internal.c: Update for changed struct containing VNC password --- src/conf/domain_conf.c| 102 +++- src/conf/domain_conf.h| 13 +- src/esx/esx_vmx.c |6 +- src/opennebula/one_conf.c |4 +- src/qemu/qemu_conf.c |4 +- src/qemu/qemu_driver.c| 20 src/xen/xend_internal.c | 12 +++--- src/xen/xm_internal.c | 12 +++--- 8 files changed, 130 insertions(+), 43 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a3ea217..04829e9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -423,6 +423,17 @@ virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms, #endif /* !PROXY */ +static void +virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDefPtr def) +{ +if (!def) +return; + +VIR_FREE(def-passwd); + +/* Don't free def */ +} + void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) { if (!def) @@ -432,7 +443,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) case VIR_DOMAIN_GRAPHICS_TYPE_VNC: VIR_FREE(def-data.vnc.listenAddr); VIR_FREE(def-data.vnc.keymap); -VIR_FREE(def-data.vnc.passwd); +virDomainGraphicsAuthDefClear(def-data.vnc.auth); break; case VIR_DOMAIN_GRAPHICS_TYPE_SDL: @@ -451,7 +462,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: VIR_FREE(def-data.spice.listenAddr); VIR_FREE(def-data.spice.keymap); -VIR_FREE(def-data.spice.passwd); +virDomainGraphicsAuthDefClear(def-data.spice.auth); break; } @@ -3068,6 +3079,56 @@ error: goto cleanup; } + +static int +virDomainGraphicsAuthDefParseXML(xmlNodePtr node, virDomainGraphicsAuthDefPtr def) +{ +char *validTo = NULL; + +def-passwd = virXMLPropString(node, passwd); + +if (!def-passwd) +return 0; + +validTo = virXMLPropString(node, passwdValidTo); +if (validTo) { +char *tmp; +struct tm tm; +memset(tm, 0, sizeof(tm)); +/* Expect: -MM-DDTHH:MM:SS (%d-%d-%dT%d:%d:%d) eg 2010-11-28T14:29:01 */ +if (/* year */ +virStrToLong_i(validTo, tmp, 10, tm.tm_year) 0 || *tmp != '-' || +/* month */ +virStrToLong_i(tmp+1, tmp, 10, tm.tm_mon) 0 || *tmp != '-' || +/* day */ +virStrToLong_i(tmp+1, tmp, 10, tm.tm_mday) 0 || *tmp != 'T' || +/* hour */ +virStrToLong_i(tmp+1, tmp, 10, tm.tm_hour) 0 || *tmp != ':' || +/* minute */ +virStrToLong_i(tmp+1, tmp, 10, tm.tm_min) 0 || *tmp != ':' || +/* second */ +virStrToLong_i(tmp+1, tmp, 10, tm.tm_sec) 0 || *tmp != '\0') { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(cannot parse password validity time '%s', expect -MM-DDTHH:MM:SS), + validTo); +VIR_FREE(validTo); +VIR_FREE(def-passwd); +return -1; +} +VIR_FREE(validTo); + +tm.tm_year -= 1900; /* Human epoch starts at 0 BC, not 1900BC */ +tm.tm_mon--; /* Humans start months at 1, computers at 0 */ + +/* XXX this is broken it needs to be UTC not localtime */ +def-validTo = timegm(tm); +def-expires = 1; +} + +return 0; +} + + /* Parse the XML definition for a graphics device */ static virDomainGraphicsDefPtr virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { @@ -3126,8 +3187,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { } def-data.vnc.listenAddr = virXMLPropString(node, listen); -def-data.vnc.passwd = virXMLPropString(node, passwd); def-data.vnc.keymap = virXMLPropString(node, keymap); + +if (virDomainGraphicsAuthDefParseXML(node, def-data.vnc.auth) 0) +goto error; } else if (def-type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { char *fullscreen = virXMLPropString(node, fullscreen); @@ -3251,8 +3314,9 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { } def-data.spice.listenAddr = virXMLPropString(node, listen); -def-data.spice.passwd = virXMLPropString(node, passwd); def-data.spice.keymap = virXMLPropString(node, keymap); +if
[libvirt] [PATCH 10/10] Support SPICE channel security options
This extends the SPICE XML to allow channel security options graphics type='spice' port='5901' tlsPort='-1' autoport='yes' channel name='main' mode='secure'/ channel name='record' mode='insecure'/ /graphics Any non-specified channel uses the default, which allows both secure insecure usage * src/conf/domain_conf.c, src/conf/domain_conf.h, src/libvirt_private.syms: Add XML syntax for specifying per channel security options for spice;. * src/qemu/qemu_conf.c: Configure channel security with spice --- docs/schemas/domain.rng| 21 ++ src/conf/domain_conf.c | 75 +++- src/conf/domain_conf.h | 21 ++ src/libvirt_private.syms |4 + src/qemu/qemu_conf.c | 13 .../qemuxml2argv-graphics-spice.args |2 +- .../qemuxml2argv-graphics-spice.xml|5 +- 7 files changed, 138 insertions(+), 3 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 3163257..b79aafd 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1087,6 +1087,27 @@ text/ /attribute /optional + zeroOrMore +element name=channel + attribute name=name +choice + valuemain/value + valuedisplay/value + valueinputs/value + valuecursor/value + valueplayback/value + valuerecord/value +/choice + /attribute + attribute name=mode +choice + valueany/value + valuesecure/value + valueinsecure/value +/choice + /attribute +/element + /zeroOrMore /group group attribute name=type diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 04829e9..3655209 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -262,6 +262,21 @@ VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, desktop, spice) +VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName, + VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST, + main, + display, + inputs, + cursor, + playback, + record); + +VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelMode, + VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST, + any, + secure, + insecure); + VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST, subsystem, capabilities) @@ -3273,6 +3288,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { def-data.desktop.display = virXMLPropString(node, display); } else if (def-type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { +xmlNodePtr cur; char *port = virXMLPropString(node, port); char *tlsPort; char *autoport; @@ -3317,6 +,40 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { def-data.spice.keymap = virXMLPropString(node, keymap); if (virDomainGraphicsAuthDefParseXML(node, def-data.vnc.auth) 0) goto error; + +cur = node-children; +while (cur != NULL) { +if (cur-type == XML_ELEMENT_NODE) { +if (xmlStrEqual(cur-name, BAD_CAST channel)) { +const char *name, *mode; +int nameval, modeval; +name = virXMLPropString(cur, name); +mode = virXMLPropString(cur, mode); + +if (!name || !mode) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(spice channel missing name/mode)); +goto error; +} + +if ((nameval = virDomainGraphicsSpiceChannelNameTypeFromString(name)) 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(unknown spice channel name %s), + name); +goto error; +} +if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) 0) { +virDomainReportError(VIR_ERR_INTERNAL_ERROR, + _(unknown spice channel mode %s), + mode); +goto error; +} + +def-data.spice.channels[nameval] = modeval; +} +} +cur = cur-next; +} } cleanup: @@ -6408,6 +6458,8 @@
[libvirt] [PATCH] build: avoid compiler warning in xen code
* src/xen/xend_internal.c (xenDaemonFormatSxpr): Hoist verify outside of function to avoid a -Wnested-externs warning. * src/xen/xm_internal.c (xenXMDomainConfigFormat): Likewise. Reported by Daniel P. Berrange. --- Making it use verify_true() instead, works though Not really, as that then triggers an unused expression warning. But hoisting outside of a function works. I'm pushing this now, under the build-breaker rule, and then focusing on fixing things for the xen 4 headers in a separate patch (as I still don't have that one fixed locally yet). src/xen/xend_internal.c |5 - src/xen/xm_internal.c |5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 614c036..5c3a4bd 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -5744,6 +5744,10 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input, } +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); + /** * xenDaemonFormatSxpr: * @conn: pointer to the hypervisor connection @@ -5772,7 +5776,6 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferVSprintf(buf, (vcpus %u), def-maxvcpus); /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is either 32, or 64 on a platform where long is big enough. */ -verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus) virBufferVSprintf(buf, (vcpu_avail %lu), (1UL def-vcpus) - 1); diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index 6c5df0f..a4d1a30 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -2304,6 +2304,10 @@ error: } +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is + either 32, or 64 on a platform where long is big enough. */ +verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); + virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, virDomainDefPtr def) { virConfPtr conf = NULL; @@ -2338,7 +2342,6 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, goto no_memory; /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is either 32, or 64 on a platform where long is big enough. */ -verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT); if (def-vcpus def-maxvcpus xenXMConfigSetInt(conf, vcpu_avail, (1UL def-vcpus) - 1) 0) goto no_memory; -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/10] Remote driver client and server for virDomainOpenConsole
On 11/01/2010 10:11 AM, Daniel P. Berrange wrote: This provides an implementation of the virDomainOpenConsole API for the remote driver client and server. * daemon/remote.c: Server side impl * src/remote/remote_driver.c: Client impl * src/remote/remote_protocol.x: Wire definition --- daemon/remote.c | 52 ++ daemon/remote_dispatch_args.h |1 + daemon/remote_dispatch_prototypes.h |8 +++ daemon/remote_dispatch_table.h |5 ++ src/lxc/lxc_driver.c|3 - src/remote/remote_driver.c | 82 +++ src/remote/remote_protocol.c| 13 ++ src/remote/remote_protocol.h| 10 src/remote/remote_protocol.x|9 +++- src/remote_protocol-structs |5 ++ +++ b/src/lxc/lxc_driver.c @@ -2842,12 +2842,9 @@ static virDriver lxcDriver = { NULL, /* domainRevertToSnapshot */ NULL, /* domainSnapshotDelete */ NULL, /* qemuDomainMonitorCommand */ - HEAD lxcDomainSetMemoryParameters, /* domainSetMemoryParameters */ lxcDomainGetMemoryParameters, /* domainGetMemoryParameters */ -=== NULL, /* domainOpenConsole */ - Introduce a virDomainOpenConsole API }; This hunk should be floated up into 3/10. ACK with that fixed. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] how to attach PCI/USB device
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello list and its users, as subject suggests, I'm trying to attach PCI/USB devices to Guest(VM). A-and, it doesn't work. But I swear I had it before(somewhat in the beginnings). I'm using virt-managers to add/attach devices. I've failed to attach PCI device, but it does not matter right now. I can attach USB devices, but they are not in VM. I've tried to attach USB HUB as well and what not - nothing. So, could somebody please tell me, how to debug it? Could it be somehow connected with qemu-kvm running 'root-less'? libvirt-0.8.4 and 0.8.5. Thank you all and nice whatever-timezone-you-are-in, Zdenek - -- Zdenek Styblik Net/Linux admin OS TurnovFree.net email: sty...@turnovfree.net jabber: sty...@jabber.turnovfree.net -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzPCuQACgkQ8MreUbSH7imBMACcCW+DQ4lwNmcPiM9kXNjbHIWD o68An3RwjHN98zlQumJsCGbnG5Xie0WB =4ZBd -END PGP SIGNATURE- -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] how to attach PCI/USB device
Il giorno lun, 01/11/2010 alle 19.45 +0100, Zdenek Styblik ha scritto: I'm using virt-managers to add/attach devices. I've failed to attach PCI device, but it does not matter right now. I can attach USB devices, but they are not in VM. I've tried to attach USB HUB as well and what not - nothing. I'd suggest you to try with the current git head. I had had some trouble with this the past week or so: - 0.8.4 has a bug when the bus/device pair has a number 8 (it's loaded as octal by qemu, but passed as decimal by libvirt); - 0.8.5 release will not allow access to the device if cgroups are enabled. Not sure about the PCI stuff sincerely, but at least USB with the current git head works fine for me (finally). -- Diego Elio Pettenò — Flameeyes http://blog.flameeyes.eu/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample
Okay, anyway, I think my patches are not well formatted and/or sometime inconsistent I don't know the well word. Can you explain me what is a good patch, just for make less work for you ? Regards, Arnaud -- From: Matthias Bolte matthias.bo...@googlemail.com Sent: Monday, November 01, 2010 7:15 PM To: arnaud.champ...@devatom.fr Cc: libvir-list@redhat.com Subject: Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample 2010/10/30 arnaud.champ...@devatom.fr: Hi, here is a new patch, it add/correct some comments. It also make virDomainInfo marshaling working. It also add a new sample virConnectSetErrorFunc to show usage of virConnectSetErrorFunc, virError struct, virDomainInfo struct. Regards, Arnaud Actually this patch contains 3 independent things: - Add / cleaning comments - New sample virConnectSetErrorFunc - Correct virDomainInfo marshaling Therefore, I'd like to see this split up into 3 separate patches. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/10] Lower logging level in remote driver streams
On 11/01/2010 10:11 AM, Daniel P. Berrange wrote: Now that bi-directional, non-blocking streams are supported in the remote driver, some of the VIR_WARN statements need to be reduced to VIR_DEBUG. * src/remote/remote_driver.c: Lower logging level --- src/remote/remote_driver.c | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] how to attach PCI/USB device
On 11/01/10 20:18, Diego Elio Pettenò wrote: Il giorno lun, 01/11/2010 alle 19.45 +0100, Zdenek Styblik ha scritto: I'm using virt-managers to add/attach devices. I've failed to attach PCI device, but it does not matter right now. I can attach USB devices, but they are not in VM. I've tried to attach USB HUB as well and what not - nothing. I'd suggest you to try with the current git head. I had had some trouble with this the past week or so: Ok, I'm going to try it tomorrow. - 0.8.5 release will not allow access to the device if cgroups are enabled. I've commented cgroups out in qemu.conf and - it didn't help. :| Not sure about the PCI stuff sincerely, but at least USB with the current git head works fine for me (finally). Zdenek -- Zdenek Styblik Net/Linux admin OS TurnovFree.net email: sty...@turnovfree.net jabber: sty...@jabber.turnovfree.net -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample
Your patches in general are okay, no problem with that. :) It's just that this patch contains 3 independent changes. As a general rule of thumb you should do one thing per commit. This makes things simpler to review and track. Also the Correct virDomainInfo marshaling part could be explained in a bit more details in the commit message. Like try to answer the question: What was wrong with it and how did you fix it? Matthias 2010/11/1 arnaud.champ...@devatom.fr: Okay, anyway, I think my patches are not well formatted and/or sometime inconsistent I don't know the well word. Can you explain me what is a good patch, just for make less work for you ? Regards, Arnaud -- From: Matthias Bolte matthias.bo...@googlemail.com Sent: Monday, November 01, 2010 7:15 PM To: arnaud.champ...@devatom.fr Cc: libvir-list@redhat.com Subject: Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample 2010/10/30 arnaud.champ...@devatom.fr: Hi, here is a new patch, it add/correct some comments. It also make virDomainInfo marshaling working. It also add a new sample virConnectSetErrorFunc to show usage of virConnectSetErrorFunc, virError struct, virDomainInfo struct. Regards, Arnaud Actually this patch contains 3 independent things: - Add / cleaning comments - New sample virConnectSetErrorFunc - Correct virDomainInfo marshaling Therefore, I'd like to see this split up into 3 separate patches. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample
Okay, thanks for explaination, I've always been used to work alone, so I have a lot of things to learn. Regards, Arnaud -- From: Matthias Bolte matthias.bo...@googlemail.com Sent: Monday, November 01, 2010 9:07 PM To: arnaud.champ...@devatom.fr Cc: libvir-list@redhat.com Subject: Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample Your patches in general are okay, no problem with that. :) It's just that this patch contains 3 independent changes. As a general rule of thumb you should do one thing per commit. This makes things simpler to review and track. Also the Correct virDomainInfo marshaling part could be explained in a bit more details in the commit message. Like try to answer the question: What was wrong with it and how did you fix it? Matthias 2010/11/1 arnaud.champ...@devatom.fr: Okay, anyway, I think my patches are not well formatted and/or sometime inconsistent I don't know the well word. Can you explain me what is a good patch, just for make less work for you ? Regards, Arnaud -- From: Matthias Bolte matthias.bo...@googlemail.com Sent: Monday, November 01, 2010 7:15 PM To: arnaud.champ...@devatom.fr Cc: libvir-list@redhat.com Subject: Re: [libvirt] [C# bindings][PATCH] Add/Clean comments and virConnecSetErrorFunc Sample 2010/10/30 arnaud.champ...@devatom.fr: Hi, here is a new patch, it add/correct some comments. It also make virDomainInfo marshaling working. It also add a new sample virConnectSetErrorFunc to show usage of virConnectSetErrorFunc, virError struct, virDomainInfo struct. Regards, Arnaud Actually this patch contains 3 independent things: - Add / cleaning comments - New sample virConnectSetErrorFunc - Correct virDomainInfo marshaling Therefore, I'd like to see this split up into 3 separate patches. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/10] Add a generic internal API for handling any FD based stream
On 11/01/2010 10:12 AM, Daniel P. Berrange wrote: To avoid the need for duplicating implementations of virStream drivers, provide a generic implementation that can handle any FD based stream. This code is copied from the existing impl in the QEMU driver, with the locking moved into the stream impl, and addition of a read callback The FD stream code will refuse to operate on regular files or block devices, since those can't report EAGAIN properly when they would block on I/O * include/libvirt/virterror.h, include/libvirt/virterror.h: Add VIR_FROM_STREAM error domain * src/qemu/qemu_driver.c: Remove code obsoleted by the new generic streams driver. * src/fdstream.h, src/fdstream.c, src/fdstream.c, src/libvirt_private.syms: Generic reusable FD based streams --- include/libvirt/virterror.h |3 +- src/Makefile.am |1 + src/fdstream.c | 472 +++ src/fdstream.h | 44 src/libvirt_private.syms|7 + src/qemu/qemu_driver.c | 284 +- src/util/virterror.c|3 + 7 files changed, 534 insertions(+), 280 deletions(-) create mode 100644 src/fdstream.c create mode 100644 src/fdstream.h diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 94d686c..abf6945 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -73,7 +73,8 @@ typedef enum { VIR_FROM_NWFILTER, /* Error from network filter driver */ VIR_FROM_HOOK, /* Error from Synchronous hooks */ VIR_FROM_DOMAIN_SNAPSHOT, /* Error from domain snapshot */ -VIR_FROM_AUDIT /* Error from auditing subsystem */ +VIR_FROM_AUDIT, /* Error from auditing subsystem */ +VIR_FROM_STREAMS, /* Error from I/O streams */ } virErrorDomain; Is the switch from C89 style (no trailing comma) to the C99 style (optional trailing comma permitted) intentional? Personally, I like it, since adding a new value at the end no longer requires a random-looking diff of the previous entry just to add a comma. A rough heuristic analysis says that we have: $ git grep -l enum -- '*.h' '*.h.in' | xargs sed -n '/enum/,/}/p' \ | grep -B1 } |grep -v -- -- | grep -v } | wc -l 535 535 enum declarations, of which: $ git grep -l enum -- '*.h' '*.h.in' | xargs sed -n '/enum/,/}/p' \ | grep -B1 } |grep -v -- -- | grep -v } | grep , | wc -l 281 at least 281 of them end with a trailing comma (more than half, but not by much). I'm not quite sure how to write a syntax-checker to enforce it, though. At any rate, that's just style (we already require C99 for other reasons, so it doesn't affect the validity of your patch). +++ b/src/fdstream.c +#include config.h + +#include sys/types.h +#include sys/stat.h +#include fcntl.h +#include unistd.h +#include sys/socket.h These are okay, +#include sys/un.h but this is missing on Mingw, with no gnulib replacement as of yet. Do we need to add some HAVE_SYS_UN_H checks? +#include netinet/in.h +#include netinet/tcp.h Likewise for HAVE_NETINET_TCP_H. + +static void virFDStreamEvent(int watch ATTRIBUTE_UNUSED, + int fd ATTRIBUTE_UNUSED, + int events, + void *opaque) +{ +cb(stream, events, cbopaque); + +virMutexLock(fdst-lock); +fdst-dispatching = 0; +if (fdst-cbRemoved ff) +(ff)(cbopaque); Two different function pointer call styles here. +virMutexUnlock(fdst-lock); +} + +static int +virFDStreamAddCallback(virStreamPtr st, + int events, + virStreamEventCallback cb, + void *opaque, + virFreeCallback ff) Spacing is off due to the rename from qemu to vir. + +if ((fdst-watch = virEventAddHandle(fdst-fd, + events, + virFDStreamEvent, + st, + NULL)) 0) { Likewise. + +static void virFDStreamFree(struct virFDStreamData *fdst) +{ +if (fdst-fd != -1) +close(fdst-fd); This should use VIR_FORCE_CLOSE(fdst-fd). +VIR_FREE(fdst); +} + + +static int +virFDStreamClose(virStreamPtr st) +{ +struct virFDStreamData *fdst = st-privateData; + +if (!fdst) +return 0; + +virMutexLock(fdst-lock); + +virFDStreamFree(fdst); Before freeing the stream, should this use VIR_CLOSE(fdst-fd) and return any close failures to the caller? +static int virFDStreamWrite(virStreamPtr st, const char *bytes, size_t nbytes) Should this return ssize_t... +{ +struct virFDStreamData *fdst = st-privateData; +int ret; and s/int/ssize_t/... + +if (!fdst) { +streamsReportError(VIR_ERR_INTERNAL_ERROR, +
[libvirt] [PATCH] docs: fix typo
* docs/drvqemu.html.in (qemu): Fix typo. --- Noticed this while browsing the web; pushing it as obvious. docs/drvqemu.html.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in index ab54133..7230cae 100644 --- a/docs/drvqemu.html.in +++ b/docs/drvqemu.html.in @@ -70,7 +70,7 @@ qemu+ssh://r...@example.com/system (remote access, SSH tunnelled) application. Thus the QEMU instances spawned from this driver will share the same privileges as the client application. The intended use case for this driver is desktop virtualization, with virtual - machines storing their disk imags in the user's home directory and + machines storing their disk images in the user's home directory and being managed from the local desktop login session. /p -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] xen: work with xen 4.0.1 headers
* src/xen/xen_driver.h (includes): Include main xen headers here... * src/xen/xs_internal.c (includes): ...rather than in just one of the sub-drivers. --- I'm waiting for an ACK before pushing this, but it sure seems pretty trivial. I don't know why the xen 4.0.1 headers of rawhide are different from the xen 3.4.3 headers of Fedora 13 (translation: something used to implicitly include xen/xen.h in the older headers, but no longer does in the newer xen, but I didn't bother to figure out where the inclusion chain differs). Tested on F13 and rawhide; fixes the MAX_VIRT_CPUS undeclared issue that was occurring on rawhide. src/xen/xen_driver.h |2 ++ src/xen/xs_internal.c |1 - 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h index 16d22f1..6af6132 100644 --- a/src/xen/xen_driver.h +++ b/src/xen/xen_driver.h @@ -29,6 +29,8 @@ # include winsock2.h # endif +# include xen/xen.h + /* xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public * headers. Its semantic was retained with XEN_LEGACY_MAX_VCPUS. * Ensure MAX_VIRT_CPUS is defined accordingly. diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index a9817b1..eba1b95 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -22,7 +22,6 @@ #include xen/dom0_ops.h #include xen/version.h -#include xen/xen.h #include xs.h -- 1.7.2.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 07/10] Support virDomainOpenConsole with QEMU
On 11/01/2010 10:12 AM, Daniel P. Berrange wrote: This provides an implementation of the virDomainOpenConsole API with the QEMU driver. For the streams code, this reuses most of the code previously added for the tunnelled migration streams since it is generic. * src/qemu/qemu_driver.c: Support virDomainOpenConsole --- src/qemu/qemu_driver.c | 76 +++- 1 files changed, 75 insertions(+), 1 deletions(-) +if (devname) { +if (vm-def-console +STREQ(devname, vm-def-console-info.alias)) +chr = vm-def-console; +for (i = 0 ; !chr i vm-def-nserials ; i++) { +if (STREQ(devname, vm-def-serials[i]-info.alias)) +chr = vm-def-serials[i]; +} Are we guaranteed that all devices will have a non-NULL and unique alias, or do we need to do either of these: 1. break on the first hit (rather than favoring the last instance of a duplicate alias) 2. use STREQ_NULLABLE(devname, ...alias), to be robust against an unaliased device +if (!chr) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(cannot find character device %s), devname); NULLSTR(devname) +goto cleanup; +} + +if (chr-type != VIR_DOMAIN_CHR_TYPE_PTY) { +qemuReportError(VIR_ERR_INTERNAL_ERROR, +_(character device %s is not using a PTY), devname); NULLSTR(devname) -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 08/10] Re-write virsh console to use streams
On 11/01/2010 10:12 AM, Daniel P. Berrange wrote: This re-writes the 'virsh console' command so that it uses the new streams API. This lets it run remotely and/or as a non-root user. This requires that virsh be linked against the simple event loop from libvirtd in daemon/event.c As an added bonus, it can now connect to any console device, not just the first one. * tools/Makefile.am: Link to event.c * tools/console.c, tools/console.h: Rewrite to use the virDomainOpenConsole() APIs with streams * tools/virsh.c: Support choosing the console name via --devname $NAME --- .x-sc_avoid_write |1 + tools/Makefile.am |1 + tools/console.c | 330 - tools/console.h |2 +- tools/virsh.c | 76 - tools/virsh.pod changes? +if (con-terminalToStream.data[con-terminalToStream.offset] == CTRL_CLOSE_BRACKET) { +con-quit = true; +return; +} Is there any way to type an escape sequence, such as ^v in common stty usage, in order to allow sending a literal ^] through to the console instead of always making it quit? +if (con) { +if (con-st) +virStreamFree(con-st); Should virStreamFree tolerate a NULL argument, at which point it should be added to the list in cfg.mk of free()-like functions that should not have an extra if() preceding usage? -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/10] Fix busy-wait loop on closed file descriptor
On 11/01/2010 10:12 AM, Daniel P. Berrange wrote: When closing open streams after a client quits, the event callback was not removed. This mean that poll() was using a closed FD and returning POLLNVAL in a busy-wait loop. * daemon/stream.c: Disconnect stream callbacks --- daemon/stream.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/10] Wire up virDomainOpenConsole for LXC, Xen and UML
On 11/01/2010 10:12 AM, Daniel P. Berrange wrote: * src/lxc/lxc_driver.c, src/lxc/lxc_driver.c, src/xen/xen_driver.c: Wire up virDomainOpenConsole --- src/lxc/lxc_driver.c | 67 ++- src/uml/uml_driver.c | 77 ++ src/xen/xen_driver.c | 59 +- 3 files changed, 195 insertions(+), 8 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] Revert commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090
On 11/01/2010 11:48 AM, Daniel P. Berrange wrote: Commit 06f81c63ebc19cb0e51f9b397991f6d6ae56d090 attempted to make QEMU driver ignore the failure to relabel 'stdin_path' if it was on NFS. The actual result was that it ignores *all* failures to label any aspect of the VM, unless stdin_path is non-NULL and is not on NFS. * src/qemu/qemu_driver.c: Treat all relabel failures as terminal --- src/qemu/qemu_driver.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7cce6a..9945f5d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3876,8 +3876,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, driver-securityDriver-domainSetSecurityAllLabel driver-securityDriver-domainSetSecurityAllLabel(driver-securityDriver, vm, stdin_path) 0) { -if (stdin_path virStorageFileIsSharedFS(stdin_path) != 1) -goto cleanup; +goto cleanup; ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] Treat failure to relabel stdin_path as non-fatal on NFS
On 11/01/2010 11:48 AM, Daniel P. Berrange wrote: NFS does not support file labelling, so ignore this error for stdin_path when on NFS. * src/security/security_selinux.c: Ignore failures on labelling stdin_path on NFS * src/util/storage_file.c, src/util/storage_file.h: Refine virStorageFileIsSharedFS() to allow it to check for a specific FS type. --- src/libvirt_private.syms|1 + src/security/security_selinux.c |9 ++--- src/util/storage_file.c | 32 +--- src/util/storage_file.h |9 + 4 files changed, 41 insertions(+), 10 deletions(-) -int virStorageFileIsSharedFS(const char *path) +int virStorageFileIsSharedFSType(const char *path, + int fstypes) Indentation. ACK with that nit fixed. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/4] Ignore open failures when relabelling disk images
On 11/01/2010 11:48 AM, Daniel P. Berrange wrote: NFS in root squash mode may prevent opening disk images to determine backing store. Ignore errors in this scenario. * src/security/security_selinux.c: Ignore open failures on disk images --- src/security/security_selinux.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 0612ce3..edeff10 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -482,7 +482,7 @@ SELinuxSetSecurityImageLabel(virSecurityDriverPtr drv, return virDomainDiskDefForeachPath(disk, allowDiskFormatProbing, - false, + true, SELinuxSetSecurityFileLabel, secdef); } ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 4/4] Misc error handling fixes in text mode monitor commands
On 11/01/2010 11:48 AM, Daniel P. Berrange wrote: A couple of places in the text monitor were overwriting the 'ret' variable with a = 0 value before success was actually determined. So later error paths would not correctly return the -1 value. The drive_add code was not checking for errors like missing command * src/qemu/qemu_monitor_text.c: Misc error handling fixes --- src/qemu/qemu_monitor_text.c | 28 +++- 1 files changed, 19 insertions(+), 9 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] [TCK] network: create networks and check for exected results
On 11/01/2010 04:56 AM, Stefan Berger wrote: On 10/29/2010 11:33 AM, Eric Blake wrote: On 10/26/2010 05:27 PM, Stefan Berger wrote: On 10/26/2010 07:08 PM, Eric Blake wrote: Sorry for sounding so depressing; I'm very pleased to see your efforts in providing tests for the code you've written. Even though this test is intended to be skipped on non-Linux, you still have to worry about merely parsing through the test on other platforms like Solaris, where /bin/sh won't understand the bash-isms and where /bin/bash is not guaranteed to exist. But if we decide that requiring the presence of /bin/bash is acceptable for the TCK, then a lot of my review becomes irrelevant; but my comments about your mkstemp replacement being insecure are still applicable even in that case. Ok. Well, I hope for bash then... IRC verdict - Dan and I are both okay with assuming /bin/bash exists. So, that just leaves cleaning up the temporary file management. Would you like me to tackle that as an incremental diff on top of your original patch? Yes, you can put it in on top of it. So is this an ACK now so I can push? Actually, since you have already got the test setup ready, would you mind just squashing this in? If it works for you, then you have my ACK to push the squashed version, such that libvirt-tck.git only has a single commit with all the problems already fixed. This incremental diff to your patch converts `` to $(), fixes a few useless uses of cat, changes temporary file creation to instead use a secure temporary directory, ensures grep -E will either work or has a fallback of egrep, and adds around more variables that might be user-provided. diff --git i/scripts/networks/networkApplyTest.sh w/scripts/networks/networkApplyTest.sh index 547f00f..6627dd3 100644 --- i/scripts/networks/networkApplyTest.sh +++ w/scripts/networks/networkApplyTest.sh @@ -2,18 +2,19 @@ VIRSH=virsh -uri= -if [ x${LIBVIRT_TCK_CONFIG}x != xx ]; then -uri_exp=`cat ${LIBVIRT_TCK_CONFIG} | grep ^uri\s*= | sed -e 's/uri\s*=\s*//' | tail -n 1` -if [ x${uri_exp}x != xx ]; then -eval uri=${uri_exp} -fi -if [ x${uri}x == xx ]; then -uri=qemu:///system -fi -else -uri=qemu:///system -fi +# For each line starting with uri=, remove the prefix and set the hold +# space to the rest of the line. Then at file end, print the hold +# space, which is effectively the last uri= line encountered. +uri=$(sed -n '/^uri[ ]*=[ ]*/ { + s/// + h +} +$ { + x + p +}' $LIBVIRT_TCK_CONFIG) +: ${uri:=qemu:///system} + LIBVIRT_URI=${uri} @@ -72,29 +73,23 @@ function tap_final() { [ -n ${TAP_FAIL_LIST} ] echo FAILED tests ${TAP_FAIL_LIST} - okay=`echo ($TAP_TOT_CTR-$TAP_FAIL_CTR)*100/$TAP_TOT_CTR | bc -l` + okay=$(echo ($TAP_TOT_CTR-$TAP_FAIL_CTR)*100/$TAP_TOT_CTR | bc -l) echo Failed ${TAP_FAIL_CTR}/${TAP_TOT_CTR} tests, ${okay:0:5}% okay } # A wrapper for mktemp in case it does not exist -# Echos the name of a temporary file. -function mktmpfile() { +# Echos the name of a secure temporary directory. +function mktmpdir() { local tmp - type -P mktemp /dev/null - if [ $? -eq 0 ]; then -tmp=$(mktemp -t nwfvmtest.XX) -echo ${tmp} - else -while :; do - tmp=/tmp/nwfvmtest.${RANDOM} - if [ ! -f ${tmp} ]; then - touch ${tmp} - chmod 666 ${tmp} - echo ${tmp} - break - fi -done - fi + { +tmp=$( (umask 077 mktemp -d ./nwfvmtest.XX) 2/dev/null) +test -n $tmp test -d $tmp + } || + { +tmp=./nwfvmtest$$-$RANDOM +(umask 077 mkdir $tmp) + } || { echo failed to create secure temporary directory 2; exit 1; } + echo ${tmp} return 0 } @@ -104,51 +99,56 @@ function checkExpectedOutput() { local datafile=$2 local flags=$3 local skipregex=$4 - local cmd line tmpfile tmpfile2 skip + local cmd line tmpdir tmpfile tmpfile2 skip - tmpfile=`mktmpfile` - tmpfile2=`mktmpfile` + tmpdir=$(mktmpdir) + tmpfile=$tmpdir/file + tmpfile2=$tmpdir/file2 + + if echo a | grep -E '(a|b)' /dev/null 21 + then EGREP='grep -E' + else EGREP=egrep + fi - exec 4${datafile} + exec 4${datafile} read 4 line=${REPLY} while [ x${line}x != xx ]; do -cmd=`echo ${line##\#}` +cmd=$(echo ${line##\#}) skip=0 if [ x${skipregex}x != xx ]; then - skip=`echo ${cmd} | grep -c -E ${skipregex}` +skip=$(echo ${cmd} | ${EGREP} -c ${skipregex}) fi -eval ${cmd} 21 | tee ${tmpfile} 1/dev/null +eval ${cmd} 21 | tee ${tmpfile} 1/dev/null -rm ${tmpfile2} 2/dev/null -touch ${tmpfile2} +: {tmpfile2} -while [ 1 ]; do +while :; do read 4 line=${REPLY} if [ ${line:0:1} == # ] || [ x${line}x == xx ]; then - if [ ${skip} -ne 0 ]; then - break - fi +if [ ${skip} -ne 0 ]; then + break +fi -diff ${tmpfile} ${tmpfile2} /dev/null +diff ${tmpfile} ${tmpfile2} /dev/null
Re: [libvirt] [PATCH] qemu: Record timestamp for qemu domain log
On 11/01/2010 06:46 AM, Osier Yang wrote: Currently only support domain start and domain shutdown, for domain start, adding timestamp before qemu command line, for domain shutdown, just say it's shutting down with timestamp. * src/qemu/qemu_driver.c --- src/qemu/qemu_driver.c | 42 +- 1 files changed, 41 insertions(+), 1 deletions(-) +} else if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_FREE(timestamp); +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); VIR_FREE might clobber errno. Swap these two lines. @@ -4178,6 +4188,31 @@ static void qemudShutdownVMDaemon(struct qemud_driver *driver, virErrorPtr orig_err; virDomainDefPtr def; int i; +int logfile = -1; +char *timestamp; +char ebuf[1024]; + +VIR_DEBUG0(Creating domain log file); +if ((logfile = qemudLogFD(driver, vm-def-name)) 0) { +/* To not break the normal domain shutdown process, skip the + * timestamp log writing if failed on opening log file. */ +VIR_WARN(Unable to open logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} else { +if ((timestamp = virTimestamp()) == NULL) { +virReportOOMError(); +goto cleanup; Hmm. The rest of this function is best-effort cleanup, since there is no return value. If you run out of memory while trying to cleanup, you should STILL try and clean up the rest of the resources freed later in this function, rather than immediately jumping to your cleanup: handler. +} else { +strcat(timestamp, shutting down\n); Ouch. Buffer overflow - you can't guarantee whether timestamp was overallocated with enough memory for you to blindly strcat() data onto the end of it. + +if (safewrite(logfile, timestamp, strlen(timestamp)) 0) { +VIR_WARN(Unable to write timestamp to logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); +} + +VIR_FREE(timestamp); +} +} VIR_DEBUG(Shutting down VM '%s' pid=%d migrated=%d, vm-def-name, vm-pid, migrated); Also, I think you want your attempts to write to a log file to occur after this VIR_DEBUG statement. @@ -4315,6 +4350,11 @@ retry: virSetError(orig_err); virFreeError(orig_err); } + +cleanup: +if (VIR_CLOSE(logfile) 0) +VIR_WARN(Unable to close logfile: %s, + virStrerror(errno, ebuf, sizeof ebuf)); } -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] util: Add helper function to build timestamp string
On 10/31/2010 10:17 PM, Osier Yang wrote: * src/util/util.h * src/util/util.c * src/libvirt_private.syms --- src/libvirt_private.syms |1 + src/util/util.c | 20 src/util/util.h |3 +++ 3 files changed, 24 insertions(+), 0 deletions(-) + +char *virTimestamp(void) { We typically start functions with the { on the first column of a new line. +if (virAsprintf(timestamp, %s.%3d: , +timestr, (int) cur_time.tv_usec / 1000) 0) { You want %03d, to ensure that you always print 3 digits of fractional seconds, even when 100. ACK with those nits adjusted; I made the changes and pushed. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/10] Fix comment for video tag in domain RNG schema
On 11/01/2010 12:17 PM, Daniel P. Berrange wrote: The comment for the video tag was a cut+paste error duplicating info about the graphics tag * docs/schemas/domain.rng: Fix comment for video tag --- docs/schemas/domain.rng |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a934a77..aaf9667 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1149,10 +1149,8 @@ /element /define !-- - A graphic description, currently in Xen only 2 types are supported: - - sdl with optional display, xauth and fullscreen - - vnc with a required port and optional listen IP address, password - and keymap + A video adapter description, allowing configuration of device + model, number of virtual heads, and video ram size -- ACK; practically falls under the trivial rule. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] xen: work with xen 4.0.1 headers
Eric Blake wrote: * src/xen/xen_driver.h (includes): Include main xen headers here... * src/xen/xs_internal.c (includes): ...rather than in just one of the sub-drivers. --- I'm waiting for an ACK before pushing this, but it sure seems pretty trivial. I don't know why the xen 4.0.1 headers of rawhide are different from the xen 3.4.3 headers of Fedora 13 (translation: something used to implicitly include xen/xen.h in the older headers, but no longer does in the newer xen, but I didn't bother to figure out where the inclusion chain differs). Tested on F13 and rawhide; fixes the MAX_VIRT_CPUS undeclared issue that was occurring on rawhide. src/xen/xen_driver.h |2 ++ src/xen/xs_internal.c |1 - 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h index 16d22f1..6af6132 100644 --- a/src/xen/xen_driver.h +++ b/src/xen/xen_driver.h @@ -29,6 +29,8 @@ # include winsock2.h # endif +# include xen/xen.h + /* xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public * headers. Its semantic was retained with XEN_LEGACY_MAX_VCPUS. * Ensure MAX_VIRT_CPUS is defined accordingly. diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index a9817b1..eba1b95 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -22,7 +22,6 @@ #include xen/dom0_ops.h #include xen/version.h -#include xen/xen.h #include xs.h ACK. libvirt 0.8.5 + this patch + commit dc27e089 + commit b164db62 = successful builds against xen 3.3.1, 3.4.1, and 4.0.1. I did notice commit e8066d53 broke the build on older openSUSE containing polkit0. I'll send a patch for that shortly. Regards, Jim -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix build with polkit 0
Commit e8066d53 broke the build with polkit0: remote.c: In function 'remoteDispatchAuthPolkit': remote.c:4177: error: 'rv' undeclared (first use in this function) Add missing identifier. --- daemon/remote.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 886d53d..3cf3886 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -4152,6 +4152,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server, DBusError err; const char *action; char ident[100]; +int rv; memset(ident, 0, sizeof ident); -- 1.6.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] [TCK] network: create networks and check for exected results
On 11/01/2010 06:41 PM, Eric Blake wrote: On 11/01/2010 04:56 AM, Stefan Berger wrote: On 10/29/2010 11:33 AM, Eric Blake wrote: On 10/26/2010 05:27 PM, Stefan Berger wrote: On 10/26/2010 07:08 PM, Eric Blake wrote: Sorry for sounding so depressing; I'm very pleased to see your efforts in providing tests for the code you've written. Even though this test is intended to be skipped on non-Linux, you still have to worry about merely parsing through the test on other platforms like Solaris, where /bin/sh won't understand the bash-isms and where /bin/bash is not guaranteed to exist. But if we decide that requiring the presence of /bin/bash is acceptable for the TCK, then a lot of my review becomes irrelevant; but my comments about your mkstemp replacement being insecure are still applicable even in that case. Ok. Well, I hope for bash then... IRC verdict - Dan and I are both okay with assuming /bin/bash exists. So, that just leaves cleaning up the temporary file management. Would you like me to tackle that as an incremental diff on top of your original patch? Yes, you can put it in on top of it. So is this an ACK now so I can push? Actually, since you have already got the test setup ready, would you mind just squashing this in? If it works for you, then you have my ACK to push the squashed version, such that libvirt-tck.git only has a single commit with all the problems already fixed. Combined and pushed. Stefan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] SPAM-LOW: Re: Re: Node.GetInfo error
-list __ Information from ESET Smart Security, version of virus signature database 5583 (20101101) __ The message was checked by ESET Smart Security. http://www.eset.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list