[et-mgmt-tools] [PATCH]: Print a better error message if the disk path doesn't exist
Cole Robinson
crobinso at redhat.com
Mon Oct 29 15:02:30 UTC 2007
Chris Lalancette wrote:
> Cole Robinson wrote:
>> Hi Chris,
>>
>> Actually just yesterday I committed some validation cases to virtinst which
>> catch this problem, though in a different location.
>>
>> http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=c0b20d1eaaf2
>>
>> It catches it prior to the setup() portion of the code: when
>> the disk path is passed to the VirtualDisk constructor, it now checks
>> to ensure the directory exists, and if not throws a ValueError. This
>> way virt-install can catch this and recover, then prompt the user for
>> a corrected path.
>>
>> Not sure if the relevant portion of that patch fits your needs
>> though.
>>
>
> Ah, it mostly does. Actually, I think my patch complements your patch. The
> problem is that it could be the case that *after* your check, but before the
> os.open(), the directory could be deleted, so you would still run into the
> traceback. Unlikely, I know, but still possible, so I think my patch is still
> worthwhile.
>
> Thanks,
> Chris Lalancette
One gripe:
> + except OSError:
> + raise RuntimeError, "Path to diskimage "+self.path+" does not exist"
This error message is too general, as it doesn't take into account
non-missing-path related errors, so this could swallow another legitimate
error message.
- Cole
--
Cole Robinson
crobinso at redhat.com
More information about the et-mgmt-tools
mailing list