Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-hypervisor balloonMem adds virtio-mem and balloon #276

Open
vdbe opened this issue Sep 17, 2024 · 0 comments
Open

cloud-hypervisor balloonMem adds virtio-mem and balloon #276

vdbe opened this issue Sep 17, 2024 · 0 comments

Comments

@vdbe
Copy link

vdbe commented Sep 17, 2024

Could not get balloonMem working on cloud-hypervisor and looked into it a bit and microvm.nix sets up the balloon device and hotplug_method=virtio-mem for cloud-hypervisor, I think this is not purpose.

# command from current/bin/microvm-run
cloud-hypervisor \
  --cpus 'boot=1' \
  --watchdog \
  --console null \
  --serial tty \
  --kernel /nix/store/4fa3ggf753cj5jkxmbi3cj34xyxrw72j-linux-6.6.51-dev/vmlinux \
  --initramfs /nix/store/rjnqw4y3nzs6dqrqsdv3nss5yaw9ankq-initrd-linux-6.6.51/initrd \
  --cmdline 'earlyprintk=ttyS0 console=ttyS0 reboot=t panic=-1 root=fstab loglevel=4 init=/nix/store/3vrxcx9lvsdfmpiv1bm3d747n1824840-nixos-system-plz-24.11pre-git/init regInfo=/nix/store/qg5lap6j4mld4l6yimdszxhnjd0958zl-closure-info/registration' \
  --seccomp true \
  --memory 'hotplug_method=virtio-mem,hotplug_size=2048M,hotplugged_size=2048M,mergeable=on,shared=off,size=4096M' \
  --balloon 'deflate_on_oom=on,free_page_reporting=on,size=2048M' \
  --disk 'path=/nix/store/mc13yzp4g4gajssyij1gd51mks2bsl7a-microvm-store-disk.erofs,readonly=on' \
  --api-socket plz.sock

got hotplug_method=virtio-mem working with

cloud-hypervisor \
  --kernel ~user/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin \
  --serial tty \
  --disk path=~user/focal-server-cloudimg-amd64.raw path=/tmp/ubuntu-cloudinit.img \
  --cmdline "console=hvc0 root=/dev/vda1 rw" \
  --cpus boot=4 \
  --memory size=1024M,hotplug_method=virtio-mem,hotplug_size=4G,hotplugged_size=4G \
  --net "tap=,mac=,ip=,mask=" \
microvm config of host
  microvm.vms.plz = {
    autostart = false;
    pkgs = null;
    config = {
      imports = [
        (
          { pkgs, ... }:
          {

            users.users.root.password = "toor123";
            microvm = {
              hypervisor = "cloud-hypervisor";
              balloonMem = 2048;
            };
            environment.systemPackages = with pkgs; [
              htop
            ];
            services.qemuGuest.enable = true;
          }
        )
      ];

    };
  };

following instruction from https://www.cloudhypervisor.org/docs/prologue/quick-start/ and https://www.cloudhypervisor.org/docs/prologue/quick-start/ but couldn't get it working for the nix vm.

The virtio memory get added to the vm I think but is not available, think something is missing on the guest.

Screenshot from 2024-09-17 15-21-10

Command
cloud-hypervisor \
  --cpus 'boot=1' \
  --watchdog \
  --console null \
  --serial tty \
  --kernel /nix/store/4fa3ggf753cj5jkxmbi3cj34xyxrw72j-linux-6.6.51-dev/vmlinux \
  --initramfs /nix/store/rjnqw4y3nzs6dqrqsdv3nss5yaw9ankq-initrd-linux-6.6.51/initrd \
  --cmdline 'earlyprintk=ttyS0 console=ttyS0 reboot=t panic=-1 root=fstab loglevel=4 init=/nix/store/3vrxcx9lvsdfmpiv1bm3d747n1824840-nixos-system-plz-24.11pre-git/init regInfo=/nix/store/qg5lap6j4mld4l6yimdszxhnjd0958zl-closure-info/registration' \
  --seccomp true --memory 'hotplug_method=virtio-mem,hotplug_size=2048M,hotplugged_size=2048M,mergeable=on,shared=off,size=4096M' \
  --disk 'path=/nix/store/mc13yzp4g4gajssyij1gd51mks2bsl7a-microvm-store-disk.erofs,readonly=on' \
  --api-socket plz.sock

Screenshot from 2024-09-17 15-22-47

Command
cloud-hypervisor \
  --cpus 'boot=1' \
  --watchdog \
  --console null \
  --serial tty \
  --kernel /nix/store/4fa3ggf753cj5jkxmbi3cj34xyxrw72j-linux-6.6.51-dev/vmlinux \
  --initramfs /nix/store/rjnqw4y3nzs6dqrqsdv3nss5yaw9ankq-initrd-linux-6.6.51/initrd \
  --cmdline 'earlyprintk=ttyS0 console=ttyS0 reboot=t panic=-1 root=fstab loglevel=4 init=/nix/store/3vrxcx9lvsdfmpiv1bm3d747n1824840-nixos-system-plz-24.11pre-git/init regInfo=/nix/store/qg5lap6j4mld4l6yimdszxhnjd0958zl-closure-info/registration' \
  --seccomp true --memory 'size=4096M' \
  --disk 'path=/nix/store/mc13yzp4g4gajssyij1gd51mks2bsl7a-microvm-store-disk.erofs,readonly=on' \
  --api-socket plz.sock
@vdbe vdbe changed the title cloud-hypervisor balloonMem add virtio-mem and balloon cloud-hypervisor balloonMem adds virtio-mem and balloon Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant