mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 06:51:49 +00:00
vm: Pass uuid from DM commandline to vm as GUID.
Also save the uuid to ctx in case DM needs to access the uuid. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
d5f8a4fe7f
commit
981b323394
@ -43,6 +43,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <uuid/uuid.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "cpuset.h"
|
#include "cpuset.h"
|
||||||
@ -55,6 +56,8 @@
|
|||||||
#include "vmmapi.h"
|
#include "vmmapi.h"
|
||||||
#include "mevent.h"
|
#include "mevent.h"
|
||||||
|
|
||||||
|
#include "dm.h"
|
||||||
|
|
||||||
#define MB (1024 * 1024UL)
|
#define MB (1024 * 1024UL)
|
||||||
#define GB (1024 * 1024 * 1024UL)
|
#define GB (1024 * 1024 * 1024UL)
|
||||||
|
|
||||||
@ -113,6 +116,7 @@ vm_open(const char *name)
|
|||||||
struct vmctx *ctx;
|
struct vmctx *ctx;
|
||||||
struct acrn_create_vm create_vm;
|
struct acrn_create_vm create_vm;
|
||||||
int error, retry = 10;
|
int error, retry = 10;
|
||||||
|
uuid_t vm_uuid;
|
||||||
|
|
||||||
ctx = malloc(sizeof(struct vmctx) + strlen(name) + 1);
|
ctx = malloc(sizeof(struct vmctx) + strlen(name) + 1);
|
||||||
assert(ctx != NULL);
|
assert(ctx != NULL);
|
||||||
@ -127,6 +131,19 @@ vm_open(const char *name)
|
|||||||
if (check_api(devfd) < 0)
|
if (check_api(devfd) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
if (guest_uuid_str == NULL)
|
||||||
|
guest_uuid_str = "d2795438-25d6-11e8-864e-cb7a18b34643";
|
||||||
|
|
||||||
|
error = uuid_parse(guest_uuid_str, vm_uuid);
|
||||||
|
if (error != 0)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
/* save vm uuid to ctx */
|
||||||
|
uuid_copy(ctx->vm_uuid, vm_uuid);
|
||||||
|
|
||||||
|
/* Pass uuid as parameter of create vm*/
|
||||||
|
uuid_copy(create_vm.GUID, vm_uuid);
|
||||||
|
|
||||||
ctx->fd = devfd;
|
ctx->fd = devfd;
|
||||||
ctx->memflags = 0;
|
ctx->memflags = 0;
|
||||||
ctx->lowmem_limit = 2 * GB;
|
ctx->lowmem_limit = 2 * GB;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define _VMMAPI_H_
|
#define _VMMAPI_H_
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <uuid/uuid.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "vmm.h"
|
#include "vmm.h"
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ struct vmctx {
|
|||||||
char *mmap_highmem;
|
char *mmap_highmem;
|
||||||
char *baseaddr;
|
char *baseaddr;
|
||||||
char *name;
|
char *name;
|
||||||
|
uuid_t vm_uuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user