nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.3k stars 132 forks source link

qmp for local instances doesn't work w/custom instance names #1534

Closed eyberg closed 1 year ago

eyberg commented 1 year ago

if you turn on qmp for local instances (eg: for hot-plugging locally)

right now this assumes a unique name (which is a timestamp that is appended to non-custom instance names)

i suppose the quick/easy fix is to allow the custom instance name w/the knowledge that you can just use one or use a tmp id of some kind

if rconfig.QMP {

        // really horribly hack but we don't really know the pid until
        // after we launch so use the last 4 of id assigned to
        // instance
        ts := strings.Split(rconfig.InstanceName, "-")
        rts := strings.Split(ts[1], ".")[0]
        last := "4" + rts[len(rts)-4:] // no 0 and <65k, hack

        args = append(args, "-qmp tcp:localhost:"+last+",server,wait=off")
    }

at least for onprem targets another method might be to generate a id beforehand and not overload the instance name - I don't know how much we rely on the name for other providers (such as gcp) - I think in the past those were overloaded as well and used but most providers allow the concept of a tag so shouldn't have to do that there either

eyberg commented 1 year ago

https://github.com/nanovms/ops/pull/1535