Re: [libvirt] [PATCH] check if console PTY is null before attempting to open

2015-05-31 Thread Shivaprasad bhat
On Fri, May 29, 2015 at 6:45 PM, Michal Privoznik  wrote:
> On 27.05.2015 20:05, Shivaprasad G Bhat wrote:
>> Console devices have their pty devices assigned when the qemu is actually
>> started. The libvirt spends considerable amount of time to start the qemu if
>> the guest has multiple passthrough devices. If time is spent during the
>> hostdev preparation, someone attempts to open the console, the libvirt
>> crashes in virChrdevLockFilePath().The patch attempts to fix the crash by
>> adding a check before attempting to open.
>>
>> Signed-off-by: Shivaprasad G Bhat 
>> ---
>>  src/qemu/qemu_driver.c |6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 1233d8f..fec928f 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -16278,6 +16278,12 @@ qemuDomainOpenConsole(virDomainPtr dom,
>>  goto cleanup;
>>  }
>>
>> +if (!(chr->source.data.file.path)) {
>> +virReportError(VIR_ERR_OPERATION_FAILED, "%s",
>> +   _("PTY device is not yet assigned"));
>> +goto cleanup;
>> +}
>> +
>
> While this will fix your use case ..
>
>>  /* handle mutually exclusive access to console devices */
>>  ret = virChrdevOpen(priv->devs,
>>  &chr->source,
>>
>
> .. making virChardevOpen() report an error on missing path will fix
> other use cases (and other drivers). For instance, the same error you're
> seeing may happen in libxl driver or in qemuDomainOpenChannel().
>

Thanks Michal. I just sent the V2 as suggested.

Regards,
Shiva

> Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] check if console PTY is null before attempting to open

2015-05-29 Thread Michal Privoznik
On 27.05.2015 20:05, Shivaprasad G Bhat wrote:
> Console devices have their pty devices assigned when the qemu is actually
> started. The libvirt spends considerable amount of time to start the qemu if
> the guest has multiple passthrough devices. If time is spent during the
> hostdev preparation, someone attempts to open the console, the libvirt
> crashes in virChrdevLockFilePath().The patch attempts to fix the crash by
> adding a check before attempting to open.
> 
> Signed-off-by: Shivaprasad G Bhat 
> ---
>  src/qemu/qemu_driver.c |6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 1233d8f..fec928f 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16278,6 +16278,12 @@ qemuDomainOpenConsole(virDomainPtr dom,
>  goto cleanup;
>  }
>  
> +if (!(chr->source.data.file.path)) {
> +virReportError(VIR_ERR_OPERATION_FAILED, "%s",
> +   _("PTY device is not yet assigned"));
> +goto cleanup;
> +}
> +

While this will fix your use case ..

>  /* handle mutually exclusive access to console devices */
>  ret = virChrdevOpen(priv->devs,
>  &chr->source,
> 

.. making virChardevOpen() report an error on missing path will fix
other use cases (and other drivers). For instance, the same error you're
seeing may happen in libxl driver or in qemuDomainOpenChannel().

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] check if console PTY is null before attempting to open

2015-05-27 Thread Shivaprasad G Bhat
Console devices have their pty devices assigned when the qemu is actually
started. The libvirt spends considerable amount of time to start the qemu if
the guest has multiple passthrough devices. If time is spent during the
hostdev preparation, someone attempts to open the console, the libvirt
crashes in virChrdevLockFilePath().The patch attempts to fix the crash by
adding a check before attempting to open.

Signed-off-by: Shivaprasad G Bhat 
---
 src/qemu/qemu_driver.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1233d8f..fec928f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16278,6 +16278,12 @@ qemuDomainOpenConsole(virDomainPtr dom,
 goto cleanup;
 }
 
+if (!(chr->source.data.file.path)) {
+virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+   _("PTY device is not yet assigned"));
+goto cleanup;
+}
+
 /* handle mutually exclusive access to console devices */
 ret = virChrdevOpen(priv->devs,
 &chr->source,

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list