Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-797

Fix KVM detection when run as non-root

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: FACT 2.3.0
    • Fix Version/s: FACT 2.4.1
    • Component/s: Community
    • Labels:
      None
    • Environment:

      Scientific Linux 6.x, OpenStack (KVM)

    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-02-18

      Description

      When running facter as unprivileged user, virtual fact is falsely set to physical, although correct value can be deduced from lspci system command.
      Unfortunately, regex matching of lspci output in lib/facter/virtual.rb is done on lowercase value:

            next "kvm"        if lines.any? {|l| l =~ /virtio/ }
      

      Example of real lspci output on affected instance follows:

      $ lspci |grep -i virtio
      00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
      00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
      00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
      00:06.0 RAM memory: Red Hat, Inc Virtio memory balloon
      

      As a side effect, none of ec2_* facts are available, as they are evaluated only when vitual is xen or kvm.

      My guess is that easiest fix is to make aforementioned regex case-insensitive:

            next "kvm"        if lines.any? {|l| l =~ /virtio/i }
      

      See linked FACT-711 with the same problem happening on Ubuntu Linux.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kylo Kylo Ginsberg
              Reporter:
              robert.moucha Robert Moucha
              QA Contact:
              Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support