Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,20 @@ func publish(cmd *cobra.Command, args []string) {
}

vmStatus, _ := host.Status(machineConfig)
if vmStatus == "Paused" {
errs[i] = utils.CmdResult{
Name: vmName, Err: errors.New("error publishing paused instance due to possible data loss. start instance, sync data to disc and try again")}
continue
}

if vmStatus == "Running" {
_, err = machineConfig.Exec("sync", true)
if err != nil {
errs[i] = utils.CmdResult{
Name: vmName, Err: errors.New("error synchonizing filesystem before publish, stop instance and retry")}
continue
}
err = host.Pause(machineConfig)
err = host.Stop(machineConfig)
if err != nil {
errs[i] = utils.CmdResult{
Name: vmName, Err: errors.New("error pausing instance before publish, stop instance and retry")}
Expand Down Expand Up @@ -129,7 +135,15 @@ func publish(cmd *cobra.Command, args []string) {
}

if vmStatus == "Running" {
err = host.Resume(machineConfig)
err = host.Start(machineConfig)
if err != nil {
errs[i] = utils.CmdResult{Name: vmName, Err: err}
continue
}
}

if vmStatus == "Paused" {
err = host.Pause(machineConfig)
if err != nil {
errs[i] = utils.CmdResult{Name: vmName, Err: err}
continue
Expand Down
1 change: 1 addition & 0 deletions qemu/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ func (c *MachineConfig) CompressQemuDiskImage() error {

err := cmd.Run()
if err != nil {
fmt.Println(err.Error())
return err
}

Expand Down
Loading