From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 2/2] Allow memory to be specified in kvmctl Date: Tue, 09 Oct 2007 17:18:29 -0500 Message-ID: <470BFE35.6030200@us.ibm.com> References: <11919655141141-git-send-email-aliguori@us.ibm.com> <11919655153228-git-send-email-aliguori@us.ibm.com> <20071009215449.GM4335@rhun.haifa.ibm.com> <470BFC0F.5040707@us.ibm.com> <20071009221404.GO4335@rhun.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Jerone Young , Avi Kivity To: Muli Ben-Yehuda Return-path: In-Reply-To: <20071009221404.GO4335-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Muli Ben-Yehuda wrote: > On Tue, Oct 09, 2007 at 05:09:19PM -0500, Anthony Liguori wrote: > > >>>> + default: >>>> + fprintf(stderr, >>>> + "Unrecongized memory suffix: %c\n", >>>> + *endptr); >>>> + exit(1); >>>> + } >>>> + break; >>>> >>>> >>> How about adding a sanity check that memory_size makes sense here >>> rather than having kvm_create() fail obscurely? For example if the >>> user got the memory size wrong for some reason we'll end up with >>> memory_size = 0 here. >>> >> There's an exit(1) and it's using stroull() so the only way that >> memory_size could equal 0 is if the user specified --memory=0. I'm >> > > Or made a mistake and specified memory=G, or memory=100G when he meant > 100M, etc. > Okay, in that case, I agree. Have updated my patch. Regards, Anthony Liguori >> not sure I agree it's worth checking for that sort of circumstance, >> perhaps the user had a reason for doing it? >> > > I'm a fan of the principle of least surprise. > > Cheers, > Muli > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/