diff options
author | 0x501D <mail@void.so> | 2020-02-20 18:32:56 +0300 |
---|---|---|
committer | 0x501D <mail@void.so> | 2020-02-20 18:32:56 +0300 |
commit | 430d3acdfeaf89c4386191d182254694d3b5430c (patch) | |
tree | a002c1a8f44345b7b16063eb9bd95a928f761912 | |
parent | 8c0be4c3f42a987e191240fb513cd1a78d48099b (diff) | |
parent | 4fd32956ef387b758cab4ad4ecdd5e43d25534d8 (diff) |
Merge branch 'master' of github.com:nemuTUI/nemuv2.3.0-RC0
-rw-r--r-- | src/nm_form.c | 1 | ||||
-rw-r--r-- | src/nm_vm_control.c | 22 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/nm_form.c b/src/nm_form.c index 1e08870..78d2673 100644 --- a/src/nm_form.c +++ b/src/nm_form.c @@ -25,6 +25,7 @@ const char *nm_form_net_drv[] = { const char *nm_form_drive_drv[] = { "ide", + "nvme", "scsi", "virtio", NULL diff --git a/src/nm_vm_control.c b/src/nm_vm_control.c index aba7d85..b4d6060 100644 --- a/src/nm_vm_control.c +++ b/src/nm_vm_control.c @@ -312,14 +312,22 @@ void nm_vmctl_gen_cmd(nm_vect_t *argv, const nm_vmctl_data_t *vm, for (size_t n = 0; n < drives_count; n++) { + int nvme_drv = NM_FALSE; int scsi_drv = NM_FALSE; size_t idx_shift = NM_DRV_IDX_COUNT * n; const nm_str_t *drive_img = nm_vect_str(&vm->drives, NM_SQL_DRV_NAME + idx_shift); const nm_str_t *blk_drv = nm_vect_str(&vm->drives, NM_SQL_DRV_TYPE + idx_shift); + const char *blk_drv_type = blk_drv->data; - if (nm_str_cmp_st(blk_drv, "scsi") == NM_OK) + if (nm_str_cmp_st(blk_drv, "nvme") == NM_OK) + { + nvme_drv = NM_TRUE; + blk_drv_type = "none"; + } + else if (nm_str_cmp_st(blk_drv, "scsi") == NM_OK) { scsi_drv = NM_TRUE; + blk_drv_type = "none"; if (!scsi_added) { nm_vect_insert_cstr(argv, "-device"); @@ -327,13 +335,21 @@ void nm_vmctl_gen_cmd(nm_vect_t *argv, const nm_vmctl_data_t *vm, scsi_added = NM_TRUE; } } + nm_vect_insert_cstr(argv, "-drive"); nm_str_format(&buf, "id=hd%zu,media=disk,if=%s,file=%s%s", - n, (scsi_drv) ? "none" : blk_drv->data, vmdir.data, drive_img->data); + n, blk_drv_type, vmdir.data, drive_img->data); nm_vect_insert(argv, buf.data, buf.len + 1, NULL); - if (scsi_drv) + if (nvme_drv) + { + long int host_id = labs(gethostid()); + nm_vect_insert_cstr(argv, "-device"); + nm_str_format(&buf, "nvme,drive=hd%zu,serial=%lX%zX", n, host_id, n); + nm_vect_insert(argv, buf.data, buf.len + 1, NULL); + } + else if (scsi_drv) { nm_vect_insert_cstr(argv, "-device"); nm_str_format(&buf, "scsi-hd,drive=hd%zu", n); |