qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] make windows notice media change
@ 2009-07-29 12:07 Gleb Natapov
  2009-07-29 13:50 ` [Qemu-devel] [PATCH v2] " Gleb Natapov
  0 siblings, 1 reply; 22+ messages in thread
From: Gleb Natapov @ 2009-07-29 12:07 UTC (permalink / raw)
  To: qemu-devel

Windows seems to be very stupid about cdrom media change. It polls
cdrom status and if status goes ready->media not present->ready
it assumes that media was changed. If "media not present" step doesn't
happen even if "medium may have changed" was seen it assumes media
haven't changed. Fake "media not present" step.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/hw/ide.c b/hw/ide.c
index 1e56786..5ae4a2b 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1644,9 +1644,10 @@ static void ide_atapi_cmd(IDEState *s)
     }
     switch(s->io_buffer[0]) {
     case GPCMD_TEST_UNIT_READY:
-        if (bdrv_is_inserted(s->bs)) {
+        if (bdrv_is_inserted(s->bs) && !s->media_changed) {
             ide_atapi_cmd_ok(s);
         } else {
+            s->media_changed = 0;
             ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                 ASC_MEDIUM_NOT_PRESENT);
         }
@@ -2106,7 +2107,7 @@ static void cdrom_change_cb(void *opaque)
 
     s->sense_key = SENSE_UNIT_ATTENTION;
     s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED;
-
+    s->media_changed = 1;
     ide_set_irq(s);
 }
 
--
			Gleb.

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 12:07 [Qemu-devel] [PATCH] make windows notice media change Gleb Natapov
@ 2009-07-29 13:50 ` Gleb Natapov
  2009-07-29 14:22   ` Avi Kivity
  2009-07-29 14:35   ` Filip Navara
  0 siblings, 2 replies; 22+ messages in thread
From: Gleb Natapov @ 2009-07-29 13:50 UTC (permalink / raw)
  To: qemu-devel

Windows seems to be very stupid about cdrom media change. It polls
cdrom status and if status goes ready->media not present->ready
it assumes that media was changed. If "media not present" step doesn't
happen even if "medium may have changed" was seen it assumes media
haven't changed. Fake "media not present" step.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
v1->v2:
  do not reuse media_changed. Save/restore on migration.

diff --git a/hw/ide.c b/hw/ide.c
index 1e56786..b8f35ad 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -418,6 +418,7 @@ typedef struct IDEState {
     /* ATAPI specific */
     uint8_t sense_key;
     uint8_t asc;
+    uint8_t cdrom_changed;
     int packet_transfer_size;
     int elementary_transfer_size;
     int io_buffer_index;
@@ -1644,9 +1645,10 @@ static void ide_atapi_cmd(IDEState *s)
     }
     switch(s->io_buffer[0]) {
     case GPCMD_TEST_UNIT_READY:
-        if (bdrv_is_inserted(s->bs)) {
+        if (bdrv_is_inserted(s->bs) && !s->cdrom_changed) {
             ide_atapi_cmd_ok(s);
         } else {
+            s->cdrom_changed = 0;
             ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                 ASC_MEDIUM_NOT_PRESENT);
         }
@@ -2106,7 +2108,7 @@ static void cdrom_change_cb(void *opaque)
 
     s->sense_key = SENSE_UNIT_ATTENTION;
     s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED;
-
+    s->cdrom_changed = 1;
     ide_set_irq(s);
 }
 
@@ -2870,6 +2872,7 @@ static void ide_save(QEMUFile* f, IDEState *s)
 
     qemu_put_8s(f, &s->sense_key);
     qemu_put_8s(f, &s->asc);
+    qemu_put_8s(f, &s->cdrom_changed);
     /* XXX: if a transfer is pending, we do not save it yet */
 }
 
@@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
 
     qemu_get_8s(f, &s->sense_key);
     qemu_get_8s(f, &s->asc);
+    qemu_get_8s(f, &s->cdrom_changed);
     /* XXX: if a transfer is pending, we do not save it yet */
 }
 
@@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
     PCIIDEState *d = opaque;
     int ret, i;
 
-    if (version_id != 2)
+    if (version_id != 3)
         return -EINVAL;
     ret = pci_device_load(&d->dev, f);
     if (ret < 0)
@@ -3339,7 +3343,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
     ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], irq[0]);
     ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], irq[1]);
 
-    register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
+    register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d);
     qemu_register_reset(cmd646_reset, d);
     cmd646_reset(d);
 }
--
			Gleb.

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:22   ` Avi Kivity
@ 2009-07-29 14:21     ` Gleb Natapov
  2009-07-29 14:44       ` Avi Kivity
  0 siblings, 1 reply; 22+ messages in thread
From: Gleb Natapov @ 2009-07-29 14:21 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel

On Wed, Jul 29, 2009 at 05:22:03PM +0300, Avi Kivity wrote:
> On 07/29/2009 04:50 PM, Gleb Natapov wrote:
>> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>>
>>       qemu_get_8s(f,&s->sense_key);
>>       qemu_get_8s(f,&s->asc);
>> +    qemu_get_8s(f,&s->cdrom_changed);
>>       /* XXX: if a transfer is pending, we do not save it yet */
>>   }
>>
>>    
>
> Needs to be conditional on version, no?
>
I changed version check in vmload.

--
			Gleb.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 13:50 ` [Qemu-devel] [PATCH v2] " Gleb Natapov
@ 2009-07-29 14:22   ` Avi Kivity
  2009-07-29 14:21     ` Gleb Natapov
  2009-07-29 14:35   ` Filip Navara
  1 sibling, 1 reply; 22+ messages in thread
From: Avi Kivity @ 2009-07-29 14:22 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On 07/29/2009 04:50 PM, Gleb Natapov wrote:
> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>
>       qemu_get_8s(f,&s->sense_key);
>       qemu_get_8s(f,&s->asc);
> +    qemu_get_8s(f,&s->cdrom_changed);
>       /* XXX: if a transfer is pending, we do not save it yet */
>   }
>
>    

Needs to be conditional on version, no?

-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 13:50 ` [Qemu-devel] [PATCH v2] " Gleb Natapov
  2009-07-29 14:22   ` Avi Kivity
@ 2009-07-29 14:35   ` Filip Navara
  2009-07-29 14:40     ` Gleb Natapov
                       ` (2 more replies)
  1 sibling, 3 replies; 22+ messages in thread
From: Filip Navara @ 2009-07-29 14:35 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On Wed, Jul 29, 2009 at 3:50 PM, Gleb Natapov<gleb@redhat.com> wrote:
[snip]
> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>
>     qemu_get_8s(f, &s->sense_key);
>     qemu_get_8s(f, &s->asc);
> +    qemu_get_8s(f, &s->cdrom_changed);
>     /* XXX: if a transfer is pending, we do not save it yet */
>  }
>
> @@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
>     PCIIDEState *d = opaque;
>     int ret, i;
>
> -    if (version_id != 2)
> +    if (version_id != 3)
>         return -EINVAL;
>     ret = pci_device_load(&d->dev, f);
>     if (ret < 0)

Why shouldn't we support loading version 2 snapshots? Afterall that's
why we had the versioning in the first place.

F.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:35   ` Filip Navara
@ 2009-07-29 14:40     ` Gleb Natapov
  2009-07-29 14:59       ` Stefano Stabellini
  2009-07-29 19:11     ` Paul Brook
  2009-07-29 19:33     ` Anthony Liguori
  2 siblings, 1 reply; 22+ messages in thread
From: Gleb Natapov @ 2009-07-29 14:40 UTC (permalink / raw)
  To: Filip Navara; +Cc: qemu-devel

On Wed, Jul 29, 2009 at 04:35:52PM +0200, Filip Navara wrote:
> On Wed, Jul 29, 2009 at 3:50 PM, Gleb Natapov<gleb@redhat.com> wrote:
> [snip]
> > @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
> >
> >     qemu_get_8s(f, &s->sense_key);
> >     qemu_get_8s(f, &s->asc);
> > +    qemu_get_8s(f, &s->cdrom_changed);
> >     /* XXX: if a transfer is pending, we do not save it yet */
> >  }
> >
> > @@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
> >     PCIIDEState *d = opaque;
> >     int ret, i;
> >
> > -    if (version_id != 2)
> > +    if (version_id != 3)
> >         return -EINVAL;
> >     ret = pci_device_load(&d->dev, f);
> >     if (ret < 0)
> 
> Why shouldn't we support loading version 2 snapshots? Afterall that's
> why we had the versioning in the first place.
> 
Does anybody check cross version migration? If no my guess is it is broken.
And I can't even imaging test matrix. Versioning is a good way to
prevent users from doing stupid things.

--
			Gleb.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:21     ` Gleb Natapov
@ 2009-07-29 14:44       ` Avi Kivity
  0 siblings, 0 replies; 22+ messages in thread
From: Avi Kivity @ 2009-07-29 14:44 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

On 07/29/2009 05:21 PM, Gleb Natapov wrote:
> On Wed, Jul 29, 2009 at 05:22:03PM +0300, Avi Kivity wrote:
>    
>> On 07/29/2009 04:50 PM, Gleb Natapov wrote:
>>      
>>> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>>>
>>>        qemu_get_8s(f,&s->sense_key);
>>>        qemu_get_8s(f,&s->asc);
>>> +    qemu_get_8s(f,&s->cdrom_changed);
>>>        /* XXX: if a transfer is pending, we do not save it yet */
>>>    }
>>>
>>>
>>>        
>> Needs to be conditional on version, no?
>>
>>      
> I changed version check in vmload.
>
>    

Don't we usually allow loading from older versions?

-- 
error compiling committee.c: too many arguments to function

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:40     ` Gleb Natapov
@ 2009-07-29 14:59       ` Stefano Stabellini
  0 siblings, 0 replies; 22+ messages in thread
From: Stefano Stabellini @ 2009-07-29 14:59 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Filip Navara, qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

On Wed, 29 Jul 2009, Gleb Natapov wrote:
> On Wed, Jul 29, 2009 at 04:35:52PM +0200, Filip Navara wrote:
> > On Wed, Jul 29, 2009 at 3:50 PM, Gleb Natapov<gleb@redhat.com> wrote:
> > [snip]
> > > @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
> > >
> > >     qemu_get_8s(f, &s->sense_key);
> > >     qemu_get_8s(f, &s->asc);
> > > +    qemu_get_8s(f, &s->cdrom_changed);
> > >     /* XXX: if a transfer is pending, we do not save it yet */
> > >  }
> > >
> > > @@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
> > >     PCIIDEState *d = opaque;
> > >     int ret, i;
> > >
> > > -    if (version_id != 2)
> > > +    if (version_id != 3)
> > >         return -EINVAL;
> > >     ret = pci_device_load(&d->dev, f);
> > >     if (ret < 0)
> > 
> > Why shouldn't we support loading version 2 snapshots? Afterall that's
> > why we had the versioning in the first place.
> > 
> Does anybody check cross version migration? If no my guess is it is broken.
> And I can't even imaging test matrix. Versioning is a good way to
> prevent users from doing stupid things.
> 

We do support cross version migration, only from and older to a newer
release.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:35   ` Filip Navara
  2009-07-29 14:40     ` Gleb Natapov
@ 2009-07-29 19:11     ` Paul Brook
  2009-07-29 19:18       ` Filip Navara
  2009-07-29 19:33     ` Anthony Liguori
  2 siblings, 1 reply; 22+ messages in thread
From: Paul Brook @ 2009-07-29 19:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Filip Navara, Gleb Natapov

