Bug 883007

Summary: max_storage_per_gear is not respected for additional storage changes
Product: OKD Reporter: Rajat Chopra <rchopra>
Component: PodAssignee: Rajat Chopra <rchopra>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: qgong
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-19 19:27:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rajat Chopra 2012-12-03 15:52:10 UTC
Description of problem:
  When adding addtional storage to a cartridge, the max_storage_per_gear is looked up and it needs to be greater than zero, but after that the limit is not checked up against.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Set max_storage_per_gear for user's capabilities
2. Create an app and set additional_storage for a cartridge. Let addtional storage be more than the max setting.
3. Also add more storage with another cartridge, such that the sum of addtional_storage by cartridges is more than max setting.
  
Actual results:
The additional_storage is granted without error

Expected results:
The max_storage_per_gear setting should limit the actual additional storage given per gear.

Additional info:

Comment 1 Rajat Chopra 2012-12-06 05:44:58 UTC
*** Bug 883758 has been marked as a duplicate of this bug. ***

Comment 2 Rajat Chopra 2012-12-06 05:47:24 UTC
fixed with rev#c9a27efdd57c2828cbfe3cb13eee8a0440362b21 in origin-server.repo !

Comment 3 Rony Gong 🔥 2012-12-06 11:53:04 UTC
Reopened on devenv_2562
1.Set "capabilities.max_storage_per_gear" =>  20 

for non_scalable app, it isn't right, since 19+1+1>20
[qgong@localhost dev]$ rhc cartridge storage -a qjbossas --show
Password: 
RESULT:

JBoss Application Server 7.1
============================
  Base Gear Storage       = 1GB
  Additional Gear Storage = 1GB

MySQL Database 5.1
==================
  Base Gear Storage       = 1GB
  Additional Gear Storage = 19GB


For scalable app, it is right, since I can't add 1 G storage to any of below cartridge any more.
[qgong@localhost dev]$ rhc cartridge storage -a qshp --show
Password: 
RESULT:

PHP 5.3
=======
  Additional Gear Storage = 2GB
  Base Gear Storage       = 1GB

HAProxy 1.4
===========
  Additional Gear Storage = 17GB
  Base Gear Storage       = 1GB

MongoDB NoSQL Database 2.2
==========================
  Additional Gear Storage = 19GB
  Base Gear Storage       = 1GB

as action:
[qgong@localhost dev]$ rhc cartridge storage -a qshp -c php-5.3 --add 1
Password: 

Total additional storage for all cartridges on gear should be less than max_storage_per_gear (current: 19.0, max: 20).

Comment 4 Rajat Chopra 2012-12-11 19:11:55 UTC
Fixed with rev#ff5478808279602f8b9a3ed362de9309ab2ec0bc in origin-server.repo

Comment 5 Rony Gong 🔥 2012-12-12 08:52:25 UTC
Verified on devenv_2589
1.For non_scalable app
[qgong@localhost dev]$ rhc cartridge storage -a qjbossas --show
Password: 


RESULT:

JBoss Application Server 7.1
============================
  Base Gear Storage       = 1GB
  Additional Gear Storage = None

MySQL Database 5.1
==================
  Base Gear Storage       = 1GB
  Additional Gear Storage = 25GB

[qgong@localhost dev]$ rhc cartridge storage -a qjbossas -c jbossas-7 --add 5
Password: 

Total additional storage for all cartridges on gear should be less than max_storage_per_gear (new_storage: 31.0, max: 30).
[qgong@localhost dev]$ rhc cartridge storage -a qjbossas -c jbossas-7 --add 4
Password: 


RESULT:
Success: additional storage space set to 4GB
Storage Info
============
  Base Gear Storage       = 1GB
  Additional Gear Storage = 4G


2. For scalable_app
[qgong@localhost dev]$ rhc cartridge storage -a qsphp --show
Password: 


RESULT:

PHP 5.3
=======
  Additional Gear Storage = None
  Base Gear Storage       = 1GB

HAProxy 1.4
===========
  Additional Gear Storage = None
  Base Gear Storage       = 1GB

PostgreSQL Database 8.4
=======================
  Additional Gear Storage = None
  Base Gear Storage       = 1GB

[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c postgresql-8.4 --set 20
Password: 


RESULT:
Success: additional storage space set to 20GB
Storage Info
============
  Base Gear Storage       = 1GB
  Additional Gear Storage = 20GB

[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c postgresql-8.4 --add 9
Password: 


RESULT:
Success: additional storage space set to 29GB
Storage Info
============
  Additional Gear Storage = 29GB
  Base Gear Storage       = 1GB

[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c postgresql-8.4 --add 1
Password: 

Total additional storage for all cartridges on gear should be less than max_storage_per_gear (new_storage: 31.0, max: 30).
[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c haproxy-1.4 --set 25
Password: 


RESULT:
Success: additional storage space set to 25GB
Storage Info
============
  Additional Gear Storage = 25GB
  Base Gear Storage       = 1GB

[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c php-5.3 --set 4
Password: 


RESULT:
Success: additional storage space set to 4GB
Storage Info
============
  Base Gear Storage       = 1GB
  Additional Gear Storage = 4GB

[qgong@localhost dev]$ rhc cartridge storage -a qsphp -c php-5.3 --add 1
Password: 

Total additional storage for all cartridges on gear should be less than max_storage_per_gear (new_storage: 31.0, max: 30).