uvt-kvm wait fails when there is a second NIC

Bug #1825263 reported by khb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
uvtool
Triaged
Wishlist
Unassigned

Bug Description

When I've created a second NIC, say

    virsh attach-interface --domain foobar --type network --source maas --config --live

and then try to use the VM via uvt-kvm ssh foobar ... it fails with:

uvt-kvm: error: libvirt domain 'foobar' has more than one NIC defined.

BUT ...

   uvt-kvm ip foobar
   192.168.122.92

works fine, so ssh ubuntu@192.168.122.92 works ... so why do we get the error instead of the successful connection?

This continues even after ssh'ing in and configuring that second interface to have an ip address.

Revision history for this message
khb (khbkhb) wrote :

Sorry, neglected:
uvtool:
  Installed: 0~git140-0ubuntu1

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic

Revision history for this message
Robie Basak (racb) wrote :

Thank you for your report.

Are you sure it does that? From the code, it looks to me that you will only get that error on "uvt-kvm wait": because it's looking for the VM to be started and for its NIC (based on looking up a MAC) to obtain an IP address. I don't believe it does this for "uvt-kvm ssh".

We can certainly adjust what "wait" and "ssh" do to try and accommodate more use cases, but please could you start by testing and providing exact steps to reproduce in order to isolate the problematic case here?

Changed in uvtool:
status: New → Incomplete
Revision history for this message
khb (khbkhb) wrote :
Download full text (3.4 KiB)

uvt-kvm create --memory 1024 --ephemeral-disk 8 dualb
superMkhb:/home/khb>uvt-kvm wait dualb
superMkhb:/home/khb>uvt-kvm ssh dualb
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-48-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Mon Apr 29 15:39:16 UTC 2019

  System load: 0.11 Processes: 84
  Usage of /: 12.8% of 7.58GB Users logged in: 0
  Memory usage: 12% IP address for ens3: 192.168.122.93
...

superMkhb:/home/khb>virsh shutdown dualb
Domain dualb is being shutdown

superMkhb:/home/khb>virsh attach-interface --domain dualb --type network --source maas --config
Interface attached successfully

superMkhb:/home/khb>virsh start dualb
Domain dualb started

superMkhb:/home/khb>uvt-kvm wait dualb
uvt-kvm: error: libvirt domain 'dualb' has more than one NIC defined.

Interestingly, today doing it as originally written (and experienced) isn't failing this way. That is,
superMkhb:/home/khb>uvt-kvm destroy dualb
superMkhb:/home/khb>uvt-kvm create --memory 1024 --ephemeral-disk 8 dualb
superMkhb:/home/khb>uvt-kvm wait dualb
superMkhb:/home/khb>uvt-kvm ssh dualb
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-48-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Mon Apr 29 15:45:04 UTC 2019

  System load: 0.13 Processes: 83
  Usage of /: 12.8% of 7.58GB Users logged in: 0
  Memory usage: 12% IP address for ens3: 192.168.122.215
  Swap usage: 0%

ubuntu@dualb:~$ exit
logout
Connection to 192.168.122.215 closed.
superMkhb:/home/khb>virsh attach-interface --domain dualb --type network --source maas --config --live
Interface attached successfully

superMkhb:/home/khb>uvt-kvm ssh dualb
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-48-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Mon Apr 29 15:45:18 UTC 2019

  System load: 0.1 Processes: 83
  Usage of /: 12.8% of 7.58GB Users logged in: 0
  Memory usage: 12% IP address for ens3: 192.168.122.215
  Swap usage: 0%

0 packages can be updated.
0 updates are security updates.

Last login: Mon Apr 29 15:45:05 2019 from 192.168.122.1
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@dualb:~$ ifconfig -a
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.122.215 netmask 255.255.255.0 broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe6f:d48b prefixlen 64 scopeid 0x20<link>
        ether 52:54:00:6f:d4:8b txqueuelen 1000 (Ethernet)
        RX packets 618 bytes 510393 (510.3 KB)
        RX errors 0 dropped 82 overruns 0 frame 0
        TX packets 357 bytes 41278 (41.2 KB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens8: flags=4098...

Read more...

Revision history for this message
Robie Basak (racb) wrote :

In your example it is the "uvt-kvm wait" that fails when there is a second NIC, not "uvt-kvm ssh", contrary to your original summary. Is this accurate?

Revision history for this message
khb (khbkhb) wrote :

Indeed that is the current behavior. I wouldn't have thought the packages updated in the last few days would have impacted this ... but clearly something has changed!

Robie Basak (racb)
summary: - uvt-kvm ssh fails when there is a second NIC
+ uvt-kvm wait fails when there is a second NIC
Changed in uvtool:
status: Incomplete → Triaged
importance: Undecided → Wishlist
Revision history for this message
Robie Basak (racb) wrote :

OK, thanks. Let's treat this report as exactly what I've renamed the subject line to then, since that's something that is reproducible today and can be directly addressed.

The relevant code is starts from: https://git.launchpad.net/uvtool/tree/uvtool/libvirt/kvm.py#n778

I imagine that uvtool.wait.wait_for_libvirt_dnsmasq_lease will also need to be adjusted to be able to handle multiple MACs.

I won't have time to work on this. Patches welcome - but please discuss first any specific approach to avoid any wasted effort.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.