[pve-devel] [PATCH] add print_pci_addr

Alexandre DERUMIER aderumier at odiso.com
Thu Sep 15 09:29:46 CEST 2011


ok, don't hesitate to cleanup my code, i don't have yet your style ;) 


I'll try to do better next time :) 




----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Derumier Alexandre" <aderumier at odiso.com>, pve-devel at pve.proxmox.com 
Envoyé: Jeudi 15 Septembre 2011 09:13:24 
Objet: RE: [pve-devel] [PATCH] add print_pci_addr 

thanks, commited. 

also committed a few coding style cleanup 

> -----Original Message----- 
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel- 
> bounces at pve.proxmox.com] On Behalf Of Derumier Alexandre 
> Sent: Donnerstag, 15. September 2011 06:48 
> To: pve-devel at pve.proxmox.com 
> Subject: [pve-devel] [PATCH] add print_pci_addr 
> 
> contain devices pci addr and bus mapping return formated string with 
> bus=pci.x,addr=x 
> 
> also in this commit, use it for virtio disk 
> 
> Signed-off-by: Derumier Alexandre <aderumier at odiso.com> 
> --- 
> PVE/QemuServer.pm | 31 +++++++++++++++++++++++++++++-- 
> 1 files changed, 29 insertions(+), 2 deletions(-) 
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index c15cbfa..c1d99e8 
> 100644 
> --- a/PVE/QemuServer.pm 
> +++ b/PVE/QemuServer.pm 
> @@ -887,8 +887,8 @@ sub print_drivedevice_full { 
> my $maxdev = 0; 
> 
> if ($drive->{interface} eq 'virtio') { 
> - 
> - $device="virtio-blk-pci,drive=drive-$drive->{interface}$drive- 
> >{index},id=device-$drive->{interface}$drive->{index}"; 
> + my $pciaddr=print_pci_addr("$drive->{interface}$drive->{index}"); 
> + 
> + $device="virtio-blk-pci,drive=drive-$drive->{interface}$drive->{index} 
> + ,id=device-$drive->{interface}$drive->{index}$pciaddr"; 
> } 
> 
> elsif ($drive->{interface} eq 'scsi') { @@ -2781,4 +2781,31 @@ sub 
> pci_dev_bind_to_stub { 
> return -d $testdir; 
> } 
> 
> +sub print_pci_addr() { 
> + my ($id) = @_; 
> + my $res = ''; 
> + my $devices = {}; 
> + 
> + $devices->{virtio0}->{bus} = 0; 
> + $devices->{virtio0}->{addr} = 10; 
> + $devices->{virtio1}->{bus} = 0; 
> + $devices->{virtio1}->{addr} = 11; 
> + $devices->{virtio2}->{bus} = 0; 
> + $devices->{virtio2}->{addr} = 12; 
> + $devices->{virtio3}->{bus} = 0; 
> + $devices->{virtio3}->{addr} = 13; 
> + $devices->{virtio4}->{bus} = 0; 
> + $devices->{virtio4}->{addr} = 14; 
> + $devices->{virtio5}->{bus} = 0; 
> + $devices->{virtio5}->{addr} = 15; 
> + 
> + 
> + if (defined ($devices->{$id}->{bus}) && defined ($devices->{$id}->{addr})) { 
> + my $addr = sprintf("0x%x", $devices->{$id}->{addr}); 
> + $res = ",bus=pci.$devices->{$id}->{bus},addr=$addr"; 
> + } 
> + return $res; 
> + 
> +} 
> + 
> 1; 
> -- 
> 1.7.2.5 
> 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 





-- 

-- 




	
	Alexandre Derumier 
Ingénieur système 
e-mail : aderumier at odiso.com 
Tél : +33 (0)3 20 68 88 90 
Fax : +33 (0)3 20 68 90 81 
45 Bvd du Général Leclerc 
59100 ROUBAIX - FRANCE 













-------------- next part --------------
A non-text attachment was scrubbed...
Name: aderumier.vcf
Type: text/x-vcard
Size: 183 bytes
Desc: not available
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20110915/50508411/attachment.vcf>


More information about the pve-devel mailing list