0.10.1: create wizard can pick/download an ISO and optionally start the guest right away
This commit is contained in:
1 parent
fd2f0192c3
commit
9feb3fba86
4 files changed
+61
-3
No files matched your search
@@ -190,6 +190,26 @@ if ($verb === 'create' && !empty($job['switch'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// optional: attach the chosen ISO and boot right away
|
||||
if ($verb === 'create' && $rc === 0 && empty($timedOut)) {
|
||||
if (!empty($job['iso'])) {
|
||||
$att = vmm_iso_attach($name, [(string)$job['iso']]);
|
||||
if (isset($att['error'])) {
|
||||
joblog($log, 'iso attach failed: ' . $att['error']);
|
||||
} else {
|
||||
joblog($log, 'iso attached: ' . basename((string)$job['iso']));
|
||||
}
|
||||
}
|
||||
if (!empty($job['autostart']) && !empty($job['iso'])) {
|
||||
joblog($log, 'starting guest');
|
||||
$start = vmm_run(['start', $name], 180);
|
||||
if ($start['stdout'] !== '') {
|
||||
fwrite($log, $start['stdout']);
|
||||
}
|
||||
joblog($log, 'start rc=' . $start['rc']);
|
||||
}
|
||||
}
|
||||
|
||||
// vm-bhyve often returns 0 even when it refused the operation, so the
|
||||
// resulting state is what counts. Some states are transitional (a guest that
|
||||
// just booted reports "bootloader" for a moment), so wait a little.
|
||||
|
||||
Reference in new issue
Block a user