very-undude / ultimatedeployment

Ultimate Deployment Applicance
GNU General Public License v3.0
27 stars 5 forks source link

Subtemplate Creation Timeout/Missing Items #12

Open paulmx86 opened 2 years ago

paulmx86 commented 2 years ago

Usage: ESXi kickstart creation Version: 3.0 - patch 4

Issue: When using a template that has more than 80 subtemplates to create/update, some subtemplate/kickstart.cfg files are not created during the 'save' process, and the webpage does not return to the "Templates" page, it just stays blank. The website does not return to the "Templates" page after around 60 subtemplates, but fails to create some of them after around 75.

Wondering if there is a processing timeout when creating/saving the kickstart .cfg files that can be adjusted?

I do have a rather large "advanced" / kickstart file, with just over 800 lines of code/text, and my subtemplates consist of12 variables.

Workaround is to not keep a full inventory of subtemplates, with a total less than 60.

General comment - the UDA is one of the best things a sysadmin could have. I truly appreciate this project, the effort that went into it, the updates in the last year, and all the time it saves me when building systems. Thank you!

very-undude commented 2 years ago

Can you check if the disk (system volume) or the memory of the VM is full? You can extend the diskspace by adding a new disk and going to System->diskspace to attach it to the system volume. You can also see the current disk usage there. If that is not it you could try expanding the memory to 1024m.

There may also be a bug in the search and replace of the variables into the template. You're obvioulsy pushing the limits here :-) Can you try to leave out some of the 12 variables and see if the problem disappears? You could narrow down the problem by adding columns until it does not work anymore.

Or it could be a timeout issue indeed, in that case I'd have to find out how to solve that!

Thanks for your kind words!

TheNetworkIsDown commented 2 years ago

I noticed too that uda2 was way faster at that operation. It was almost instantaneous. Now it is not.

TheNetworkIsDown commented 7 months ago

Look at /var/public/cgi-bin/config.pl

The issue seems to be doing a lot of system calls to get the hostname (and not caching it)

$config{UDA_HOSTNAME}=`hostname`;

The function in which this happens is called for every line of the kickstart template in order to perform the instantiation of the template (and this for every host/subtemplate). No miracle that this is slow.

I'd suggest using Sys::Hostname to accelerate this, i.e.

#!/usr/bin/perl

use Sys::Hostname; # at the top of the file

...
$config{UDA_HOSTNAME}=hostname; # note: no backticks!
...

After that, saving a template becomes almost instantaneous.

paulmx86 commented 7 months ago

Look at /var/public/cgi-bin/config.pl

The issue seems to be doing a lot of system calls to get the hostname (and not caching it)

$config{UDA_HOSTNAME}=`hostname`;

The function in which this happens is called for every line of the kickstart template in order to perform the instantiation of the template (and this for every host/subtemplate). No miracle that this is slow.

I'd suggest using Sys::Hostname to accelerate this, i.e.

#!/usr/bin/perl

use Sys::Hostname; # at the top of the file

...
$config{UDA_HOSTNAME}=hostname; # note: no backticks!
...

After that, saving a template becomes almost instantaneous.

I tested with the changes and I can now manage more than 50 subtemplates along with shorter save/generation time.
Great discovery and follow up on an old issue. I greatly appreciate it and thank you for your efforts!