On Mon, Jan 17, 2011 at 9:38 AM, Iustin Pop <[email protected]> wrote:
> On Mon, Jan 17, 2011 at 11:30:05AM +0200, Apollon Oikonomopoulos wrote:
>> On 14:16 Fri 14 Jan     , Guido Trotter wrote:
>> > On Wed, Jan 12, 2011 at 2:17 PM, Apollon Oikonomopoulos
>> > <[email protected]> wrote:
>> > > +
>> > > +  @classmethod
>> > > +  def _InstanceAllNICFiles(cls, instance_name):
>> > > +    """Returns all existing NIC filenames
>> > > +
>> > > +    """
>> > > +    return glob.glob(utils.PathJoin(cls._NICS_DIR, "%s-[0-9]" % 
>> > > instance_name))
>> > > +
>> >
>> > Any specific reason why this is [0-9] rather than *? What if there's
>> > an instance with 10 nics? (ok, quite improbable, but...)
>> > Shall i just change it to *?
>>
>> What if there's an instance named foo and an instance named foo-bar?
>> foo-* will remove both instance's files. Of course there's an issue with
>> foo-[0-9] if we have an instance named foo and an instance named foo-2.
>>
>> I think the best solution, which also removes the globbing overhead, is
>> to do proper namespacing using a subdirectory per instance, e.g.
>> /var/run/ganeti/kvm-hypervisor/nics/foo/1 and then use os.listdir().
>> What do you think?
>
> Sounds very elegant to me :)
>

Sounds good! :) Thanks for fixing this issue! :)

Guido

Reply via email to