Skip to content

Commit

Permalink
Always terminate VM instead of shutting down.
Browse files Browse the repository at this point in the history
This is more efficient and this will hopefully mitigate very frequent
freezing of VM during teardown
([#61](#61),
[#72](#72)).
  • Loading branch information
jacob-carlborg committed Dec 18, 2023
1 parent 626f1d6 commit d918493
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 123 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
has run. This adds a new input parameter: `shutdown_vm`. When set to `false`,
this will hopefully mitigate very frequent freezing of VM during teardown ([#61](https://github.com/cross-platform-actions/action/issues/61), [#72](https://github.com/cross-platform-actions/action/issues/72)).

### Changed
- Always terminate VM instead of shutting down. This is more efficient and this
will hopefully mitigate very frequent freezing of VM during teardown
([#61](https://github.com/cross-platform-actions/action/issues/61),
[#72](https://github.com/cross-platform-actions/action/issues/72)).

## [0.21.1] - 2023-11-03
### Fixed
- FreeBSD jobs occasionally fail when ejecting the disk ([#64](https://github.com/cross-platform-actions/action/issues/64))
Expand Down
94 changes: 5 additions & 89 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/action/action.ts
Expand Up @@ -112,10 +112,6 @@ export class Action {
} finally {
core.startGroup('Tearing down VM')
await this.syncBack()

if (this.input.shutdownVm) {
await vm.stop()
}
}
} finally {
try {
Expand Down
4 changes: 0 additions & 4 deletions src/operating_systems/freebsd/qemu_vm.ts
Expand Up @@ -11,8 +11,4 @@ export class QemuVm extends Vm {
'-drive', `if=none,file=${this.configuration.resourcesDiskImage},id=drive1,cache=writeback,discard=ignore,format=raw`,
]
}

protected override async shutdown(): Promise<void> {
await this.execute('sudo shutdown -p now')
}
}
4 changes: 0 additions & 4 deletions src/operating_systems/freebsd/xhyve_vm.ts
Expand Up @@ -8,10 +8,6 @@ export class XhyveVm extends Vm {
)
}

protected override async shutdown(): Promise<void> {
await this.execute('sudo shutdown -p now')
}

protected get networkDevice(): string {
return 'virtio-net'
}
Expand Down
4 changes: 0 additions & 4 deletions src/operating_systems/netbsd/qemu_vm.ts
Expand Up @@ -5,10 +5,6 @@ export class Vm extends QemuVm {
return this.defaultHardDriveFlags
}

protected override async shutdown(): Promise<void> {
await this.execute('sudo shutdown -h -p now')
}

protected override get ipv6(): string {
return 'ipv6=off'
}
Expand Down
4 changes: 0 additions & 4 deletions src/operating_systems/openbsd/qemu_vm.ts
Expand Up @@ -8,8 +8,4 @@ export class QemuVm extends Vm {
protected override get netDevive(): string {
return this.architecture.networkDevice
}

protected override async shutdown(): Promise<void> {
await this.execute('sudo shutdown -h -p now')
}
}
4 changes: 0 additions & 4 deletions src/operating_systems/openbsd/xhyve_vm.ts
Expand Up @@ -9,10 +9,6 @@ export class XhyveVm extends Vm {
)
}

protected override async shutdown(): Promise<void> {
await this.execute('sudo shutdown -h -p now')
}

protected get networkDevice(): string {
return 'e1000'
}
Expand Down
9 changes: 0 additions & 9 deletions src/vm.ts
Expand Up @@ -147,11 +147,6 @@ export abstract class Vm {
)
}

async stop(): Promise<void> {
core.info('Shuting down VM')
await this.shutdown()
}

async terminate(): Promise<number> {
core.info('Terminating VM')
return await exec.exec(
Expand All @@ -175,10 +170,6 @@ export abstract class Vm {
)
}

protected async shutdown(): Promise<void> {
throw Error('Not implemented')
}

async execute(
command: string,
options: ExecuteOptions = {}
Expand Down

0 comments on commit d918493

Please sign in to comment.