Manually update IP address of machine in LXD database

, ,

I’m running a Windows HVM under LXD. Since the LXD agent doesn’t operate on Windows, does anybody know if it’s possible to update/set the IP address of an HVM machine in the LXD database so when I issue lxc list the IP shows up in the IPV4 column?

Thanks!

Nope.

LXD considers two sources for that field:

  • Live running data from the agent (not available for Windows yet)
  • DHCP lease on a LXD managed network

If you’re using static addressing or an external DHCP server, then LXD indeed would not show anything.

(The address information is never stored in the LXD database, it’s always fetched live from either of those two sources, so you can’t really cheat and inject the address anywhere :))

Ok cool, this makes sense.

You mentioned a Windows agent isn’t available “yet”. Is that in the works?

Yeah, we fully intend to have the agent work on Windows.

The main blocker at this time is vsock driver availability on Windows.
Initial code has landed in the Windows drivers on Github but we haven’t yet seen a working build of those. Once we have vsock working on Windows, we should be able to port the agent easily enough.

3 Likes

I’m bumping this thread because I’m running into a similar issue and came up with a solution until an lxd agent is released for Windows. Basically, if the VM pings the host server, lxd becomes “aware” of the vm ip address and prints it in the output of lxc list. In order to automate this process, I wrote a PowerShell script that runs on startup, pulls a list of all of my lxd servers and loops through pinging each of them. The script calls to a custom PHP api that prints a list of the servers in a JSON encoded array.

$url = 'https://<my web database>/lxd_server_list.php'

$Body = @{
    apikey = '<my api key>'
}

$servers = Invoke-RestMethod -Method 'Post' -Uri $url -Body $body

while($true) {
    foreach ($server in $servers) {
        Test-Connection -Count 1 $server
    }
    Start-Sleep -Seconds 60
}