Thanks for doing this. One question: should we disable migration, if this parameter is used? Would it make sense to be able to pass more than one device? (eg. many separated by a comma?)
Finally, would you mind signing the Google code CLA, so we can include your patch? http://code.google.com/legal/individual-cla-v1.0.html Thanks a lot, Guido On Thu, Jun 7, 2012 at 1:26 PM, Jack <[email protected]> wrote: > Hi, > I wrote about pci passthrough in > https://groups.google.com/group/ganeti/browse_thread/thread/4b66136f6950dce6 > , and I wrote this patch for use the instance parameter. > sorry for my terrible English. > > But I used ganeti-2.5.1.tar.gz, not git, and build and create instance > with -H pci_pass=XX:XX.X instance_name > #diff command diff -r -c ganeti-2.5.1_orig/lib/ ganeti-2.5.1/lib/ > Patch text: > > diff -r -c ganeti-2.5.1_orig/lib/ ganeti-2.5.1/lib/ > diff -r -c ganeti-2.5.1_orig/lib//constants.py ganeti-2.5.1/lib// > constants.py > *** ganeti-2.5.1_orig/lib//constants.py 2012-05-11 16:55:13.000000000 > +0400 > --- ganeti-2.5.1/lib//constants.py 2012-06-05 10:50:27.000000000 > +0400 > *************** > *** 698,703 **** > --- 698,704 ---- > HV_KVM_USE_CHROOT = "use_chroot" > HV_CPU_MASK = "cpu_mask" > HV_MEM_PATH = "mem_path" > + HV_PASSTHROUGH = "pci_pass" > HV_BLOCKDEV_PREFIX = "blockdev_prefix" > HV_REBOOT_BEHAVIOR = "reboot_behavior" > > *************** > *** 743,748 **** > --- 744,750 ---- > HV_KVM_USE_CHROOT: VTYPE_BOOL, > HV_CPU_MASK: VTYPE_STRING, > HV_MEM_PATH: VTYPE_STRING, > + HV_PASSTHROUGH: VTYPE_STRING, > HV_BLOCKDEV_PREFIX: VTYPE_STRING, > HV_REBOOT_BEHAVIOR: VTYPE_STRING, > } > *************** > *** 1280,1285 **** > --- 1282,1288 ---- > HV_MIGRATION_MODE: HT_MIGRATION_NONLIVE, > HV_USE_LOCALTIME: False, > HV_BLOCKDEV_PREFIX: "hd", > + HV_PASSTHROUGH: "", > HV_REBOOT_BEHAVIOR: INSTANCE_REBOOT_ALLOWED, > }, > HT_KVM: { > diff -r -c ganeti-2.5.1_orig/lib//hypervisor/hv_xen.py ganeti-2.5.1/ > lib//hypervisor/hv_xen.py > *** ganeti-2.5.1_orig/lib//hypervisor/hv_xen.py 2012-05-11 > 16:55:13.000000000 +0400 > --- ganeti-2.5.1/lib//hypervisor/hv_xen.py 2012-06-07 > 16:10:10.993086257 +0400 > *************** > *** 579,585 **** > constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, > # TODO: Add a check for the blockdev prefix (matching [a-z:] or > similar). > constants.HV_BLOCKDEV_PREFIX: hv_base.NO_CHECK, > ! constants.HV_REBOOT_BEHAVIOR: > hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS) > } > > --- 579,587 ---- > constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, > # TODO: Add a check for the blockdev prefix (matching [a-z:] or > similar). > constants.HV_BLOCKDEV_PREFIX: hv_base.NO_CHECK, > ! #passthrough pci > ! constants.HV_PASSTHROUGH: hv_base.NO_CHECK, > ! constants.HV_REBOOT_BEHAVIOR: > hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS) > } > > *************** > *** 671,677 **** > disk_data.append(iso) > > config.write("disk = [%s]\n" % (",".join(disk_data))) > ! > config.write("on_poweroff = 'destroy'\n") > if hvp[constants.HV_REBOOT_BEHAVIOR] == > constants.INSTANCE_REBOOT_ALLOWED: > config.write("on_reboot = 'restart'\n") > --- 673,682 ---- > disk_data.append(iso) > > config.write("disk = [%s]\n" % (",".join(disk_data))) > ! # this is pci pass > ! pci_pass = hvp[constants.HV_PASSTHROUGH] > ! if pci_pass: > ! config.write("pci = ['%s']\n" % pci_pass) > config.write("on_poweroff = 'destroy'\n") > if hvp[constants.HV_REBOOT_BEHAVIOR] == > constants.INSTANCE_REBOOT_ALLOWED: > config.write("on_reboot = 'restart'\n") > diff -r -c ganeti-2.5.1_orig/lib//query.py ganeti-2.5.1/lib//query.py > *** ganeti-2.5.1_orig/lib//query.py 2012-05-11 16:55:13.000000000 > +0400 > --- ganeti-2.5.1/lib//query.py 2012-06-05 10:50:27.000000000 +0400 > *************** > *** 1638,1643 **** > --- 1638,1644 ---- > constants.HV_NIC_TYPE: "NIC_type", > constants.HV_PAE: "PAE", > constants.HV_VNC_BIND_ADDRESS: "VNC_bind_address", > + constants.HV_PASSTHROUGH: "pci_pass", > } > > fields = [ -- Guido Trotter Google - Corporate Computing Services SRE Google Ireland Ltd. : Registered in Ireland with company number 368047. Gordon House, Barrow Street, Dublin 4, Ireland.
