mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-26 16:28:12 +00:00
Create a VM using ioctl(KVM_CREATE_VM)
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
e1f3acc598
commit
28fa19c020
@@ -24,7 +24,9 @@ static struct cpu *cpu__new(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct cpu *cpu;
|
||||
int fd, ret;
|
||||
int vmfd;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/kvm", O_RDWR);
|
||||
if (fd < 0)
|
||||
@@ -34,6 +36,10 @@ int main(int argc, char *argv[])
|
||||
if (ret != KVM_API_VERSION)
|
||||
die("ioctl");
|
||||
|
||||
vmfd = ioctl(fd, KVM_CREATE_VM, 0);
|
||||
if (vmfd < 0)
|
||||
die("open");
|
||||
|
||||
cpu = cpu__new();
|
||||
|
||||
cpu__reset(cpu);
|
||||
|
||||
Reference in New Issue
Block a user