print lxc-start-ephemeral container name in a machine-readable way
Bug #1197754 reported by
Robie Basak
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
autopkgtest (Ubuntu) |
Fix Released
|
Low
|
Paride Legovini | ||
lxc (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
A script cannot call lxc-start-ephemeral and get a named container in a reliable, race-free way.
Having the caller specify a name directly is racy, since the name could have been taken in between checking that it doesn't exist already and calling lxc-start-
Allowing lxc-start-ephemeral allows it to take care of the mkdir (and retries) to generate an LXC container name in a race free manner, but this needs -d to return the name in a machine-readable way, so that we can create ephemeral LXC containers from scripts.
Please add a machine-readable mechanism to "lxc-start-
Changed in lxc (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in autopkgtest (Ubuntu): | |
importance: | Medium → Low |
summary: |
- "lxc-start-ephemeral -d" is racy + print lxc-start-ephemeral container name in a machine-readable way |
summary: |
- print lxc-start-ephemeral container name in a machine-readable way + print lxc-copy -e container name in a machine-readable way |
summary: |
- print lxc-copy -e container name in a machine-readable way + print lxc-start-ephemeral container name in a machine-readable way |
Changed in autopkgtest (Ubuntu): | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Quoting Robie Basak (<email address hidden>): ephemeral.
> Public bug reported:
>
> A script cannot call lxc-start-ephemeral and get a named container in a
> reliable, race-free way.
>
> Having the caller specify a name directly is racy, since the name could
> have been taken in between checking that it doesn't exist already and
> calling lxc-start-
Practically speaking, have you actually created the container name with
mktemp (i.e. mktemp -u -t lxc-XXXXXX | sed 's@/tmp/@@') and gotten name
clashes?
> Allowing lxc-start-ephemeral allows it to take care of the mkdir (and ephemeral -d" and
> retries) to generate an LXC container name in a race free manner, but
> this needs -d to return the name in a machine-readable way, so that we
> can create ephemeral LXC containers from scripts.
>
> Please add a machine-readable mechanism to "lxc-start-
> then we can modify adt-virt-lxc to use it.
That does sound like a good idea - we could add a '--terse' suboption to
-d to only print '$name $ip'