mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-03 16:35:54 +00:00
further code cleanups
This commit is contained in:
parent
e8b9c17cac
commit
1dc4f49676
@ -1302,7 +1302,7 @@ sub create_disks {
|
|||||||
die "image '$path' does not exists\n";
|
die "image '$path' does not exists\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PVE::QemuServer::vm_deviceadd ($storecfg,$vmid,$ds, $disk);
|
PVE::QemuServer::vm_deviceadd($storecfg, $vmid, $ds, $disk);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2248,31 +2248,32 @@ sub next_migrate_port {
|
|||||||
sub vm_devices_list {
|
sub vm_devices_list {
|
||||||
my ($vmid) = @_;
|
my ($vmid) = @_;
|
||||||
|
|
||||||
my $res = vm_monitor_command ($vmid, "info pci", 1);
|
my $res = vm_monitor_command ($vmid, "info pci", 1);
|
||||||
|
|
||||||
my @lines = split ("\n", $res);
|
my @lines = split ("\n", $res);
|
||||||
my $devices;
|
my $devices;
|
||||||
my $bus;
|
my $bus;
|
||||||
my $addr;
|
my $addr;
|
||||||
my $id;
|
my $id;
|
||||||
foreach my $line (@lines) {
|
|
||||||
$line =~ s/^\s+//;
|
foreach my $line (@lines) {
|
||||||
if ($line =~ m/^Bus (\d+), device (\d+), function (\d+):$/) {
|
$line =~ s/^\s+//;
|
||||||
$bus=$1;
|
if ($line =~ m/^Bus (\d+), device (\d+), function (\d+):$/) {
|
||||||
$addr=$2;
|
$bus=$1;
|
||||||
}
|
$addr=$2;
|
||||||
if ($line =~ m/^id "([a-z][a-z_\-]*\d*)"$/) {
|
}
|
||||||
|
if ($line =~ m/^id "([a-z][a-z_\-]*\d*)"$/) {
|
||||||
$id=$1;
|
$id=$1;
|
||||||
$devices->{$id}->{bus}=$bus;
|
$devices->{$id}->{bus}=$bus;
|
||||||
$devices->{$id}->{addr}=$addr;
|
$devices->{$id}->{addr}=$addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $devices;
|
return $devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub vm_deviceadd {
|
sub vm_deviceadd {
|
||||||
my ($storecfg,$vmid, $deviceid,$device) = @_;
|
my ($storecfg, $vmid, $deviceid, $device) = @_;
|
||||||
|
|
||||||
my $cfspath = cfs_config_path($vmid);
|
my $cfspath = cfs_config_path($vmid);
|
||||||
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
|
||||||
@ -2281,9 +2282,9 @@ sub vm_deviceadd {
|
|||||||
|
|
||||||
if($deviceid =~ m/^(virtio)(\d+)$/) {
|
if($deviceid =~ m/^(virtio)(\d+)$/) {
|
||||||
|
|
||||||
my $drive = print_drive_full($storecfg,$vmid, $device);
|
my $drive = print_drive_full($storecfg, $vmid, $device);
|
||||||
vm_monitor_command($vmid, "drive_add auto $drive", 1);
|
vm_monitor_command($vmid, "drive_add auto $drive", 1);
|
||||||
my $devicefull = print_drivedevice_full($storecfg,$vmid, $device);
|
my $devicefull = print_drivedevice_full($storecfg, $vmid, $device);
|
||||||
vm_monitor_command($vmid, "device_add $devicefull", 1);
|
vm_monitor_command($vmid, "device_add $devicefull", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user