Uploaded image for project: 'VCL'
  1. VCL
  2. VCL-641

VCL fails to properly trim whitespace from `virsh list --all`

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.3.1
    • vcld (backend)
    • CentOS 6.3

    Description

      Using the libvirt module, vcld executes `virsh list --all` on a vmhost, which results in the following output

      Id Name State
      ----------------------------------------------------
      19 VM1 running

      (Note: This bug reporting system seems to be trimming extra spaces from the above output.)

      The name of the VM ("VM1") is then extracted as " VM1", and the command `virsh dumpxml " VM1"` fails.

      From looking at libvirt.pm's get_domain_info function, it looks like the expectation is that there will only be one space between the id and name columns:

      my ($id, $name, $state) = $line =~ /^\s*([\d\-])\s(.?)\s+(\w+|shut off)$/g;

      I have worked around this issue by adding a '+' after the \s between id and name

      my ($id, $name, $state) = $line =~ /^\s*([\d\-])\s(.?)\s(\w+|shut off)$/g;

      Attachments

        Activity

          People

            arkurth Andrew Kurth
            nsasherr Nathaniel Sherry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: