Re: [PATCH v4 7/7] RTC:Allow to migrate from old version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/19/2012 08:14 AM, Zhang, Yang Z wrote:
> The new logic is compatible with old. So it should not block migrate from old version. But new version cannot migrate to old.
>
> +static int rtc_load_old(QEMUFile *f, void *opaque, int version_id)
> +{
> +    RTCState *s = opaque;
> +
> +    if (version_id > 2) {
> +        return -EINVAL;
> +    }
> +
> +    qemu_get_buffer(f, s->cmos_data, sizeof(s->cmos_data));
> +    /* dummy load for compatibility */
> +    qemu_get_byte(f); /* cmos_index */
> +    qemu_get_be32(f); /* tm_sec */
> +    qemu_get_be32(f); /* tm_min */
> +    qemu_get_be32(f); /* tm_hour */
> +    qemu_get_be32(f); /* tm_wday */
> +    qemu_get_be32(f); /* tm_mday */
> +    qemu_get_be32(f); /* tm_mon */
> +    qemu_get_be32(f); /* tm_year */
> +    qemu_get_be64(f); /* periodic_timer */
> +    qemu_get_be64(f); /* next_periodic_time */
> +    qemu_get_be64(f); /* next_second_time */
> +    qemu_get_be64(f); /* second_timer */
> +    qemu_get_be64(f); /* second_timer2 */
> +    qemu_get_be32(f); /* irq_coalesced */
> +    qemu_get_be32(f); /* period */
> +

Why don't you just convert the data to the new in-memory format?  Then
you don't need a version update.

> +
> +    rtc_set_date_from_host(&s->dev);

If the guest is intentionally running with an incorrect date, this breaks.


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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux