[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 3/3] DiskDevice.__init__ expects an "exists" parameter, so add it.



> > diff --git a/storage/devices.py b/storage/devices.py
> > index 1598497..62bebd0 100644
> > --- a/storage/devices.py
> > +++ b/storage/devices.py
> > @@ -728,7 +728,8 @@ class DiskDevice(StorageDevice):
> >  
> >      def __init__(self, device, format=None,
> >                   size=None, major=None, minor=None, sysfsPath='',
> > -                 parents=None, serial=None, vendor="", bus=""):
> > +                 parents=None, serial=None, vendor="", bus="",
> > +                 exists=True):
> >          """ Create a DiskDevice instance.
> >  
> >              Arguments:
> > @@ -752,7 +753,7 @@ class DiskDevice(StorageDevice):
> >              DiskDevices always exist.
> >          """
> >          StorageDevice.__init__(self, device, format=format, size=size,
> > -                               major=major, minor=minor, exists=True,
> > +                               major=major, minor=minor, exists=exists,
> >                                 sysfsPath=sysfsPath, parents=parents,
> >                                 serial=serial, vendor=vendor, bus=bus)
> >  
> 
> How can this be necessary? DiskDevice instances always exist since we do
> not have the ability to create them.

It's necessary because in the two places we create a DiskDevice, you'll
see...

            device = DiskDevice(name,
                            major=udev_device_get_major(info),
                            minor=udev_device_get_minor(info),
                            sysfsPath=sysfs_path, exists=True,
                            serial=udev_device_get_serial(info))
and...
                device = DiskDevice(name,
                                major=udev_device_get_major(info),
                                minor=udev_device_get_minor(info),
                                sysfsPath=sysfs_path, exists=True)

Both of these are from storage/devicetree.py.  They both appear to be
because you did a s/StorageDevice/DiskDevice/ in 414e70f9 (whole disk
formatting).  You must have assumed that DiskDevice took an exists=
parameter because every other class does.

My change appeared to be simpler and take care of an inconsistency in
*Device.__init__ arguments.

- Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]