mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 11:01:26 +00:00
Make LXC_CLONE_KEEPNAME work
Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected. We wrap clear_unexp_config_line() and set_config_item_line() in an appropriate if-condition. Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
This commit is contained in:
parent
840d2afe82
commit
eab218fbf7
@ -2906,12 +2906,15 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
clear_unexp_config_line(c2->lxc_conf, "lxc.utsname", false);
|
||||
|
||||
// update utsname
|
||||
if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
|
||||
ERROR("Error setting new hostname");
|
||||
goto out;
|
||||
if (!(flags & LXC_CLONE_KEEPNAME)) {
|
||||
clear_unexp_config_line(c2->lxc_conf, "lxc.utsname", false);
|
||||
|
||||
if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
|
||||
ERROR("Error setting new hostname");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
// copy hooks
|
||||
|
Loading…
Reference in New Issue
Block a user