Why does libvirt create multiple PCIs? - virtual-machine
I ran libvirt in the parameters of the qemu-system-x86_64 command and found that it created multiple PCIs:
/usr/bin/qemu-system-x86_64 \
...
-device '{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}' \
-device '{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}' \
-device '{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}' \
-device '{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}' \
-device '{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}' \
-device '{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}' \
-device '{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}' \
-device '{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}' \
-device '{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}' \
-device '{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}' \
-device '{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}' \
-device '{"driver":"pcie-root-port","port":30,"chassis":15,"id":"pci.15","bus":"pcie.0","addr":"0x3.0x6"}' \
-device '{"driver":"pcie-pci-bridge","id":"pci.16","bus":"pci.6","addr":"0x0"}' \
...
It seems that qemu only creates one PCI by default. Is there any benefit to creating multiple PCIs for virtual IO devices?
With a PCI-Express topology, every individual device (disk, nic, video, sound, etc) needs to be attached to a dedicated pcie-root-port. You cannot hotplug/unplug the pcie-root-port device itself, but if you already have a pcie-root-port present you can hotplug/unplug a device into it. Thus to allow you to hotplug disks/nics/etc at runtime, it is desirable to pre-create extra pcie-root-port devices. Libvirt will only pre-create one spare, but apps using libvirt can ask for as many extras as they like. Seeing your config with 30 ports, I'm guessing you might have been using OpenStack since I know that will pre-create many extra pcie-root-port to allow for lots of hotplug options.
Related
what is a no nonsense way to create a ubuntu virtual machine using virt-manager on command line
I tried various methods explained on internet, but none seems to be working. using local iso image give one issue and location gives another issue. Can we setup IP using this command? currently using this command sudo virt-install \ --name worker-2 \ --ram=4096 \ --disk size=100 \ --disk path=/opt/sciserver/vm/worker-2.qcow2,size=30,format=qcow2 \ --vcpus 2 \ --os-type linux \ --os-variant ubuntu20.04 \ --graphics none \ --location 'http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/' \ --extra-args "console=tty0 console=ttyS0,115200n8" and error says.. "ERROR Error validating install location: Could not find an installable distribution at 'http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/' The location must be the root directory of an install tree. See virt-install man page for various distro examples." Your help will be much appreciated
Which API can I use to add my own logs to QEMU for debugging purpose
I tried to add my own logs to qemu by using fprintf(stdout, "my own log") and qemu_log("my own log"), and then compiled the qemu from source code and started a VM by the following command: /usr/bin/qemu-system-x86_64 \ -D /home/VM1-qemu-log.txt \ -d cpu_reset \ -enable-kvm \ -m 4096 \ -nic user,model=virtio \ -drive file=/var/lib/libvirt/images/VM1.qcow2,media=disk,if=virtio \ -nographic There are CPU-related logs in VM1-qemu-log.txt, however, I cannot find where "my own log" is. Can anyone advise? Thanks!
qemu_log("my own log") works, I added it to the wrong place(i.e., beginning of the 'main()' in 'qemu/vl.c', where the logging has not been setup yet). By adding it to another place(e.g. in virtio_blk_get_request() under qemu/hw/block/virtio-blk.c), I will be able to see "my own log" in /home/VM1-qemu-log.txt. The VM is created by: /usr/bin/qemu-system-x86_64 \ -D /home/VM1-qemu-log.txt \ -enable-kvm \ -m 4096 \ -nic user,model=virtio \ -drive file=/var/lib/libvirt/images/VM1.qcow2,media=disk,if=virtio \ -nographic
How can fixed this problem related with GEM5 , benchmark Parsec
sudo scons FULL_SYSTEM=1 build/ALPHA/gem5.opt RUBY=true PROTOCOL=MOESI_CMP_directory build/ALPHA/gem5.opt configs/example/fs.py --cpu-type=timing \ --script=run_scripts/blackscholes_4c_simsmall.rcS \ --num-cpus=4 --ruby --mesh-rows=2 --garnet=fixed --topology=Mesh \ --caches --l2cache --l2_size=512kB --num-dirs=4 --num-l2=4 \ --l1d_size=32kB --l1i_size=32kB --l1d_assoc=2 --l1i_assoc=2 \ --kernel=/home/fur/gem5/full_system_images_ALPHA/binaries/vmlinux_2.6.27-gcc_4.3.4 \ --disk-image=/home/fur/gem5/full_system_images_ALPHA/disks/linux-parsec-2-1-m5-withtest-inputs.img it gave my error: 'fixed' invalid value !!! please how can fixed that? GEM5, Parsec benchmark, ruby network
Google Cloud ML Engine pass multiple file paths as arguments
I am trying to run a job on Google Cloud ML Engine and can't seem to pass multiple file paths as arguments to the parser. Here is what I am writing in the terminal: JOB_NAME=my_job_name BUCKET_NAME=my_bucket_name OUTPUT_PATH=gs://$BUCKET_NAME/$JOB_NAME DATA_PATH=gs://$BUCKET_NAME/my_data_directory REGION=us-east1 gcloud ml-engine jobs submit training $JOB_NAME \ --job-dir $OUTPUT_PATH \ --runtime-version 1.2 \ --module-name trainer.task \ --package-path trainer/ \ --region $REGION \ -- \ --file-path "${DATA_PATH}/*" \ --num-epochs 10 Where my_data_directory contains multiple files I later want to read, the problem is that --file-path contains only ['gs://my_bucket_name/my_data_directory'] and not a list of files in said directory. How do I fix this? Many thanks in advance.
Since the arguments you pass after the -- \ line will be user arguments, how the program handles these arguments will largely depend on the trainer you defined. I would go back and modify the trainer program and make it either treat the directory differently or take multiple paths like this: gcloud ml-engine jobs submit training $JOB_NAME \ --job-dir $OUTPUT_PATH \ --runtime-version 1.2 \ --module-name trainer.task \ --package-path trainer/ \ --region $REGION \ --scale-tier STANDARD_1 \ -- \ --train-files $TRAIN_DATA \ --eval-files $EVAL_DATA \ --train-steps 1000 \ --verbosity DEBUG \ --eval-steps 100 Some links that will be helpful for developing your own trainer: [1] [2]
multiple KVM guests script using virt-install
I would like install 3 KVM guests automatically using kickstart. I have no problem installing it manually using virt-install command. virt-install \ -n dal \ -r 2048 \ --vcpus=1 \ --os-variant=rhel6 \ --accelerate \ --network bridge:br1,model=virtio \ --disk path=/home/dal_internal,size=128 --force \ --location="/home/kvm.iso" \ --nographics \ --extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \ --initrd-inject=/opt/dal_kick.cfg \ --virt-type kvm I have 3 scripts like the one above - i would like to install all 3 at the same time, how can i disable the console? or running it in the background?
Based on virt-install man page: http://www.tin.org/bin/man.cgi?section=1&topic=virt-install --noautoconsole Don't automatically try to connect to the guest console. The default behaviour is to launch virt-viewer(1) to display the graphical console, or to run the "virsh" "console" command to display the text console. Use of this parameter will disable this behaviour. virt-install will connect console automatically. If you don't want, just simply add --noautoconsole in your cmd like virt-install \ -n dal \ -r 2048 \ --vcpus=1 \ --quiet \ --noautoconsole \ ...... other options
We faced the same problem and at the end the only way we found was to create new threads with the &. We also include the quiet option, not mandatory. ---quiet option (Only print fatal error messages). virt-install \ -n dal \ -r 2048 \ --vcpus=1 \ --quiet \ --os-variant=rhel6 \ --accelerate \ --network bridge:br1,model=virtio \ --disk path=/home/dal_internal,size=128 --force \ --location="/home/kvm.iso" \ --nographics \ --extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \ --initrd-inject=/opt/dal_kick.cfg \ --virt-type kvm &
I know this is kind of old, but I wanted to share my thoughts. I ran into the same problem, but due to the environment we work in, we need to use sudo with a password (compliance reasons). The solution I came up with was to use timeout instead of &. When we fork it right away, it would hang due to the sudo prompt never appearing. So using timeout with your example above: (we obviously did timeout 10 sudo virt-instal...) timeout 15 virt-install \ -n dal \ -r 2048 \ --vcpus=1 \ --quiet \ --os-variant=rhel6 \ --accelerate \ --network bridge:br1,model=virtio \ --disk path=/home/dal_internal,size=128 --force \ --location="/home/kvm.iso" \ --nographics \ --extra-args="ks=file:/dal_kick.cfg console=tty0 console=ttyS0,115200n8 serial" \ --initrd-inject=/opt/dal_kick.cfg \ --virt-type kvm This allowed us to interact with our sudo prompt and send the password over, and then start the build. The timeout doesnt kill the process, it will continue on and so can your script.