-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect storage pool configuration when moving instance between projects #12412
Respect storage pool configuration when moving instance between projects #12412
Conversation
@MusicDin as discussed lets move this logic to the server side so we can sequentially action both a storage pool and project move in a single request. |
65e79e3
to
80fac0d
Compare
needs a rebase |
2bfaef5
to
cc123f7
Compare
Structure Structure Would embedding As a quickfix, I just added a condition that ensures server-side move is only used if custom profiles, devices or configurations are not provided. If they are, move is done using copy, which is still better compared to the current situation where those flags are completely ignored. |
b6c7e92
to
a3bb306
Compare
bef45a5
to
d5f298f
Compare
d5f298f
to
b9513d9
Compare
This is the first part that should be ported to Just to give some context, flags like Another PR is coming that will introduce a new API extension and will add support for the above flags. |
b9513d9
to
fd7fd6d
Compare
Signed-off-by: Din Music <din.music@canonical.com>
Signed-off-by: Din Music <din.music@canonical.com>
Signed-off-by: Din Music <din.music@canonical.com>
Signed-off-by: Din Music <din.music@canonical.com>
fd7fd6d
to
94a87f6
Compare
@tomponline Follow up on our discussion this morning:
$ lxc project create pmove
$ lxc storage create smove zfs
$ lxc launch ubuntu:22.04 v2 --vm -c migration.stateful=true
$ lxc move v2 --target-project pmove --storage smove
$ lxc config show v2 --project pmove
...
devices:
root:
path: /
pool: smove
size.state: 4GiB
type: disk
|
What about with |
Yep, just testing that out, will let you know |
@tomponline moving instance to another project/storage and another target in the same time is not supported: $ lxc move v2 --target-project pmove --storage smove --target cls-2
# Error: The --storage flag can't be used with --target
$ lxc move v2 --target-project pmove --target cls-2
# Error: The --target-project flag can't be used with --target However, moving to another target, works normally: $ lxc move v2 --target cls-2
$ lxc move v2 --target-project pmove --storage smove
$ lxc ls --project pmove
# +------+---------+-------------------------+-------------------------------------------------+-----------------+-----------+----------+
# | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | LOCATION |
# +------+---------+-------------------------+-------------------------------------------------+-----------------+-----------+----------+
# | v2 | RUNNING | 10.195.159.139 (enp5s0) | fd42:5563:fe39:e0cc:216:3eff:fe44:40b5 (enp5s0) | VIRTUAL-MACHINE | 0 | cls-2 |
# +------+---------+-------------------------+-------------------------------------------------+-----------------+-----------+----------+
$ lxc config show v2 --project pmove
# ...
# devices:
# root:
# path: /
# pool: smove
# size.state: 4GiB
# type: disk |
If
--storage
flag is used along--target-project
flag in move command, ensure the instance is migrated to another project as well.In addition, when migrating to another project, determine root disk device in the following order:
When using server-side move, flags
--profile
,--no-profiles
,--device
are not respected. Therefore, step2.
only works for profiles that are already applied to the instance in source project and exist in the target project.A very simple solution would be to skip server-side project move if any of the above flags is set. This way, LXD would copy the instance (ensuring profiles and devices are applied).
If we are willing to support server-side move of the instance while respecting other flags, then we would most likely need to expand
moveInstanceProject()
.There is also a small inconsistency between "server-side" move and "move using copy". When moving an instance whose root disk device is configured in the profile, a root disk device configuration is moved to the instance's config. On the other side, copy ("move using copy") will not do that.