From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwuAa-00032I-71 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:10:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwuAV-0008Og-BR for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:10:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwuAV-0008OZ-47 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:10:51 -0400 Date: Wed, 10 Jul 2013 15:10:40 +0200 From: Kevin Wolf Message-ID: <20130710131040.GO3898@dhcp-200-207.str.redhat.com> References: <1373270451-18436-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1373270451-18436-3-git-send-email-xiawenc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1373270451-18436-3-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH V4 2/9] snapshot: add paired functions for internal snapshot id and name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: phrdina@redhat.com, famz@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com Am 08.07.2013 um 10:00 hat Wenchao Xia geschrieben: > Internal snapshot's ID and name concept are both visible in general > block level, they are observed by user in "info snapshots", so it is > possible to have conflict. Although we can separate the two concept in > programming, but if they can be distinguished in string itself, things > will be simple and clear, so introduce two functions to do it. > > The implemention, qcow2 snapshot calls snapshot_id_string_generate() to > make sure it follows the rule in driver. If caller or user give a check > with snapshot_name_wellformed() before create snapshot, then the ID > and name will never conflict. The check can be also taken in > qcow2_snapshot_create(), but require it to return error reason. I'm not sure how useful this is. While we can restrict what IDs we allow for creating new snapshots, we cannot take any advantage from it because existing snapshots could already be named with only digits (they could also use a non-numeric ID). At the end of the day we're limiting the choice of IDs that can be generated with the QMP command without a real reason. Kevin