Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
itminedu
okeanos-LoD
Commits
95b4668a
Unverified
Commit
95b4668a
authored
Jul 14, 2015
by
efikalti
Committed by
Avraam Tsantekidis
Jul 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LAM-41 quotas checking
parent
dad119ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
core/fokia/provisioner.py
core/fokia/provisioner.py
+17
-17
No files found.
core/fokia/provisioner.py
View file @
95b4668a
...
...
@@ -286,36 +286,36 @@ class Provisioner:
# quotas = self.get_quotas()
# Check for VMs
pending_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'pending'
]
limit_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'limit'
]
usage_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'usage'
]
pending_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'
project_
pending'
]
limit_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'
project_
limit'
]
usage_vm
=
quotas
[
project_id
][
'cyclades.vm'
][
'
project_
usage'
]
available_vm
=
limit_vm
-
usage_vm
-
pending_vm
if
available_vm
<
kwargs
[
'cluster_size'
]:
msg
=
'Cyclades VMs out of limit'
raise
ClientError
(
msg
,
error_quotas_cluster_size
)
return
False
# Check for CPUs
pending_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'pending'
]
limit_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'limit'
]
usage_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'usage'
]
pending_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'
project_
pending'
]
limit_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'
project_
limit'
]
usage_cpu
=
quotas
[
project_id
][
'cyclades.cpu'
][
'
project_
usage'
]
available_cpu
=
limit_cpu
-
usage_cpu
-
pending_cpu
if
available_cpu
<
kwargs
[
'vcpus'
]:
msg
=
'Cyclades cpu out of limit'
raise
ClientError
(
msg
,
error_quotas_cpu
)
return
False
# Check for RAM
pending_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'pending'
]
limit_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'limit'
]
usage_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'usage'
]
pending_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'
project_
pending'
]
limit_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'
project_
limit'
]
usage_ram
=
quotas
[
project_id
][
'cyclades.ram'
][
'
project_
usage'
]
available_ram
=
(
limit_ram
-
usage_ram
-
pending_ram
)
/
self
.
Bytes_to_MB
if
available_ram
<
kwargs
[
'ram'
]:
msg
=
'Cyclades ram out of limit'
raise
ClientError
(
msg
,
error_quotas_ram
)
return
False
# Check for Disk space
pending_cd
=
quotas
[
project_id
][
'cyclades.ram'
][
'pending'
]
limit_cd
=
quotas
[
project_id
][
'cyclades.disk'
][
'limit'
]
usage_cd
=
quotas
[
project_id
][
'cyclades.disk'
][
'usage'
]
pending_cd
=
quotas
[
project_id
][
'cyclades.ram'
][
'
project_
pending'
]
limit_cd
=
quotas
[
project_id
][
'cyclades.disk'
][
'
project_
limit'
]
usage_cd
=
quotas
[
project_id
][
'cyclades.disk'
][
'
project_
usage'
]
available_cyclades_disk_GB
=
(
limit_cd
-
usage_cd
-
pending_cd
)
/
self
.
Bytes_to_GB
if
available_cyclades_disk_GB
<
kwargs
[
'disk'
]:
msg
=
'Cyclades disk out of limit'
...
...
@@ -323,16 +323,16 @@ class Provisioner:
return
False
# Check for public IPs
list_float_ips
=
self
.
network_client
.
list_floatingips
()
pending_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'pending'
]
limit_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'limit'
]
usage_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'usage'
]
pending_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'
project_
pending'
]
limit_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'
project_
limit'
]
usage_ips
=
quotas
[
project_id
][
'cyclades.floating_ip'
][
'
project_
usage'
]
available_ips
=
limit_ips
-
usage_ips
-
pending_ips
for
d
in
list_float_ips
:
if
d
[
'instance_id'
]
is
None
and
d
[
'port_id'
]
is
None
:
available_ips
+=
1
if
available_ips
<
kwargs
[
'ip_request'
]:
msg
=
'Public IPs out of limit'
raise
ClientError
(
msg
,
error_
quotas_cyclades_disk
)
raise
ClientError
(
msg
,
error_
get_ip
)
return
False
# Check for networks
pending_net
=
quotas
[
project_id
][
'cyclades.network.private'
][
'project_pending'
]
...
...
@@ -341,7 +341,7 @@ class Provisioner:
available_networks
=
limit_net
-
usage_net
-
pending_net
if
available_networks
<
kwargs
[
'network_request'
]:
msg
=
'Private Network out of limit'
raise
ClientError
(
msg
,
error_
quotas_cyclades_disk
)
raise
ClientError
(
msg
,
error_
get_network_quota
)
return
False
return
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment