server.config.disks returns wrong disk size
Closed this issue · 2 comments
Describe the bug
the object server.config.disks returns a wrong disk size.
reported disk size seems to be vmid.
code snippet:
server=node.servers.get 122
puts server.config.inspect
puts server.config.disks
returns
<Fog::Compute::Proxmox::ServerConfig
vmid=122,
digest="fbb751b64ace4242cc19b09bee64185a8d4b738f",
description=nil,
ostype="l26",
smbios1="uuid=2ecf0e47-e58b-44d1-b9e3-3ee639df5495",
numa=0,
kvm=1,
vcpus=nil,
cores=1,
bootdisk="virtio1",
onboot=0,
boot=nil,
agent="0",
scsihw=nil,
sockets=1,
memory=2048,
min_memory=nil,
shares=nil,
balloon=0,
name="abel-carrano.pm.hz",
cpu="cputype=kvm64",
cpulimit=nil,
cpuunits=nil,
keyboard="en-us",
vga="std",
interfaces= <Fog::Compute::Proxmox::Interfaces
[
<Fog::Compute::Proxmox::Interface
id="net0",
mac="96:FF:43:13:D8:0D",
model="e1000",
name=nil,
ip=nil,
ip6=nil,
bridge="vmbr0",
firewall="0",
link_down="0",
rate=nil,
queues=nil,
tag=nil
>
]
>,
disks= <Fog::Compute::Proxmox::Disks
[
<Fog::Compute::Proxmox::Disk
id="ide2",
volid="none",
size=nil,
storage=nil,
cache=nil,
replicate=nil,
media="cdrom",
format=nil,
model=nil,
shared=nil,
snapshot=nil,
backup=nil,
aio=nil,
mp=nil
>,
<Fog::Compute::Proxmox::Disk
id="virtio1",
volid=nil,
size=122,
storage="local",
cache="none",
replicate=nil,
media=nil,
format=nil,
model=nil,
shared=nil,
snapshot=nil,
backup=nil,
aio=nil,
mp=nil
>
]
>
>
json content:
{"kvm"=>1, "smbios1"=>"uuid=2ecf0e47-e58b-44d1-b9e3-3ee639df5495", "ide2"=>"none,media=cdrom", "keyboard"=>"en-us", "cpu"=>"cputype=kvm64", "sockets"=>1, "numa"=>0, "virtio1"=>"local:122/vm-122-disk-0.raw,cache=none,size=15G", "digest"=>"fbb751b64ace4242cc19b09bee64185a8d4b738f", "memory"=>2048, "agent"=>"0", "vmgenid"=>"ec44cc56-1b0c-4bfb-9ad6-bd1c76ac5d65", "bootdisk"=>"virtio1", "net0"=>"e1000=96:FF:43:13:D8:0D,bridge=vmbr0,firewall=0,link_down=0", "cores"=>1, "vga"=>"std", "onboot"=>0, "ostype"=>"l26", "name"=>"abel-carrano.pm.hz", "balloon"=>0}
Expected behavior
correct disk size should be reported (15G) 15 * 1024 * 1024 * 1024
I tried to fix the issue but I do not fully understand the insides of the function
lib/fog/proxmox/helpers/disk_helper/extract_storage_volid_size
my basic approach was to create something like this:
size = disk_value.match(/size=(\w+)/)[1]
Thanks! You could post a PR. This project is open. See how to contribute. Your help is really welcome. You should write a test spec in disk_helper_test.spec. It helps.
Hi!
I'd really like to fix that bug but I need some help. Could you please explain the functionality of the method lib/fog/proxmox/helpers/disk_helper/extract_storage_volid_size in more detail? What are the possible different cases for the disk_value parameter?