From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 7/8] xl: generate a new random VM generation ID if requested Date: Wed, 18 Jun 2014 12:37:42 +0100 Message-ID: <1403091462.25575.17.camel@kazak.uk.xensource.com> References: <1402585478-3389-1-git-send-email-david.vrabel@citrix.com> <1402585478-3389-8-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WxEBW-00025E-NS for xen-devel@lists.xenproject.org; Wed, 18 Jun 2014 11:37:46 +0000 In-Reply-To: <1402585478-3389-8-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: xen-devel@lists.xenproject.org, Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2014-06-12 at 16:04 +0100, David Vrabel wrote: > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 64a1c77..ad50e21 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -1021,6 +1021,15 @@ static void parse_config_data(const char *config_source, > &b_info->u.hvm.smbios_firmware, 0); > xlu_cfg_replace_string(config, "acpi_firmware", > &b_info->u.hvm.acpi_firmware, 0); > + > + /* Generate and set a new random VM Generation ID? */ > + if (!xlu_cfg_get_long(config, "generation_id", &l, 0)) { xlu_cfg_* returns present/notpresent not the value. You need to check the actual value of l here. Otherwise generation_id=0 in the cfg will cause it to be unexpectedly generated. Did you want to rename this key to ms_vm_genid for consistency? I suppose there is no call for actually specifying a genid? If there were then I'd suggest ms_vm_genid = "generate" as the syntax leaving the way open for a future extension of giving a number here. > + e = libxl_ms_vm_genid_generate(ctx, &b_info->u.hvm.ms_vm_genid); > + if (e) { > + fprintf(stderr, "ERROR: no random numbers available for \"generation_id\"\n"); That's very specific. How about "unable to generate ..."?