From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v4 7/7] RTC:Allow to migrate from old version Date: Mon, 19 Mar 2012 12:56:58 +0200 Message-ID: <4F6710FA.8060405@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "qemu-devel@nongnu.org" , "aliguori@us.ibm.com" , Paolo Bonzini , "kvm@vger.kernel.org" To: "Zhang, Yang Z" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:19727 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753349Ab2CSK5E (ORCPT ); Mon, 19 Mar 2012 06:57:04 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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