Patchwork [v2,1/2] fdc: floppy drive should be visible after start without media

login
register
mail settings
Submitter Pavel Hrdina
Date May 22, 2012, 3 p.m.
Message ID <a13f58fd1dfba3064819428420375725aaa5c160.1337698475.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/160655/
State New
Headers show

Comments

Pavel Hrdina - May 22, 2012, 3 p.m.
If you start guest with floppy drive but without media inserted, guest
still should see floppy drive pressent.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Kevin Wolf - May 23, 2012, 8:38 a.m.
Am 22.05.2012 17:00, schrieb Pavel Hrdina:
> If you start guest with floppy drive but without media inserted, guest
> still should see floppy drive pressent.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  hw/pc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pc.c b/hw/pc.c
> index 4d34a33..967c17a 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>      if (floppy) {
>          fdc_get_bs(fd, floppy);
>          for (i = 0; i < 2; i++) {
> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
> +            if (fd[i]) {
>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>                                                &last_sect, FDRIVE_DRV_NONE,
>                                                &fd_type[i], &rate);

I'm not completely sure, but we might have to make this change dependent
on the machine type to avoid surprises with live migration.

Kevin
Markus Armbruster - May 23, 2012, 9:14 a.m.
Kevin Wolf <kwolf@redhat.com> writes:

> Am 22.05.2012 17:00, schrieb Pavel Hrdina:
>> If you start guest with floppy drive but without media inserted, guest
>> still should see floppy drive pressent.
>> 
>> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>> ---
>>  hw/pc.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/hw/pc.c b/hw/pc.c
>> index 4d34a33..967c17a 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>>      if (floppy) {
>>          fdc_get_bs(fd, floppy);
>>          for (i = 0; i < 2; i++) {
>> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
>> +            if (fd[i]) {
>>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>>                                                &last_sect, FDRIVE_DRV_NONE,
>>                                                &fd_type[i], &rate);
>
> I'm not completely sure, but we might have to make this change dependent
> on the machine type to avoid surprises with live migration.

What kind of surprises do you have in mind?
Kevin Wolf - May 23, 2012, 9:26 a.m.
Am 23.05.2012 11:14, schrieb Markus Armbruster:
> Kevin Wolf <kwolf@redhat.com> writes:
> 
>> Am 22.05.2012 17:00, schrieb Pavel Hrdina:
>>> If you start guest with floppy drive but without media inserted, guest
>>> still should see floppy drive pressent.
>>>
>>> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>>> ---
>>>  hw/pc.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/hw/pc.c b/hw/pc.c
>>> index 4d34a33..967c17a 100644
>>> --- a/hw/pc.c
>>> +++ b/hw/pc.c
>>> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>>>      if (floppy) {
>>>          fdc_get_bs(fd, floppy);
>>>          for (i = 0; i < 2; i++) {
>>> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
>>> +            if (fd[i]) {
>>>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>>>                                                &last_sect, FDRIVE_DRV_NONE,
>>>                                                &fd_type[i], &rate);
>>
>> I'm not completely sure, but we might have to make this change dependent
>> on the machine type to avoid surprises with live migration.
> 
> What kind of surprises do you have in mind?

A second drive appearing (or appearing in part) after a migration. But
looking closer at the code, this really only changes the CMOS (which is
migrated) and doesn't seem to have any side effects.

Kevin

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 4d34a33..967c17a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -382,7 +382,7 @@  void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
     if (floppy) {
         fdc_get_bs(fd, floppy);
         for (i = 0; i < 2; i++) {
-            if (fd[i] && bdrv_is_inserted(fd[i])) {
+            if (fd[i]) {
                 bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
                                               &last_sect, FDRIVE_DRV_NONE,
                                               &fd_type[i], &rate);