mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[libvirt|compute] Handle integer capacities
This commit is contained in:
parent
46b53e0db7
commit
5334fcd8cd
1 changed files with 9 additions and 3 deletions
|
@ -107,9 +107,15 @@ module Fog
|
|||
end
|
||||
|
||||
def split_size_unit(text)
|
||||
matcher=text.match(/(\d+)(.+)/)
|
||||
size = matcher[1]
|
||||
unit = matcher[2]
|
||||
if text.kind_of? Integer
|
||||
# if text is an integer, match will fail
|
||||
size = text
|
||||
unit = 'G'
|
||||
else
|
||||
matcher = text.match(/(\d+)(.+)/)
|
||||
size = matcher[1]
|
||||
unit = matcher[2]
|
||||
end
|
||||
[size, unit]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue