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

Daniel P. Berrange berrange at redhat.com
Fri Sep 28 19:30:00 UTC 2007

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.

BTW, can you fix your Thunderbird so it either sends patches as text/plain,
or just inlines them.


Using text/x-patch as a type makes quoting & replying harder.

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the et-mgmt-tools mailing list