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
|
end
|
||||||
|
|
||||||
def split_size_unit(text)
|
def split_size_unit(text)
|
||||||
matcher=text.match(/(\d+)(.+)/)
|
if text.kind_of? Integer
|
||||||
size = matcher[1]
|
# if text is an integer, match will fail
|
||||||
unit = matcher[2]
|
size = text
|
||||||
|
unit = 'G'
|
||||||
|
else
|
||||||
|
matcher = text.match(/(\d+)(.+)/)
|
||||||
|
size = matcher[1]
|
||||||
|
unit = matcher[2]
|
||||||
|
end
|
||||||
[size, unit]
|
[size, unit]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue