unmk2 / ovz-web-panel

Automatically exported from code.google.com/p/ovz-web-panel
Other
0 stars 0 forks source link

vswap not handled (detected?) properly in v2.3 #496

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It appears that there is an annoying bug in v2.3 (and possibly earlier 
versions): When creating a new virtual server it assigns 1/4th the amount of 
memory/swap inputted, and in the "old" configuration format.

I do not know how the checks for vswap work yet (still reading through the 
code), but it looks like they fail when they should pass with my configuration. 
See notes below.

Steps to reproduce:
1a. create a server template using your favorite editor:
PHYSPAGES="0:64M"
SWAPPAGES="0:128M"
DISKSPACE="1.8G:2G"
DISKINODES="200000:220000"
QUOTATIME="0"
CPUUNITS="1000"

1b. restart owp to pick up the new template

2. create a new VE based on our new 64MB + 128MB memory/2GB storage template.
*note: this is where the problem starts

3. restart owp (this same problem is also noticed during an owp 
upgrade/physical server reboot/etc)

4. look at the VE list in OWP and notice it says "unlimited" for memory for our 
new VE.

5. open /etc/vz/conf/$VEID.conf in your favorite editor

Actual result:
PHYSPAGES, SWAPPAGES and DISKSPACE are set incorrectly:
  PHYSPAGES="0:16384"
  SWAPPAGES="0:32768"
  DISKSPACE="2306048:2306048"

Expected result:
  PHYSPAGES="0:64M"
  SWAPPAGES="0:128M"
  DISKSPACE="1.8G:2G"

or perhaps DISKSPACE="2G:2G" if you're not handling softlimits in the simple 
creation menu yet.

Version of the product:
2.3, latest stable release at time of posting

Server OS:
cent os 6.3 fully updated prior to owp update

Additional information:
my configuration (kernel, etc) definitely supports vswap and it works inside 
OWP (forever, even after upgrade/reboot/etc) after editing the newly made 
$VEID.conf file to match the template.

In your code in various places you're checking for 'vswap' and 
'hardware_server.vsawp' (Which I have no idea where they are defined or how 
they behave yet) to detect how to set vswap/memory settings:

if vswap.to_i > 0 and hardware_server.vswap
    content << "PHYSPAGES=\"0:#{memory}M\"\n"
    content << "SWAPPAGES=\"0:#{vswap}M\"\n"
else
    privvmpages = 0 == memory.to_i ? 'unlimited' : memory.to_i * 1024 / 4
    content << "PRIVVMPAGES=\"#{privvmpages}:#{privvmpages}\"\n"
    content << "PHYSPAGES=\"unlimited\"\n"
end

I have vswap and it falls back to the "else" statement there, I believe. This 
is wrong.

Thank you so *very* much for your wonderful software! OWP kicks butt!
-B

Original issue reported on code.google.com by intentio...@gmail.com on 4 Mar 2013 at 6:00

GoogleCodeExporter commented 9 years ago
I've noticed an even more strange behaviour: 
If I create a new VPS (via the API), I can recognize, that in OWP the "Memory, 
MB" value OF OTHER VPS goes to odd numbers or "unlimited" (which means "0" - i 
think). What is happening there! I am using OWP with mysql. 

Did anyone see such 'effect' in OWP?
Kind Regards,
-Ingo Baab

Original comment by ingob...@googlemail.com on 2 Apr 2014 at 10:49