Project

General

Profile

Actions

Bug #3295

open

Adapt devel/libvirt for nvmm

Added by tuxillo 5 months ago. Updated 3 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
nvmm
Target version:
Start date:
09/01/2021
Due date:
% Done:

70%

Estimated time:

Description

With the recent addition of nvmm, it would be interesting to have something that eases the VM lifecycle, like devel/libvirt . This is a feature request to myself to, at least try to, make devel/libvirt usable with nvmm under DragonFly.


Files

libvirt01.png (69.5 KB) libvirt01.png tuxillo, 09/29/2021 05:04 PM
Actions #1

Updated by tuxillo 4 months ago

  • Status changed from New to In Progress

Test:

  • In one terminal:
$ qemu-system-x86_64 -display curses -accel nvmm -chardev socket,id=qmp,port=4444,host=localhost,server=on -mon chardev=qmp,mode=control,pretty=on
  • In another:
$ telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
{
    "QMP": {
        "version": {
            "qemu": {
                "micro": 0,
                "minor": 0,
                "major": 6
            },
            "package": "" 
        },
        "capabilities": [
            "oob" 
        ]
    }
}
{ "execute": "qmp_capabilities" }
{
    "return": {
    }
}
{ "execute": "query-nvmm" }
{
    "return": {
        "enabled": true,
        "present": true
    }
}
{ "execute": "quit" }
{
    "return": {
    }
}
{
    "timestamp": {
        "seconds": 1632586250,
        "microseconds": 956109
    },
    "event": "SHUTDOWN",
    "data": {
        "guest": false,
        "reason": "host-qmp-quit" 
    }
}
Actions #2

Updated by tuxillo 4 months ago

  • Preliminary work done, you can run VMs with libvirt and nvmm accelerated!
  • It's work in progress, expect unstability

devbox# virsh list
 Id   Name                 State
------------------------------------
 2    ubuntu1804_default   running

devbox# nvmmctl list
Machine ID VCPUs RAM  Owner PID Creation Time           
---------- ----- ---- --------- ------------------------
0          2     2.0G 199725    Thu Sep 30 01:55:03 2021

  • virt-manager example:

Actions #3

Updated by tuxillo 4 months ago

  • Submitted two ports to FreeBSD required to support vagrant + libvirt for them (and us).

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258866
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258867

Actions #5

Updated by tuxillo 4 months ago

Testing vagrant

The Vagrantfile needs this:

  config.vm.provider :libvirt do |libvirt|
    libvirt.driver = "nvmm" 
  end

Once done, testing a Debian image:

devbox:~/temp/vagrant/debian11$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'generic/debian11' version '3.4.2' is up to date...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              debian11_default
==> default:  -- Description:       Source: /home/antonioh/temp/vagrant/debian11/Vagrantfile
==> default:  -- Domain type:       nvmm
==> default:  -- Cpus:              2
==> default:  -- Feature:           acpi
==> default:  -- Feature:           apic
==> default:  -- Feature:           pae
==> default:  -- Clock offset:      utc
==> default:  -- Memory:            2048M
==> default:  -- Management MAC:    
==> default:  -- Loader:            
==> default:  -- Nvram:             
==> default:  -- Base box:          generic/debian11
==> default:  -- Storage pool:      default
==> default:  -- Image():     /var/lib/libvirt/images/debian11_default.img, 128G
==> default:  -- Disk driver opts:  cache='default'
==> default:  -- Kernel:            
==> default:  -- Initrd:            
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     -1
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        cirrus
==> default:  -- Video VRAM:        256
==> default:  -- Sound Type:
==> default:  -- Keymap:            en-us
==> default:  -- TPM Backend:       passthrough
==> default:  -- TPM Path:          
==> default:  -- INPUT:             type=mouse, bus=ps2
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.121.100:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
devbox:~/temp/vagrant/debian11$ vagrant ssh
vagrant@debian11:~$ uname -a
Linux debian11.localdomain 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux
vagrant@debian11:~$ 
logout
Connection to 192.168.121.100 closed.
devbox:~/temp/vagrant/debian11$ sudo nvmmctl list
Machine ID VCPUs RAM  Owner PID Creation Time           
---------- ----- ---- --------- ------------------------
0          2     2.0G 527838    Sun Oct  3 18:53:12 2021

Actions #6

Updated by tuxillo 3 months ago

TODO: Tap devices are not closed (destroyed) when the VM is stopped.

Actions

Also available in: Atom PDF