Skip to content

Commit

Permalink
Support Packer Parallels VMs (#220)
Browse files Browse the repository at this point in the history
This way it will be easier to distribute VMs and do upgrades. For an upgrade one will just need to download a new VM as a single file and then delete the previous VM folder and register the packed VM.
  • Loading branch information
fkorotkov authored Jan 6, 2021
1 parent 5434e1a commit 65be029
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ func NewVMClonedFrom(ctx context.Context, vmNameFrom string) (*VM, error) {
return nil, err
}

// Check if VM is packed
if strings.HasSuffix(vmInfoFrom.Home, ".pvmp") {
// Let's unpack it!
_, stderr, err := Prlctl(ctx, "unpack", vmNameFrom)
if err != nil {
return nil, fmt.Errorf("%w: failed to unpack VM %q: %q", ErrVMFailed, vmNameFrom, firstNonEmptyLine(stderr))
}
// Update info after unpacking
vmInfoFrom, err = retrieveInfo(ctx, vmNameFrom)
if err != nil {
return nil, err
}
}

if vmInfoFrom.State == "suspended" {
return cloneFromSuspended(ctx, vmInfoFrom.Home)
}
Expand Down

0 comments on commit 65be029

Please sign in to comment.