On 10/23/2012 08:07 PM, Simon Grinberg wrote:
> 
> ----- Original Message -----
>> > From: "Charlie" <[email protected]>
>> > To: "Simon Grinberg" <[email protected]>
>> > Cc: "engine-devel" <[email protected]>
>> > Sent: Tuesday, October 23, 2012 7:53:10 PM
>> > Subject: Re: [Engine-devel] alias in disk instead of name
>> > 
>> > Why not something like this?
>> > 
>> > (pseudocode, using dot for string concatenation):
>> > 
>> > $name_prefix = "vmdrive"
>> > $name = get_last_used($name_prefix)
>> > $already_in_use = $TRUE
>> > 
>> > while $already_in_use {
>> >      prompt "Name of thing? [$name] ", $name
>> >      if name_used($name) {
>> >          while name_used($name) {
>> >             increment_number($name)
>> >          }
>> >      } else {
>> >          $already_in_use = FALSE
>> >      }
>> > }
>> > 
>> > do_whatever_you_do_with($name)
>> > 
>> > store_last_used($name)
>> > 
>> > end
>> > 
>> > 
>> > The increment_number() routine checks to see if the last character is
>> > numeric, and if it is, increments the leftmost contiguous numeric
>> > portion of the string.  Otherwise it appends the number zero.
>> > 
>> > This does not allow everyone to get any name they want, but you can't
>> > ever satisfy that demand.  It supplies reasonable defaults very
>> > quickly and it allows people who want really descriptive names to try
>> > as many as they like.
>> > 
>> > The code's built the funny way it is so that you can corrupt the db
>> > that holds the last_used numbers or interrupt the process halfway
>> > through and it still works, only slower, and it should tend to fix
>> > its
>> > own db on the fly when possible.
>> > 
>> > There's no provision for simultaneous creation, but that wouldn't be
>> > horribly hard to add, just put a lock on the resource holding
>> > last_used numbers.
>> > 
>> > You'd want to reimplement in the most efficient and readable way for
>> > your programming language of choice.
>> > 
>> > Did that make any sense?  I did it off the top of my head, so it
>> > could
>> > be terribly lame when I look at it tomorrow ;).
> Please don't look at it as pure programming item, nor as a single user in a 
> small data center - in this respect you are right.
> Let's got to a huge organization or to the cloud.
> 
> In multi tenant environment this lock means that every time a user tries to 
> change a disk name - all the others are stack
> Don't forget we are discussing thousands of VMs - I'll hate to have this kind 
> of lock just to allow for unique disk names. This is one of the reasons you 
> use UUID to really identify the object in the DB, since it's suppose to 
> guarantee uniqueness without the need to lock everything.

ID available in api, but not in UI, as you told there can be thousands of disks,
and if N of them will share same alias, admin simply won't be able identifying 
own disk.


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D
_______________________________________________
Engine-devel mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-devel

Reply via email to