Add support for --device=kvm

Solves: https://github.com/flatpak/flatpak/issues/332
This commit is contained in:
Alexander Larsson committed 2016-09-30 16:46:51 +02:00
1 parent 270707d5ca
commit c9c35133c3
6 files changed
+17 -9

No files matched your search

+8
View File
@@ -93,11 +93,13 @@ const char *dont_mount_in_root[] = {
typedef enum {
FLATPAK_CONTEXT_DEVICE_DRI = 1 << 0,
FLATPAK_CONTEXT_DEVICE_ALL = 1 << 1,
FLATPAK_CONTEXT_DEVICE_KVM = 1 << 2,
} FlatpakContextDevices;
const char *flatpak_context_devices[] = {
"dri",
"all",
"kvm",
NULL
};
@@ -2006,6 +2008,12 @@ flatpak_run_add_environment_args (GPtrArray *argv_array,
NULL);
}
}
if (context->devices & FLATPAK_CONTEXT_DEVICE_KVM)
{
g_debug ("Allowing kvm access");
if (g_file_test ("/dev/kvm", G_FILE_TEST_EXISTS))
add_args (argv_array, "--dev-bind", "/dev/kvm", "/dev/kvm", NULL);
}
}
fs_mode = (FlatpakFilesystemMode) g_hash_table_lookup (context->filesystems, "host");
+2 -2
View File
@@ -136,7 +136,7 @@
<listitem><para>
Expose a device to the application. This updates
the [Context] group in the metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
@@ -147,7 +147,7 @@
<listitem><para>
Don't expose a device to the application. This updates
the [Context] group in the metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
+2 -2
View File
@@ -161,7 +161,7 @@
<listitem><para>
Expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
@@ -172,7 +172,7 @@
<listitem><para>
Don't expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
+1 -1
View File
@@ -121,7 +121,7 @@
<term><option>devices</option> (list)</term>
<listitem><para>
List of devices to make available in the sandbox.
Possible values: dri, all.
Possible values: dri, kvm, all.
</para></listitem>
</varlistentry>
<varlistentry>
+2 -2
View File
@@ -117,7 +117,7 @@
<listitem><para>
Expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
@@ -128,7 +128,7 @@
<listitem><para>
Don't expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
+2 -2
View File
@@ -195,7 +195,7 @@
<listitem><para>
Expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>
@@ -206,7 +206,7 @@
<listitem><para>
Don't expose a device to the application. This overrides to
the Context section from the application metadata.
DEVICE must be one of: dri, all.
DEVICE must be one of: dri, kvm, all.
This option can be used multiple times.
</para></listitem>
</varlistentry>