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
81c47e776e
commit
3775f29e3c
|
@ -43,6 +43,7 @@
|
|||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "cpuset.h"
|
||||
|
@ -55,6 +56,8 @@
|
|||
#include "vmmapi.h"
|
||||
#include "mevent.h"
|
||||
|
||||
#include "dm.h"
|
||||
|
||||
#define MB (1024 * 1024UL)
|
||||
#define GB (1024 * 1024 * 1024UL)
|
||||
|
||||
|
@ -113,6 +116,7 @@ vm_open(const char *name)
|
|||
struct vmctx *ctx;
|
||||
struct acrn_create_vm create_vm;
|
||||
int error, retry = 10;
|
||||
uuid_t vm_uuid;
|
||||
|
||||
ctx = malloc(sizeof(struct vmctx) + strlen(name) + 1);
|
||||
assert(ctx != NULL);
|
||||
|
@ -127,6 +131,19 @@ vm_open(const char *name)
|
|||
if (check_api(devfd) < 0)
|
||||
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->memflags = 0;
|
||||
ctx->lowmem_limit = 2 * GB;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define _VMMAPI_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <uuid/uuid.h>
|
||||
#include "types.h"
|
||||
#include "vmm.h"
|
||||
|
||||
|
@ -52,6 +53,7 @@ struct vmctx {
|
|||
char *mmap_highmem;
|
||||
char *baseaddr;
|
||||
char *name;
|
||||
uuid_t vm_uuid;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue