You need to sign in or sign up before continuing.
  • S
    qemu: Add swtpm to emulator cgroup · 3f1a7070
    Stefan Berger 提交于
    Add the external swtpm to the emulator cgroup so that upper limits of CPU
    usage can be enforced on the emulated TPM.
    
    To enable this we need to have the swtpm write its process id (pid) into a
    file. We then read it from the file to configure the emulator cgroup.
    
    The PID file is created in /var/run/libvirt/qemu/swtpm:
    
    [root@localhost swtpm]# ls -lZ /var/run/libvirt/qemu/swtpm/
    total 4
    -rw-r--r--. 1 tss  tss  system_u:object_r:qemu_var_run_t:s0          5 Apr 10 12:26 1-testvm-swtpm.pid
    srw-rw----. 1 qemu qemu system_u:object_r:svirt_image_t:s0:c597,c632 0 Apr 10 12:26 1-testvm-swtpm.sock
    
    The swtpm command line now looks as follows:
    
    root@localhost testvm]# ps auxZ | grep swtpm | grep socket | grep -v grep
    system_u:system_r:virtd_t:s0:c597,c632 tss 18697 0.0  0.0 28172 3892 ?       Ss   16:46   0:00 /usr/bin/swtpm socket --daemon --ctrl type=unixio,path=/var/run/libvirt/qemu/swtpm/1-testvm-swtpm.sock,mode=0600 --tpmstate dir=/var/lib/libvirt/swtpm/485d0004-a48f-436a-8457-8a3b73e28568/tpm1.2/ --log file=/var/log/swtpm/libvirt/qemu/testvm-swtpm.log --pid file=/var/run/libvirt/qemu/swtpm/1-testvm-swtpm.pid
    Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
    Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
    Reviewed-by: NJán Tomko <jtomko@redhat.com>
    3f1a7070
qemu_tpm.h 1.9 KB