From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9aGz-0008S9-GX for qemu-devel@nongnu.org; Mon, 19 Mar 2012 06:57:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9aGt-0001V2-Ci for qemu-devel@nongnu.org; Mon, 19 Mar 2012 06:57:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9aGt-0001Uf-4q for qemu-devel@nongnu.org; Mon, 19 Mar 2012 06:57:03 -0400 Message-ID: <4F6710FA.8060405@redhat.com> Date: Mon, 19 Mar 2012 12:56:58 +0200 From: Avi Kivity MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 7/7] RTC:Allow to migrate from old version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Zhang, Yang Z" Cc: Paolo Bonzini , "aliguori@us.ibm.com" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" 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