-
Notifications
You must be signed in to change notification settings - Fork 675
Implement limactl clone
#3673
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
base: master
Are you sure you want to change the base?
Implement limactl clone
#3673
Conversation
b209d0d
to
addc8f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, don't have time to do a full review right now, so just one comment.
Also, if you think clone
is too similar to copy
, then maybe we can use duplicate
(with short alias dup
). But I think clone
is fine too.
"clone" corresponds to the lingo used by VMware, VirtualBox, etc. |
02d5c14
to
1e6504f
Compare
`limactl clone OLDINST NEWINST` clones an instance. Not to be confused with `limactl copy SRC DST` (copy files). Fix issue 3658 Signed-off-by: Akihiro Suda <[email protected]>
1e6504f
to
2f4aeda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new limactl clone
command to duplicate existing Lima instances by copying most files while skipping or nullifying instance-specific artifacts.
- Introduces file‐filtering lists (
SkipOnClone
,NullifyOnClone
,TmpFileSuffixes
) and wires them into both the stop and clone implementations - Updates Darwin VM logic to regenerate an empty or missing VzIdentifier
- Adds the Cobra command, flags and end‐to‐end test cases for
limactl clone
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
pkg/vz/vm_darwin.go | Regenerate empty or missing VzIdentifier on clone |
pkg/store/filenames/filenames.go | Define skip/nullify lists and tmp suffixes for cloning |
pkg/instance/stop.go | Reuse TmpFileSuffixes when cleaning up stopped instances |
pkg/instance/clone.go | Core clone logic: directory walk, file skip, nullify and copy |
hack/test-templates.sh | Enable and implement a basic clone test in CI templates |
cmd/limactl/main.go | Wire newCloneCommand into the root Cobra app |
cmd/limactl/copy.go | Clarify help text to distinguish copy vs. clone commands |
cmd/limactl/clone.go | New Cobra command, argument handling and post‐clone editing logic |
cmd/limactl/editflags/editflags.go | Adjust RegisterEdit signature to accept a comment prefix |
cmd/limactl/edit.go | Update call site for new RegisterEdit signature |
Comments suppressed due to low confidence (1)
cmd/limactl/copy.go:30
- [nitpick] Consider using backticks for code references in help text (e.g.
limactl clone
) to match existing formatting conventions.
Not to be confused with 'limactl clone'.
Use: "clone OLDINST NEWINST", | ||
Short: "Clone an instance of Lima", | ||
Long: `Clone an instance of Lima. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to include an example, like we did for the copy
command?
Lines 24 to 30 in 2f4aeda
const copyHelp = `Copy files between host and guest | |
Prefix guest filenames with the instance name and a colon. | |
Example: limactl copy default:/etc/os-release . | |
Not to be confused with 'limactl clone'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clone OLDINST NEWINST
should suffice
limactl clone OLDINST NEWINST
clones an instance.Not to be confused with
limactl copy SRC DST
(copy files).Fix #3658