mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2024-12-24 21:34:43 +03:00
memory: rename qemu_dimm_list to qemu_memdevices_list
current qemu_dimm_list can return any kind of memory devices. make it more generic, with an optionnal type device Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
parent
49c51a60db
commit
1e28e8ba92
@ -240,7 +240,7 @@ sub qemu_memory_hotplug {
|
|||||||
while (1) {
|
while (1) {
|
||||||
eval { PVE::QemuServer::qemu_devicedel($vmid, $name) };
|
eval { PVE::QemuServer::qemu_devicedel($vmid, $name) };
|
||||||
sleep 3;
|
sleep 3;
|
||||||
my $dimm_list = qemu_dimm_list($vmid);
|
my $dimm_list = qemu_memdevices_list($vmid, 'dimm');
|
||||||
last if !$dimm_list->{$name};
|
last if !$dimm_list->{$name};
|
||||||
raise_param_exc({ $name => "error unplug memory module" }) if $retry > 5;
|
raise_param_exc({ $name => "error unplug memory module" }) if $retry > 5;
|
||||||
$retry++;
|
$retry++;
|
||||||
@ -255,14 +255,14 @@ sub qemu_memory_hotplug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub qemu_dimm_list {
|
sub qemu_memdevices_list {
|
||||||
my ($vmid) = @_;
|
my ($vmid, $type) = @_;
|
||||||
|
|
||||||
my $dimmarray = mon_cmd($vmid, "query-memory-devices");
|
my $dimmarray = mon_cmd($vmid, "query-memory-devices");
|
||||||
my $dimms = {};
|
my $dimms = {};
|
||||||
|
|
||||||
foreach my $dimm (@$dimmarray) {
|
foreach my $dimm (@$dimmarray) {
|
||||||
|
next if $type && $dimm->{data}->{id} !~ /^$type(\d+)$/;
|
||||||
$dimms->{$dimm->{data}->{id}}->{id} = $dimm->{data}->{id};
|
$dimms->{$dimm->{data}->{id}}->{id} = $dimm->{data}->{id};
|
||||||
$dimms->{$dimm->{data}->{id}}->{node} = $dimm->{data}->{node};
|
$dimms->{$dimm->{data}->{id}}->{node} = $dimm->{data}->{node};
|
||||||
$dimms->{$dimm->{data}->{id}}->{addr} = $dimm->{data}->{addr};
|
$dimms->{$dimm->{data}->{id}}->{addr} = $dimm->{data}->{addr};
|
||||||
|
Loading…
Reference in New Issue
Block a user