> Why shouldn't we support loading version 2 snapshots? Afterall that's
> why we had the versioning in the first place.

No it's not. Versioning was introduced to *prevent* loading old snapshots and 
crashing or ending up with inconsistent guest state. I'm still unconvinced 
that anything other than very short term backward compatibility is worthwhile 
or even viable.

Paul

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:11     ` Paul Brook
@ 2009-07-29 19:18       ` Filip Navara
  2009-07-29 19:24         ` Filip Navara
  0 siblings, 1 reply; 22+ messages in thread
From: Filip Navara @ 2009-07-29 19:18 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel, Gleb Natapov

On Wed, Jul 29, 2009 at 9:11 PM, Paul Brook<paul@codesourcery.com> wrote:
>> Why shouldn't we support loading version 2 snapshots? Afterall that's
>> why we had the versioning in the first place.
>
> No it's not. Versioning was introduced to *prevent* loading old snapshots and
> crashing or ending up with inconsistent guest state. I'm still unconvinced
> that anything other than very short term backward compatibility is worthwhile
> or even viable.

I see it as a way to migrate a running guest to newer QEMU version, possibly
even with live migration. In fact I used it quite often back in the day when
snapshots were not part of qcow2 yet and when kqemu was still in its heydays.

Best regards,
Filip Navara

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:18       ` Filip Navara
@ 2009-07-29 19:24         ` Filip Navara
  2009-07-29 19:34           ` Anthony Liguori
  2009-07-29 19:52           ` Paul Brook
  0 siblings, 2 replies; 22+ messages in thread
From: Filip Navara @ 2009-07-29 19:24 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel, Gleb Natapov

On Wed, Jul 29, 2009 at 9:18 PM, Filip Navara<filip.navara@gmail.com> wrote:
> On Wed, Jul 29, 2009 at 9:11 PM, Paul Brook<paul@codesourcery.com> wrote:
>>> Why shouldn't we support loading version 2 snapshots? Afterall that's
>>> why we had the versioning in the first place.
>>
>> No it's not. Versioning was introduced to *prevent* loading old snapshots and
>> crashing or ending up with inconsistent guest state. I'm still unconvinced
>> that anything other than very short term backward compatibility is worthwhile
>> or even viable.
>
> I see it as a way to migrate a running guest to newer QEMU version, possibly
> even with live migration. In fact I used it quite often back in the day when
> snapshots were not part of qcow2 yet and when kqemu was still in its heydays.
>

BTW, why would there be the version parameter in the first place if it
wasn't supposed to load older versions?!

Best regards,
Filip Navara

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 14:35   ` Filip Navara
  2009-07-29 14:40     ` Gleb Natapov
  2009-07-29 19:11     ` Paul Brook
@ 2009-07-29 19:33     ` Anthony Liguori
  2009-07-29 19:44       ` [Qemu-devel] " Juan Quintela
  2 siblings, 1 reply; 22+ messages in thread
From: Anthony Liguori @ 2009-07-29 19:33 UTC (permalink / raw)
  To: Filip Navara; +Cc: qemu-devel, Gleb Natapov

Filip Navara wrote:
> On Wed, Jul 29, 2009 at 3:50 PM, Gleb Natapov<gleb@redhat.com> wrote:
> [snip]
>   
>> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>>
>>     qemu_get_8s(f, &s->sense_key);
>>     qemu_get_8s(f, &s->asc);
>> +    qemu_get_8s(f, &s->cdrom_changed);
>>     /* XXX: if a transfer is pending, we do not save it yet */
>>  }
>>
>> @@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
>>     PCIIDEState *d = opaque;
>>     int ret, i;
>>
>> -    if (version_id != 2)
>> +    if (version_id != 3)
>>         return -EINVAL;
>>     ret = pci_device_load(&d->dev, f);
>>     if (ret < 0)
>>     
>
> Why shouldn't we support loading version 2 snapshots? Afterall that's
> why we had the versioning in the first place.
>   

What value do you give cdrom_changed?

If you give it zero, and you happened to be in a state where the cdrom 
was in the process of being changed when you migrated, this bug would 
surface again.

In this case, it's better to refuse the old (broken) version.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:24         ` Filip Navara
@ 2009-07-29 19:34           ` Anthony Liguori
  2009-07-29 19:52           ` Paul Brook
  1 sibling, 0 replies; 22+ messages in thread
From: Anthony Liguori @ 2009-07-29 19:34 UTC (permalink / raw)
  To: Filip Navara; +Cc: Paul Brook, Gleb Natapov, qemu-devel

Filip Navara wrote:
> On Wed, Jul 29, 2009 at 9:18 PM, Filip Navara<filip.navara@gmail.com> wrote:
>   
>> On Wed, Jul 29, 2009 at 9:11 PM, Paul Brook<paul@codesourcery.com> wrote:
>>     
>>>> Why shouldn't we support loading version 2 snapshots? Afterall that's
>>>> why we had the versioning in the first place.
>>>>         
>>> No it's not. Versioning was introduced to *prevent* loading old snapshots and
>>> crashing or ending up with inconsistent guest state. I'm still unconvinced
>>> that anything other than very short term backward compatibility is worthwhile
>>> or even viable.
>>>       
>> I see it as a way to migrate a running guest to newer QEMU version, possibly
>> even with live migration. In fact I used it quite often back in the day when
>> snapshots were not part of qcow2 yet and when kqemu was still in its heydays.
>>
>>     
>
> BTW, why would there be the version parameter in the first place if it
> wasn't supposed to load older versions?!
>   

You can sometimes load older versions.  When a new version fixes a bug 
in an older version, you cannot migrate.  OTOH, if the new version adds 
a feature that was not exposed to the guest in the previous version, as 
long as you continue to not expose that feature to the guest, you can 
safely migrate.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Qemu-devel] Re: [PATCH v2] make windows notice media change
  2009-07-29 19:33     ` Anthony Liguori
@ 2009-07-29 19:44       ` Juan Quintela
  2009-07-29 20:05         ` Anthony Liguori
  0 siblings, 1 reply; 22+ messages in thread
From: Juan Quintela @ 2009-07-29 19:44 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Filip Navara, qemu-devel, Gleb Natapov

Anthony Liguori <anthony@codemonkey.ws> wrote:
> Filip Navara wrote:
>> On Wed, Jul 29, 2009 at 3:50 PM, Gleb Natapov<gleb@redhat.com> wrote:
>> [snip]
>>   
>>> @@ -2898,6 +2901,7 @@ static void ide_load(QEMUFile* f, IDEState *s)
>>>
>>>     qemu_get_8s(f, &s->sense_key);
>>>     qemu_get_8s(f, &s->asc);
>>> +    qemu_get_8s(f, &s->cdrom_changed);
>>>     /* XXX: if a transfer is pending, we do not save it yet */
>>>  }
>>>
>>> @@ -3219,7 +3223,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
>>>     PCIIDEState *d = opaque;
>>>     int ret, i;
>>>
>>> -    if (version_id != 2)
>>> +    if (version_id != 3)
>>>         return -EINVAL;
>>>     ret = pci_device_load(&d->dev, f);
>>>     if (ret < 0)
>>>     
>>
>> Why shouldn't we support loading version 2 snapshots? Afterall that's
>> why we had the versioning in the first place.
>>   
>
> What value do you give cdrom_changed?
>
> If you give it zero, and you happened to be in a state where the cdrom
> was in the process of being changed when you migrated, this bug would
> surface again.
>
> In this case, it's better to refuse the old (broken) version.

You didn't lost anything from the old version, it already have the bug.
Value that you give it: zero.  If it was in the middle of the operation,
it will give the same bug that when it was in the older host, and when
it tells "retry", it will see the new behaviour from this on.

Later, Juan.


> Regards,
>
> Anthony Liguori

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:24         ` Filip Navara
  2009-07-29 19:34           ` Anthony Liguori
@ 2009-07-29 19:52           ` Paul Brook
  2009-07-29 19:56             ` Filip Navara
  1 sibling, 1 reply; 22+ messages in thread
From: Paul Brook @ 2009-07-29 19:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Filip Navara, Gleb Natapov

> >>> Why shouldn't we support loading version 2 snapshots? Afterall that's
> >>> why we had the versioning in the first place.
> >>
> >> No it's not. Versioning was introduced to *prevent* loading old
> >> snapshots and crashing or ending up with inconsistent guest state. I'm
> >> still unconvinced that anything other than very short term backward
> >> compatibility is worthwhile or even viable.
> >
> > I see it as a way to migrate a running guest to newer QEMU version,
> > possibly even with live migration. In fact I used it quite often back in
> > the day when snapshots were not part of qcow2 yet and when kqemu was
> > still in its heydays.
>
> BTW, why would there be the version parameter in the first place if it
> wasn't supposed to load older versions?!

Like I already said: it's there to prevent an old version being loaded 
accidentally. Without this an incompatible change will  result in anything 
from a crash to corrupt/inconsistent guest state. Versioning allows us to 
reject the snapshot and fail safely.

Paul

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:52           ` Paul Brook
@ 2009-07-29 19:56             ` Filip Navara
  2009-07-29 20:05               ` Paul Brook
  0 siblings, 1 reply; 22+ messages in thread
From: Filip Navara @ 2009-07-29 19:56 UTC (permalink / raw)
  To: Paul Brook; +Cc: qemu-devel, Gleb Natapov

On Wed, Jul 29, 2009 at 9:52 PM, Paul Brook<paul@codesourcery.com> wrote:
>> >>> Why shouldn't we support loading version 2 snapshots? Afterall that's
>> >>> why we had the versioning in the first place.
>> >>
>> >> No it's not. Versioning was introduced to *prevent* loading old
>> >> snapshots and crashing or ending up with inconsistent guest state. I'm
>> >> still unconvinced that anything other than very short term backward
>> >> compatibility is worthwhile or even viable.
>> >
>> > I see it as a way to migrate a running guest to newer QEMU version,
>> > possibly even with live migration. In fact I used it quite often back in
>> > the day when snapshots were not part of qcow2 yet and when kqemu was
>> > still in its heydays.
>>
>> BTW, why would there be the version parameter in the first place if it
>> wasn't supposed to load older versions?!
>
> Like I already said: it's there to prevent an old version being loaded
> accidentally. Without this an incompatible change will  result in anything
> from a crash to corrupt/inconsistent guest state. Versioning allows us to
> reject the snapshot and fail safely.

If that was the case then the if (version != x) return -EINVAL check could
have been in the generic code and there would be no need for the version
parameter in the load function.

- F.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 19:56             ` Filip Navara
@ 2009-07-29 20:05               ` Paul Brook
  2009-07-29 20:14                 ` Gleb Natapov
  2009-07-30 12:14                 ` Stefano Stabellini
  0 siblings, 2 replies; 22+ messages in thread
From: Paul Brook @ 2009-07-29 20:05 UTC (permalink / raw)
  To: Filip Navara; +Cc: qemu-devel, Gleb Natapov

> >> BTW, why would there be the version parameter in the first place if it
> >> wasn't supposed to load older versions?!
> >
> > Like I already said: it's there to prevent an old version being loaded
> > accidentally. Without this an incompatible change will  result in
> > anything from a crash to corrupt/inconsistent guest state. Versioning
> > allows us to reject the snapshot and fail safely.
>
> If that was the case then the if (version != x) return -EINVAL check could
> have been in the generic code and there would be no need for the version
> parameter in the load function.

Preventing loading bad snapshots is the primary goal.

Allowing loading old snapshots is a secondary feature. Personally I think it's 
not worth the effort, and in practice is unlikely to be feasible for whole 
machines over any significant length of time. However I don't feel strongly 
enough to actually rip the code out.

Paul

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Qemu-devel] Re: [PATCH v2] make windows notice media change
  2009-07-29 19:44       ` [Qemu-devel] " Juan Quintela
@ 2009-07-29 20:05         ` Anthony Liguori
  2009-07-29 20:09           ` Juan Quintela
  0 siblings, 1 reply; 22+ messages in thread
From: Anthony Liguori @ 2009-07-29 20:05 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Filip Navara, qemu-devel, Gleb Natapov

Juan Quintela wrote:
> You didn't lost anything from the old version, it already have the bug.
> Value that you give it: zero.  If it was in the middle of the operation,
> it will give the same bug that when it was in the older host,

Right, which is the root of the problem.  You migrate to a new version 
of QEMU to fix bugs.  If we don't fix bugs because we migrated from an 
old version, we end up in a strange situation resulting in strange bug 
reports.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Qemu-devel] Re: [PATCH v2] make windows notice media change
  2009-07-29 20:05         ` Anthony Liguori
@ 2009-07-29 20:09           ` Juan Quintela
  0 siblings, 0 replies; 22+ messages in thread
From: Juan Quintela @ 2009-07-29 20:09 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Filip Navara, qemu-devel, Gleb Natapov

Anthony Liguori <anthony@codemonkey.ws> wrote:
> Juan Quintela wrote:
>> You didn't lost anything from the old version, it already have the bug.
>> Value that you give it: zero.  If it was in the middle of the operation,
>> it will give the same bug that when it was in the older host,
>
> Right, which is the root of the problem.  You migrate to a new version
> of QEMU to fix bugs.  If we don't fix bugs because we migrated from an
> old version, we end up in a strange situation resulting in strange bug
> reports.

In this very case, bug is fixed from now on.  It can only happens once,
at maximum, I consider it a net gain.  Bug we are fixing here is that
windows don't detect correctly that we have changed the media, in the
old version, it can happens depending on ...., if you migrate to the new
version, you can have that problem a maximum of _one_ time, after that,
the value of the variable will always be right.

Later, Juan.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 20:05               ` Paul Brook
@ 2009-07-29 20:14                 ` Gleb Natapov
  2009-07-30 12:14                 ` Stefano Stabellini
  1 sibling, 0 replies; 22+ messages in thread
From: Gleb Natapov @ 2009-07-29 20:14 UTC (permalink / raw)
  To: Paul Brook; +Cc: Filip Navara, qemu-devel

On Wed, Jul 29, 2009 at 09:05:18PM +0100, Paul Brook wrote:
> > >> BTW, why would there be the version parameter in the first place if it
> > >> wasn't supposed to load older versions?!
> > >
> > > Like I already said: it's there to prevent an old version being loaded
> > > accidentally. Without this an incompatible change will  result in
> > > anything from a crash to corrupt/inconsistent guest state. Versioning
> > > allows us to reject the snapshot and fail safely.
> >
> > If that was the case then the if (version != x) return -EINVAL check could
> > have been in the generic code and there would be no need for the version
> > parameter in the load function.
> 
> Preventing loading bad snapshots is the primary goal.
> 
> Allowing loading old snapshots is a secondary feature. Personally I think it's 
> not worth the effort, and in practice is unlikely to be feasible for whole 
> machines over any significant length of time. However I don't feel strongly 
> enough to actually rip the code out.
> 
Agree. All this "migrate from older version" just produce code that is
never tested in practice.

--
			Gleb.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-29 20:05               ` Paul Brook
  2009-07-29 20:14                 ` Gleb Natapov
@ 2009-07-30 12:14                 ` Stefano Stabellini
  2009-07-30 12:27                   ` Paul Brook
  1 sibling, 1 reply; 22+ messages in thread
From: Stefano Stabellini @ 2009-07-30 12:14 UTC (permalink / raw)
  To: Paul Brook; +Cc: Filip Navara, qemu-devel@nongnu.org, Gleb Natapov

On Wed, 29 Jul 2009, Paul Brook wrote:
> > >> BTW, why would there be the version parameter in the first place if it
> > >> wasn't supposed to load older versions?!
> > >
> > > Like I already said: it's there to prevent an old version being loaded
> > > accidentally. Without this an incompatible change will  result in
> > > anything from a crash to corrupt/inconsistent guest state. Versioning
> > > allows us to reject the snapshot and fail safely.
> >
> > If that was the case then the if (version != x) return -EINVAL check could
> > have been in the generic code and there would be no need for the version
> > parameter in the load function.
> 
> Preventing loading bad snapshots is the primary goal.
> 
> Allowing loading old snapshots is a secondary feature. Personally I think it's 
> not worth the effort, and in practice is unlikely to be feasible for whole 
> machines over any significant length of time. However I don't feel strongly 
> enough to actually rip the code out.
> 

I completely disagree with you: loading old snapshots is a really
important feature, at least for xen (and kvm) users.
Think about a sysadmin that kept his server running for the last X years
in a VM using xen (or kvm) and now wants to upgrade his host.
Is he supposed to reboot the VM as well?
Are we seriously suggesting that everytime the hypervisor is upgraded
the sysadmin must reboot all his VMs?

Regarding the difficulty of the task: we (xen community and xenserver)
accomplished this for the last 4 years with no particular problems and a
relatively small developing team.
I have a patch in my patchqueue that allows a modern qemu to load snapshot
from version 1 and it doesn't require the use of black magic.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PATCH v2] make windows notice media change
  2009-07-30 12:14                 ` Stefano Stabellini
@ 2009-07-30 12:27                   ` Paul Brook
  0 siblings, 0 replies; 22+ messages in thread
From: Paul Brook @ 2009-07-30 12:27 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: Filip Navara, qemu-devel@nongnu.org, Gleb Natapov

> Think about a sysadmin that kept his server running for the last X years
> in a VM using xen (or kvm) and now wants to upgrade his host.
> Is he supposed to reboot the VM as well?
> Are we seriously suggesting that everytime the hypervisor is upgraded
> the sysadmin must reboot all his VMs?

I'd expect that stable branches would make effort to not break the 
snapshot/migration format.

I think it's entirely reasonable to require a VM reboot when you do a major 
hypervisor upgrade. I'd expect this to be the least of your problems.

Paul

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2009-07-30 12:27 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29 12:07 [Qemu-devel] [PATCH] make windows notice media change Gleb Natapov
2009-07-29 13:50 ` [Qemu-devel] [PATCH v2] " Gleb Natapov
2009-07-29 14:22   ` Avi Kivity
2009-07-29 14:21     ` Gleb Natapov
2009-07-29 14:44       ` Avi Kivity
2009-07-29 14:35   ` Filip Navara
2009-07-29 14:40     ` Gleb Natapov
2009-07-29 14:59       ` Stefano Stabellini
2009-07-29 19:11     ` Paul Brook
2009-07-29 19:18       ` Filip Navara
2009-07-29 19:24         ` Filip Navara
2009-07-29 19:34           ` Anthony Liguori
2009-07-29 19:52           ` Paul Brook
2009-07-29 19:56             ` Filip Navara
2009-07-29 20:05               ` Paul Brook
2009-07-29 20:14                 ` Gleb Natapov
2009-07-30 12:14                 ` Stefano Stabellini
2009-07-30 12:27                   ` Paul Brook
2009-07-29 19:33     ` Anthony Liguori
2009-07-29 19:44       ` [Qemu-devel] " Juan Quintela
2009-07-29 20:05         ` Anthony Liguori
2009-07-29 20:09           ` Juan Quintela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).