salt-ext-modules-vmware icon indicating copy to clipboard operation
salt-ext-modules-vmware copied to clipboard

Ensure that many disks can be created

Open waynew opened this issue 4 years ago • 2 comments

https://github.com/saltstack/salt/issues/60564

Like mentioned in that issue, when a device is created with disks we should increment. Alternatively if we really need random instead of sequential, we should just shuffle the list and pop items off instead.

waynew avatar Aug 17 '21 21:08 waynew

Also, note that this behavior affects network adapters as well. Everywhere the 'random_key' var is used in the original clouds/vmware.py source.

ssbn avatar Feb 28 '22 06:02 ssbn

I've been hit by this on 3006.6, too, and ou'll likely see the same problem with 3007.1, too (the code hasn't changed). It appears to be a significant issue, we're creating VMs automatically and when there are more than two disks per VM, I've been struck with this error quite a number of times in two days (and that's just test operations, where we initiate VM creation at a rate no higher than one per minute, most often much less). I've had cases where we had to re-run the creation job three times until it worked out without this error.

As in my specific case new processes are forked for each build, I resorted to to remembering the already used keys and keep retrying until a fresh one is found. I only now read above that incremental keys would be fine, too.

rand_disk_keys = []
...
    random_key = randint( -2099, -2000)
    while random_key in rand_disk_keys:
        random_key = randint( -2099, -2000)
    rand_disk_keys.append( random_key)

If the process instance would be living longer than per-job, some automatic means to clean the cache(s) (or re-init the sequence(s) ) on the start of each individual job) would need to be found.

jmozd avatar Jul 01 '24 15:07 jmozd