This was pushed to stable-2.16 as 1e28788aa. I really apologize that I
noticed only after pushing that git added my name for author.  I've added
your name the commit message as 'Signed-off by', but didn't realize that
since the patch you posted was created by diff and not git, it didn't
contain the commit header. I should have done a dry-run then manually edit
the author. Sorry for that.

On Tue, Feb 7, 2017 at 11:31 AM, Ansgar Jazdzewski <
[email protected]> wrote:

> Thanks for your review.
> i'am fine with you change.
>
> Ansgar
>
> 2017-02-06 21:27 GMT+01:00 Viktor Bachraty <[email protected]>:
> > It can be helpful if you are using ext-storage (iSCSI) or ceph
> > (RBD) so free space on a SAN is possible. For backward compatibility
> > the 'default' value will not pass any option to qemu.
> >
> > Signed-off-by: Ansgar Jazdzewski <[email protected]>
> > Signed-off-by: Viktor Bachraty <[email protected]>
> > ---
> >  lib/hypervisor/hv_kvm/__init__.py | 12 ++++++++++--
> >  man/gnt-instance.rst              |  9 +++++++++
> >  src/Ganeti/Constants.hs           | 20 ++++++++++++++++++++
> >  3 files changed, 39 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/hypervisor/hv_kvm/__init__.py
> b/lib/hypervisor/hv_kvm/__init__.py
> > index 1f4184d61..0735a271e 100644
> > --- a/lib/hypervisor/hv_kvm/__init__.py
> > +++ b/lib/hypervisor/hv_kvm/__init__.py
> > @@ -488,6 +488,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
> >        hv_base.ParamInSet(True, constants.HT_KVM_VALID_DISK_TYPES),
> >      constants.HV_KVM_SCSI_CONTROLLER_TYPE:
> >        hv_base.ParamInSet(True, constants.HT_KVM_VALID_SCSI_
> CONTROLLER_TYPES),
> > +    constants.HV_DISK_DISCARD:
> > +      hv_base.ParamInSet(False, constants.HT_VALID_DISCARD_TYPES),
> >      constants.HV_KVM_CDROM_DISK_TYPE:
> >        hv_base.ParamInSet(False, constants.HT_KVM_VALID_DISK_TYPES),
> >      constants.HV_USB_MOUSE:
> > @@ -1112,6 +1114,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
> >        aio_val = ",aio=%s" % aio_mode
> >      else:
> >        aio_val = ""
> > +    # discard mode
> > +    discard_mode = up_hvp[constants.HV_DISK_DISCARD]
> > +    if discard_mode == constants.HV_DISCARD_DEFAULT:
> > +      discard_val = ""
> > +    else:
> > +      discard_val = ",discard=%s" % discard_mode
> >      # Cache mode
> >      disk_cache = up_hvp[constants.HV_DISK_CACHE]
> >      for cfdev, link_name, uri in kvm_disks:
> > @@ -1139,8 +1147,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
> >
> >        drive_uri = _GetDriveURI(cfdev, link_name, uri)
> >
> > -      drive_val = "file=%s,format=raw%s%s%s%s" % \
> > -                  (drive_uri, if_val, boot_val, cache_val, aio_val)
> > +      drive_val = "file=%s,format=raw%s%s%s%s%s" % \
> > +                  (drive_uri, if_val, boot_val, cache_val, aio_val,
> discard_val)
> >
> >        # virtio-blk-pci case
> >        if device_driver is not None:
> > diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
> > index 493ae929d..3602dbd76 100644
> > --- a/man/gnt-instance.rst
> > +++ b/man/gnt-instance.rst
> > @@ -649,6 +649,15 @@ disk\_aio
> >      so if not explicitly specified, the native mode will not
> >      be used. Possible values are: threads or native.
> >
> > +disk\_discard
> > +    Valid for the KVM hypervisor.
> > +
> > +    discard is one of "ignore", "unmap" or "default" and controls
> whether
> > +    discard (also known as trim or unmap) requests are ignored or passed
> > +    to the filesystem. Some machine types may not support discard
> requests.
> > +    For compatibility with older qemu versions "default" will not pass
> any
> > +    discard option to KVM.
> > +
> >  security\_model
> >      Valid for the KVM hypervisor.
> >
> > diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> > index 4aa5edf63..a1f84d98d 100644
> > --- a/src/Ganeti/Constants.hs
> > +++ b/src/Ganeti/Constants.hs
> > @@ -1652,6 +1652,9 @@ hvDeviceModel = "device_model"
> >  hvDiskCache :: String
> >  hvDiskCache = "disk_cache"
> >
> > +hvDiskDiscard :: String
> > +hvDiskDiscard = "disk_discard"
> > +
> >  hvDiskType :: String
> >  hvDiskType = "disk_type"
> >
> > @@ -1897,6 +1900,7 @@ hvsParameterTypes = Map.fromList
> >    , (hvCpuWeight,                       VTypeInt)
> >    , (hvDeviceModel,                     VTypeString)
> >    , (hvDiskCache,                       VTypeString)
> > +  , (hvDiskDiscard,                     VTypeString)
> >    , (hvDiskType,                        VTypeString)
> >    , (hvInitrdPath,                      VTypeString)
> >    , (hvInitScript,                      VTypeString)
> > @@ -2816,6 +2820,21 @@ htValidCacheTypes =
> >                         htCacheWback,
> >                         htCacheWthrough]
> >
> > +htDiscardDefault :: String
> > +htDiscardDefault = "default"
> > +
> > +htDiscardIgnore :: String
> > +htDiscardIgnore = "ignore"
> > +
> > +htDiscardUnmap :: String
> > +htDiscardUnmap = "unmap"
> > +
> > +htValidDiscardTypes :: FrozenSet String
> > +htValidDiscardTypes =
> > +  ConstantUtils.mkSet [htDiscardDefault,
> > +                       htDiscardIgnore,
> > +                       htDiscardUnmap]
> > +
> >  htKvmAioThreads :: String
> >  htKvmAioThreads = "threads"
> >
> > @@ -4106,6 +4125,7 @@ hvcDefaults =
> >            , (hvUseGuestAgent,                   PyValueEx False)
> >            , (hvUseLocaltime,                    PyValueEx False)
> >            , (hvDiskCache,                       PyValueEx
> htCacheDefault)
> > +          , (hvDiskDiscard,                     PyValueEx
> htDiscardDefault)
> >            , (hvSecurityModel,                   PyValueEx htSmNone)
> >            , (hvSecurityDomain,                  PyValueEx "")
> >            , (hvKvmFlag,                         PyValueEx "")
> > --
> > 2.11.0.483.g087da7b7c-goog
> >
>

Reply via email to