On Wed, Nov 25, 2009 at 11:31:37AM +0000, Daniel P. Berrange wrote:
On Mon, Nov 23, 2009 at 12:30:29PM +0000, Matthew Booth wrote:
> @@ -1291,7 +1330,7 @@ qemudWaitForMonitor(virConnectPtr conn,
> {
> char buf[4096]; /* Plenty of space to get startup greeting */
> int logfd;
> - int ret;
> + int ret = -1;
>
> if ((logfd = qemudLogReadFD(conn, driver->logDir, vm->def->name,
pos))
> < 0)
> @@ -1317,7 +1356,32 @@ qemudWaitForMonitor(virConnectPtr conn,
> if (qemuConnectMonitor(vm) < 0)
> return -1;
>
> - return 0;
> + /* Try to get the pty path mappings again via the monitor. This is much more
> + * reliable if it's available.
> + * Note that the monitor itself can be on a pty, so we still need to try the
> + * log output method. */
> + virHashTablePtr paths = virHashCreate(0);
> + if (paths == NULL) {
> + virReportOOMError(NULL);
> + goto cleanup;
> + }
> +
> + qemuDomainObjEnterMonitor(vm);
This needs to be EnterMonitorWithDriver(driver, vm), since the 'driver'
is locked in this context
> + qemuDomainObjPrivatePtr priv = vm->privateData;
> + ret = qemuMonitorGetPtyPaths(priv->mon, paths);
> + qemuDomainObjExitMonitor(vm);
And ExitMonitorWithDriver
Loooks serious and was missing fro last patch so I made the change
> + /* Path is everything after needle to the end of the
line */
> + *eol = '\0';
> + char *path = needle + strlen(NEEDLE);
> +
> + virHashAddEntry(paths, id, strdup(path));
Not checking OOM on strdup() here, or for failure of virHashAddEntry()
I fixed that too, I pushed the attached patch to clean those 2 issues,
please check :-)
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/