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:
@sameo
sameo / hyper.md
Last active September 6, 2017 18:39

Install

# Tested on Ubuntu 16.04
# Install hyperd, hyperctl, Hyper's kernel and guest image, and their QEMU binary
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/qemu-hyper/qemu-hyper_2.4.1-1_amd64.deb 
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/0.8/ubuntu/hypercontainer_0.8.1-1_amd64.deb                   
wget https://hypercontainer-download.s3-us-west-1.amazonaws.com/0.8/ubuntu/hyperstart_0.8.1-1_amd64.deb 

dpkg -i qemu-hyper_2.4.1-1_amd64.deb
# Clear Linux install configuration
#
# /dev/sda1 /
# /dev/sda2 /boot
# /dev/sda3 (reserved partition for devicemapper)
#
DEVICE="/dev/sda3"
echo "Stopping docker"
@devimc
devimc / hotplug.md
Last active February 19, 2026 14:52
Hot plugging devices

Hot plugging devices using ACPI, SHPC and native

This gist is to show different ways to hot plug devices in a Virtual Machine

Set up the environment

Create a device mapper

dd if=/dev/zero of=devmap.img count=1 bs=50M
@smoser
smoser / .gitignore
Last active April 1, 2024 07:38
cloud-init ubuntu nocloud example with network config
*.img
*.raw

virtio is a kernel virtual bus. From drivers/virtio/virtio.c:

static struct bus_type virtio_bus = {
	.name  = "virtio",
	.match = virtio_dev_match,
	.dev_groups = virtio_dev_groups,
	.uevent = virtio_uevent,
	.probe = virtio_dev_probe,
	.remove = virtio_dev_remove,

Containerd runtimes

A runtime in containerd does not stand at the runc level, but at the platform one. There are separate Linux and Windows runtimes, and they register as plugins:

const (
	runtimeName    = "linux"
	configFilename = "config.json"
@ganeshmaharaj
ganeshmaharaj / get-kube-info-with-curl.md
Last active June 15, 2021 20:59
Access Kube API with curl
@grahamwhaley
grahamwhaley / README-vsock-nfs.md
Last active April 27, 2018 14:59
Setting up vsock/nfs

How to set up vsock/nfs and QEMU

Wed 25 Apr 16:15:47 BST 2018

Setting up the experimental vsock/nfs between a host Linux machine and a KVM/QEMU client is not quite trivial - let's write it down...

Overview

over in kata containers, we use 9pfs to mount host side filesystems into the QEMU/KVM Virtual Machine.

@jcvenegas
jcvenegas / build.sh
Last active May 31, 2018 21:23
build static qemu for kata
#git status
#On branch stable-2.11
#Your branch is up-to-date with 'origin/stable-2.11'.
#nothing to commit, working directory clean
./configure --disable-bluez --disable-brlapi --disable-docs --disable-curses --disable-gtk --disable-opengl --disable-sdl --disable-spice --disable-vte --disable-vnc --disable-vnc-jpeg --disable-vnc-png --disable-vnc-sasl --disable-fdt --disable-glusterfs --disable-libiscsi --disable-libnfs --disable-bzip2 --disable-lzo --disable-snappy --disable-seccomp --disable-tpm --disable-slirp --disable-libusb --disable-usb-redir --disable-tcg --disable-uuid --disable-debug-tcg --disable-qom-cast-debug --disable-tcg-interpreter --disable-tcmalloc --disable-curl --disable-rdma --disable-tools --disable-xen --disable-linux-aio --enable-kvm --enable-vhost-net --enable-virtfs --enable-attr --enable-cap-ng --target-list=x86_64-softmmu --extra-cflags=" -O3 -fno-semantic-interposition -falign-functions=32 -D_FORTIFY_SOURCE=2 -fPIE" --extra-ldflags=" -z noexecstack -z relro -z now" --static --