← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1789868] Re: RFE: Add a virtio-rng device to Nova instances by default

 

Reviewed:  https://review.opendev.org/616603
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=de512f2c025429b72ade5a5ec38a6f1bde60af3c
Submitter: Zuul
Branch:    master

commit de512f2c025429b72ade5a5ec38a6f1bde60af3c
Author: Kashyap Chamarthy <kchamart@xxxxxxxxxx>
Date:   Thu Sep 20 11:16:40 2018 +0200

    libvirt: Add a default VirtIO-RNG device to guests
    
    tl;dr: We're adding the default VirtIO-RNG device to ensure guests are
           not starved of entropy (and thus not hang) during boot time.
    
    Background
    ----------
    
    From Nova Git history, commit b94550f419 ("libvirt: configuration
    element for a random number generator device") _did_ add a default RNG
    device (but with its entropy source to the undesirable '/dev/random').
    However, the default RNG device was immediately removed in another
    commit (605677c -- "libvirt: remove explicit /dev/random rng default"),
    with this rationale:
    
        libvirt (or rather qemu) will default to /dev/random if no rng device
        path is specified [...]
    
        It's preferable for us to not duplicate this default to allow for a
        future where libvirt or the hypervisor needs to make more intelligent
        decisions about the default device to use.
    
    The above reasoning doesn't hold up, because:
    
    (a) libvirt does not make "policy" decisions, such as choosing an
        entropy source (or any other such).  Therefore Nova, as a management
        application, should make the decision here.
    
    (b) More importantly, when QEMU exposes a VirtIO-RNG device to the
        guest, that device needs a source of entropy; and QEMU by default
        uses the legacy and problematic `/dev/random` as the source —
        instead of the preferred `/dev/urandom`.  So QEMU's default for
        VirtIO-RNG devices is not sufficient, and Nova should not rely on
        it.  (Discussion[+] on 'qemu-devel' list to consider changing QEMU's
        default.)
    
                        * * *
    
    In this patch:
    
      - Make Nova configure a VirtIO-RNG device by default for guests.
        (Which will be using `/dev/urandom` as the default entropy source.)
        This will also work for Windows guests, when using VirtIO-Win
        drivers[*] on the Linux host.
    
      - The 'hw_rng_model' image metadata property is now rendered
        (temporarily) useless -- as it's not used anywhere outside the
        _add_rng_device() method.  But we don't want to deprecate it yet, as
        we may extend it (see code comment for details); docucment that.
    
    [*] https://docs.pagure.org/docs-fedora/create-windows-vms-using-virtio.html
    [+] https://lists.nongnu.org/archive/html/qemu-devel/2018-09/msg02724.html
        -- "[RFC] Virtio RNG: Consider changing the default entropy source to
        /dev/urandom?"
    
    Closes-Bug: #1789868
    
    Change-Id: I28e66c9640c38d23b8c0dbd0b05f5260bfcf6d30
    Signed-off-by: Kashyap Chamarthy <kchamart@xxxxxxxxxx>


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1789868

Title:
  RFE: Add a virtio-rng device to Nova instances by default

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  What do we want: Entropy!
  When do we want it: By default!

  Nova don't add a RNG to the guests by default; this seems a serious
  problem - the guests should get a good entropy source to ensure that
  everything during boot gets randomised, and also you sometimes get
  hangs where guests are starved of entropy (there are some newer guest
  kernels that seem more prone to this, but still it's a more general
  problem).

  Old arguments for why we didn't have a virtio-rng by default:
     a) We were using hosts /dev/random and it could block - we moved to urandom and that problem doesn't exist any more
     b) We didn't have windows drivers? We do now

  (IMHO this is fairly important - we really should have the RNG)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1789868/+subscriptions


References