Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167145565
D47032.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47032.diff
View Options
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -521,41 +521,23 @@
{
struct vmctx *ctx;
int error;
- bool reinit, romboot;
-
- reinit = false;
+ bool romboot;
romboot = bootrom_boot();
- error = vm_create(vmname);
- if (error) {
- if (errno == EEXIST) {
- if (romboot) {
- reinit = true;
- } else {
- /*
- * The virtual machine has been setup by the
- * userspace bootloader.
- */
- }
- } else {
- perror("vm_create");
- exit(4);
- }
- } else {
- if (!romboot) {
- /*
- * If the virtual machine was just created then a
- * bootrom must be configured to boot it.
- */
- fprintf(stderr, "virtual machine cannot be booted\n");
- exit(4);
- }
- }
- ctx = vm_open(vmname);
+ /*
+ * If we don't have a boot ROM, the guest context must have been
+ * initialized by bhyveload(8) or equivalent.
+ */
+ ctx = vm_openf(vmname, romboot ? VMMAPI_OPEN_REINIT : 0);
if (ctx == NULL) {
- perror("vm_open");
- exit(4);
+ if (errno != ENOENT)
+ err(4, "vm_openf");
+ if (!romboot)
+ errx(4, "no bootrom was configured");
+ ctx = vm_openf(vmname, VMMAPI_OPEN_CREATE);
+ if (ctx == NULL)
+ err(4, "vm_openf");
}
#ifndef WITHOUT_CAPSICUM
@@ -563,13 +545,6 @@
err(EX_OSERR, "vm_limit_rights");
#endif
- if (reinit) {
- error = vm_reinit(ctx);
- if (error) {
- perror("vm_reinit");
- exit(4);
- }
- }
error = vm_set_topology(ctx, cpu_sockets, cpu_cores, cpu_threads, 0);
if (error)
errx(EX_OSERR, "vm_set_topology");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 20, 11:41 AM (4 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36991133
Default Alt Text
D47032.diff (1 KB)
Attached To
Mode
D47032: bhyve: Convert to using vm_openf()
Attached
Detach File
Event Timeline
Log In to Comment