Skip to content

Instantly share code, notes, and snippets.

@amshinde
amshinde / gist:dfec8265db5571754b4183ed23297f05
Last active August 19, 2022 01:09
Hotplugging cpu, memory and host devices to a running virtual machine with QMP
Hotplugging cpu:
Start QEMU with QMP socket available and with startup amount of CPUs less than maxcpus:
./qemu-system-x86_64 -qmp unix:/tmp/qmp-sock,server,nowait -smp 2,maxcpus=8
Connect to qmp socket and add cpu:
socat /tmp/qmp-sock -
{ "execute": "cpu-add", "arguments": { "id": 2 } }
Hotpluggable Cpu's can be queried as:
# Clear Linux install configuration
#
# /dev/sda1 /
# /dev/sda2 /boot
# /dev/sda3 (reserved partition for devicemapper)
#
DEVICE="/dev/sda3"
echo "Stopping docker"
@amshinde
amshinde / qemu-SCSI-Passthrough.md
Last active September 28, 2022 11:29
Qemu SCSI passthrough
@amshinde
amshinde / graphics-vfio.md
Created October 11, 2018 18:03 — forked from egernst/graphics-vfio.md
Passing graphics card to a Clear Container

Passing a graphics card to a Clear Container

Host system setup:

The directions below are specific to an Ubuntu 16.04 host system equipped with a GeForce GTX 550 Ti graphics card. While the process should be the same, YMMV.

  1. Make sure your system supports IOMMU groups

todo -- get directions from SRIOV page

@amshinde
amshinde / tc mirroring.md
Created October 19, 2018 17:10 — forked from mcastelino/tc mirroring.md
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
@amshinde
amshinde / change-tty-size.md
Last active April 4, 2019 01:17
change tty size

stty rows 80 cols 180

/etc/modprobe.d/overlay.conf with the following contents:

options overlay index=off

check in /sys/modules/overlay/parameters/index

@amshinde
amshinde / VFIO_nested.md
Created October 29, 2018 17:13 — forked from mcastelino/VFIO_nested.md
QEMU VFIO in Nested VM vIOMMU

How to use VFIO to assign a device to nested VM

  • Here the vfio-pci device is passed in into the L1 VM
  • The L1 VM is setup with kernel_irqchip=split
  • The L0 exposes a virtual IOMMU to the L1 VM
qemu-system-x86_64 \
    -machine q35,accel=kvm,kernel_irqchip=split \
    -enable-kvm \

Failed to add inotify watch : no space left on disk

This is due to the inotify watch limit being hit. cat /proc/sys/fs/inotify/max_user_watches

sudo sysctl fs.inotify.max_user_watches=524288

or edit