[pve-devel] [PATCH 4/4] hostpci rework V2
Alexandre DERUMIER
aderumier at odiso.com
Fri Sep 9 13:24:37 CEST 2011
oh, i didn't see you commit since this morning ;)
I'll rebase my patches
commit 64e1340181601ab9ae538f838499018705cad7da
Author: Dietmar Maurer <dietmar at proxmox.com>
Date: Fri Sep 9 12:13:21 2011 +0200
New method to check if VM uses local resources
commit 1ef75254a1c911f6a722635c7596bf30110924fa
Author: Dietmar Maurer <dietmar at proxmox.com>
Date: Fri Sep 9 12:10:29 2011 +0200
start fixing qmigrate (still not working)
commit f669a2b1fb33643639abc16b54ada5a632a75abf
Author: Dietmar Maurer <dietmar at proxmox.com>
Date: Fri Sep 9 11:32:53 2011 +0200
Check quorum in startall
commit 32f9da6804fe5bbd8f88b8e1cc0ee38dced47068
Author: Dietmar Maurer <dietmar at proxmox.com>
Date: Fri Sep 9 10:39:24 2011 +0200
Check quorum when starting migration tunnel
commit a78ccf26fcde25da70e6a86bac670098de3f3f16
Author: Dietmar Maurer <dietmar at proxmox.com>
Date: Fri Sep 9 09:47:54 2011 +0200
Add node parameter to config_file()
That way we can get the filename for VMs on remove nodes.
----- Mail original -----
De: "Dietmar Maurer" <dietmar at proxmox.com>
À: "Derumier Alexandre" <aderumier at odiso.com>, pve-devel at pve.proxmox.com
Envoyé: Vendredi 9 Septembre 2011 13:17:25
Objet: RE: [pve-devel] [PATCH 4/4] hostpci rework V2
I can't apply that patch:
Applying: hostpci rework V2
/home/dietmar/pve2-devel/qemu-server/.git/rebase-apply/patch:74: trailing whitespace.
sub verify_hostpci {
error: patch failed: PVE/QemuServer.pm:1204
error: PVE/QemuServer.pm: patch does not apply
Maybe you can rebase that and send again?
- Dietmar
> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Derumier Alexandre
> Sent: Freitag, 09. September 2011 10:27
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH 4/4] hostpci rework V2
>
>
> Signed-off-by: Derumier Alexandre <aderumier at odiso.com>
> ---
> PVE/QemuServer.pm | 109 +++++++++++++++++++++++++++++++++-------------
> ------
> 1 files changed, 69 insertions(+), 40 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index e76fc80..455ca0d
> 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -287,22 +287,6 @@ EODESC
> typetext => '[[model=]i6300esb|ib700]
> [,[action=]reset|shutdown|poweroff|pause|debug|none]',
> description => "Create a virtual hardware watchdog device. Once
> enabled (by a guest action), the watchdog must be periodically polled by an
> agent inside the guest or else the guest will be restarted (or execute the action
> specified)",
> },
> - hostpci => {
> - optional => 1,
> - type => 'string', format => 'pve-qm-hostpci',
> - typetext => "HOSTPCIDEVICE { , HOSTPCIDEVICE }",
> - description => <<EODESCR,
> -Map host pci devices. HOSTPCIDEVICE syntax is:
> -
> -'bus:dev.func' (hexadecimal numbers)
> -
> -You can us the 'lspci' command to list existing pci devices.
> -
> -Note: This option allows direct access to host hardware. So it is no longer
> possible to migrate such machines - use with special care.
> -
> -Experimental: user reported problems with this option.
> -EODESCR
> - },
> serial => {
> optional => 1,
> type => 'string', format => 'pve-qm-serial', @@ -406,6 +390,7 @@ my
> $MAX_VIRTIO_DISKS = 6; my $MAX_USB_DEVICES = 5; my $MAX_NETS = 6; my
> $MAX_UNUSED_DISKS = 8;
> +my $MAX_HOSTPCI_DEVICES = 2;
>
> my $nic_model_list = ['rtl8139', 'ne2k_pci', 'e1000', 'pcnet', 'virtio',
> 'ne2k_isa', 'i82551', 'i82557b', 'i82559er']; @@ -444,6
> +429,28 @@ for (my $i = 0; $i < $MAX_NETS; $i++) {
> $confdesc->{"net$i"} = $netdesc;
> }
>
> +my $hostpcidesc = {
> + optional => 1,
> + type => 'string', format => 'pve-qm-hostpci',
> + typetext => "HOSTPCIDEVICE",
> + description => <<EODESCR,
> +Map host pci devices. HOSTPCIDEVICE syntax is:
> +
> +'bus:dev.func' (hexadecimal numbers)
> +
> +You can us the 'lspci' command to list existing pci devices.
> +
> +Note: This option allows direct access to host hardware. So it is no longer
> possible to migrate such machines - use with special care.
> +
> +Experimental: user reported problems with this option.
> +EODESCR
> +};
> +PVE::JSONSchema::register_standard_option("pve-qm-hostpci",
> +$hostpcidesc);
> +
> +for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++) {
> + $confdesc->{"hostpci$i"} = $hostpcidesc; }
> +
> my $drivename_hash;
>
> my $idedesc = {
> @@ -1025,17 +1032,14 @@ sub verify_drive { }
>
> PVE::JSONSchema::register_format('pve-qm-hostpci', \&verify_hostpci); -sub
> verify_hostpci {
> +sub verify_hostpci {
> my ($value, $noerr) = @_;
>
> - my @dl = split (/,/, $value);
> - foreach my $v (@dl) {
> - if ($v !~ m/^[a-f0-9]{2}:[a-f0-9]{2}\.[a-f0-9]$/i) {
> - return undef if $noerr;
> - die "unable to parse pci id\n";
> - }
> - }
> - return $value;
> + return $value if parse_hostpci($value);
> +
> + return undef if $noerr;
> +
> + die "unable to parse pci id\n";
> }
>
> PVE::JSONSchema::register_format('pve-qm-watchdog', \&verify_watchdog);
> @@ -1071,6 +1075,22 @@ sub parse_watchdog {
> return $res;
> }
>
> +sub parse_hostpci_device {
> + my ($value) = @_;
> +
> + return undef if !$value;
> +
> + my $res = {};
> +
> + if ($value =~ m/^[a-f0-9]{2}:[a-f0-9]{2}\.[a-f0-9]$/) {
> + $res->{pciid} = $1;
> + } else {
> + return undef;
> + }
> +
> + return $res;
> +}
> +
> sub parse_usb_device {
> my ($value) = @_;
>
> @@ -1204,6 +1224,15 @@ sub cfs_config_path {
> return "nodes/$nodename/qemu-server/$vmid.conf";
> }
>
> +sub check_iommu_support{
> + #fixme : need to check IOMMU support
> +
> +#http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM
> +
> + my $iommu=1;
> + return $iommu;
> +
> +}
> +
> sub config_file {
> my ($vmid) = @_;
>
> @@ -1939,11 +1968,10 @@ sub config_to_command {
> push @$cmd, '-device', 'usb-tablet,bus=ehci.0,port=6' if $tablet;
>
> # host pci devices
> - if (my $pcidl = $conf->{hostpci}) {
> - my @dl = split (/,/, $pcidl);
> - foreach my $dev (@dl) {
> - push @$cmd, '-device', "pci-assign,host=$dev" if $dev;
> - }
> + for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++) {
> + my $d = parse_hostpci_device($conf->{"hostpci$1"});
> + next if !$d;
> + push @$cmd, '-device',
> + "pci-assign,host=$d->{pciid},id=hostpci$i";
> }
>
> # usb devices
> @@ -2257,17 +2285,18 @@ sub vm_start {
> my $defaults = load_defaults();
>
> my ($cmd, $vollist) = config_to_command ($storecfg, $vmid, $conf,
> $defaults, $migrate_uri);
> +
> # host pci devices
> - if (my $pcidl = $conf->{hostpci}) {
> - my @dl = split (/,/, $pcidl);
> - foreach my $dev (@dl) {
> - $dev = lc($dev);
> - my $info = pci_device_info("0000:$dev");
> - die "no pci device info for device '$dev'\n" if !$info;
> - die "can't unbind pci device '$dev'\n" if
> !pci_dev_bind_to_stub($info);
> - die "can't reset pci device '$dev'\n" if !pci_dev_reset($info);
> - }
> - }
> +
> + for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++) {
> + my $d = parse_hostpci_device($conf->{"hostpci$i"});
> + next if !$d;
> + my $info = pci_device_info("0000:$d->{pciid}");
> + die "IOMMU not present\n" if !check_iommu_support();
> + die "no pci device info for device '$d->{pciid}'\n" if !$info;
> + die "can't unbind pci device '$d->{pciid}'\n" if
> !pci_dev_bind_to_stub($info);
> + die "can't reset pci device '$d->{pciid}'\n" if !pci_dev_reset($info);
> + }
>
> PVE::Storage::activate_volumes($storecfg, $vollist);
>
> --
> 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/20110909/6a80f9af/attachment.vcf>
More information about the pve-devel
mailing list