[et-mgmt-tools] [PATCH] reworked virtinst validation fixes

Cole Robinson crobinso at redhat.com
Wed Oct 3 14:24:53 UTC 2007


Daniel P. Berrange wrote:
> On Fri, Sep 28, 2007 at 01:16:27PM -0400, Cole Robinson wrote:
>> Hi all,
>>
>> This patch fixes some validation errors in virtinst uncovered by the
>> tests I just sent. I sent this a couple months ago but it must have just
>> fallen through the cracks, so I reworked it against the current tip.
>> This stuff is pretty simple and handy for useful error reporting.
> 
> Looks ok, except for this part:
> 
> -        if path != None:
> -            self.path = os.path.abspath(path)
> -        else:
> -            self.path = None
> -            type  = VirtualDisk.TYPE_FILE # Arbitrary choice but avoids the null-path null-type case
> -
> +        self.path = path
> +
> +        if __builtin__.type(self.path) is not __builtin__.type("string"):
> +            raise ValueError, _("The disk path must be a string.")
> +        self.path = os.path.abspath(self.path)
> +
> 
> And a few places following it which don't cope with fact that self.path
> is allowed to be None. Path is allowed to be None for CDROMs so we can
> setup a disk whichout any media inserted.

I reworked this patch accommodating the case you stated above. In doing
so I also worked out a few bugs in the rest of the disk validating code.
As a result the patch changes the xml test code to use a path of
/etc/test.img instead of /xen/test.img for disk testing, since I added
a case to throw an exception if the root directory of the
path doesn't exist.

> 
> BTW, can you fix your Thunderbird so it either sends patches as text/plain,
> or just inlines them.
> 
>   http://lwn.net/Articles/249669/
> 
> Using text/x-patch as a type makes quoting & replying harder.
> 
> Regards,
> Dan.

Thanks for the tip. The attachment should be text/plain now. Let me know
if there is still an issue.

Thanks,
Cole

-- 
Cole Robinson
crobinso at redhat.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: virtinst-validation-fixes-02-patch
URL: <http://listman.redhat.com/archives/et-mgmt-tools/attachments/20071003/01ef8cbc/attachment.ksh>


More information about the et-mgmt-tools mailing list