diff --git a/src/exec/Guestfish.go b/src/exec/Guestfish.go index 75974944bb0a14470c4c04da75b8498452b5363d..22d1c77ca9bd11200d876e03c089fc045752eaa8 100644 --- a/src/exec/Guestfish.go +++ b/src/exec/Guestfish.go @@ -43,9 +43,9 @@ func CopyToVM(vmDiskFile, tarFile, vmDir string) error { return nil } -// Recursively copies a directory in the VM's filesystem (vmDir) into a tar archive. +// Recursively copies a directory in the VM's filesystem (vmDir) into a compressed archive. func CopyFromVM(vmDiskFile, vmDir, tarFile string) error { - cmd := exec.Command(guestfishBinary, "--ro", "-i", "tar-out", "-a", vmDiskFile, vmDir, tarFile) + cmd := exec.Command(guestfishBinary, "--ro", "-i", "tar-out", "-a", vmDiskFile, vmDir, tarFile, "compress:gzip") stdoutStderr, err := cmd.CombinedOutput() if err != nil { output := fmt.Sprintf("[%s]", stdoutStderr) diff --git a/src/router/routerVMs.go b/src/router/routerVMs.go index 3ff8641bcbc1f80fb5da06611b9a8ebaaaeb6687..d8e95f981965b31a2b3977fc4609bf2e33701ee6 100644 --- a/src/router/routerVMs.go +++ b/src/router/routerVMs.go @@ -378,7 +378,7 @@ func (r *RouterVMs)DeleteVMAccessForUser(c echo.Context) error { return c.JSONPretty(http.StatusOK, jsonMsg("OK"), " ") } -// Exports a VM's directory into a .tar archive. +// Exports a VM's directory into a compressed archive. // Requires either capability: // User cap: VM_READFS_ANY: any VM can have their filesystem read. // VM access cap: VM_READFS: any of the VMs with this cap for the logged user can have their filesystem read. @@ -396,7 +396,7 @@ func (r *RouterVMs)ExportVMDir(c echo.Context) error { // Creates a unique tar filename. tmpDir := paths.GetInstance().TmpDir - tarFile := filepath.Join(tmpDir, "exportdir_"+vm.ID.String()+".tar") + tarFile := filepath.Join(tmpDir, "exportdir_"+vm.ID.String()+".tar.gz") // Extracts VM's p.Dir directory into tarFile on the host. if err := r.vms.ExportVMFiles(vm, p.Dir, tarFile); err != nil { diff --git a/src/version/version.go b/src/version/version.go index c46ce8a757310c5a0e440c97d89c7352e36d6124..d3e770731f4bf1906deeba4564836b235ec36609 100644 --- a/src/version/version.go +++ b/src/version/version.go @@ -7,7 +7,7 @@ import ( const ( major = 1 minor = 2 - bugfix = 0 + bugfix = 1 ) type Version struct { diff --git a/src/vms/vms.go b/src/vms/vms.go index 109180db1b7158b615be1cb1ec71b482bbc23e99..278fc0bfeec1c089e9b0541824f327c77b9b4451 100644 --- a/src/vms/vms.go +++ b/src/vms/vms.go @@ -389,14 +389,14 @@ func (vms *VMs)DeleteVMAccess(vmID uuid.UUID, loggedUserEmail, userEmail string) return nil } -// Exports a VM's directory and its subdirectories into a tar archive on the host. +// Exports a VM's directory and its subdirectories into a compressed archive on the host. func (vms *VMs)ExportVMFiles(vm *VM, vmDir, tarFile string) error { vmDisk := vm.getDiskPath() return exec.CopyFromVM(vmDisk, vmDir, tarFile) } // Import files into a VM's filesystem, in a specified directory. -func (vms *VMs)ImportFilesToVM(vm *VM, hostDir, vmDir string) error { +func (vms *VMs)ImportFilesToVM(vm *VM, tarFile, vmDir string) error { // Marks the VM to copy from as being busy. if err := vms.setDiskBusy(vm); err != nil { return errors.New("Failed setting disk busy flag during VM files import: "+err.Error()) @@ -405,7 +405,7 @@ func (vms *VMs)ImportFilesToVM(vm *VM, hostDir, vmDir string) error { defer vms.clearDiskBusy(vm) vmDisk := vm.getDiskPath() - return exec.CopyToVM(vmDisk, hostDir, vmDir) + return exec.CopyToVM(vmDisk, tarFile, vmDir) } // Marks a VM as "busy", meaning its disk file is being accessed for a possibly long time.