ExecuteSystemPowerdown issues `system_powerdown` and waits
for `SHUTDOWN`. The event emitted is `POWERDOWN` per spec.
Without this we get an error even though the VM has shutdown
gracefully.
Per QEMU spec:
```
POWERDOWN (Event)
Emitted when the virtual machine is powered down through the power
control system, such as via ACPI.
Since
0.12
Example
<- { "event": "POWERDOWN",
"timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
SHUTDOWN (Event)
Emitted when the virtual machine has shut down, indicating that qemu is
about to exit.
Arguments
guest: boolean
If true, the shutdown was triggered by a guest request (such as a
guest-initiated ACPI shutdown request or other hardware-specific action)
rather than a host request (such as sending qemu a SIGINT). (since 2.10)
reason: ShutdownCause
The ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
Note
If the command-line option “-no-shutdown” has been specified, qemu will
not exit, and a STOP event will eventually follow the SHUTDOWN event
Since
0.12
Example
<- { "event": "SHUTDOWN", "data": { "guest": true },
"timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
```
Signed-off-by: Manohar Castelino <mcastelino@apple.com>
Kata requires version 5.2 (or 5.1 on ARM) anyway. Simplify code by
dropping support for older versions. In any case explicit checks against
version number aren't necessarily reliable for patched qemu versions.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Currently virtio-mem-pci devices can be hotplugged only on the root bus.
This doesn't work for PCIe machines like q35.
Extend the API to optionally support hotplugging on PCI bridges.
Fixes: #176
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Add ExecuteAPVFIOMediatedDeviceAdd to qmp.go, which executes a hotplug
for an IBM Adjunct processor (AP) VFIO device (see also
https://www.kernel.org/doc/html/latest/s390/vfio-ap.html )
Also includes the respective unittest and adds the VfioAP DeviceDriver
constant to qemu.go.
Pushing again due to incidental CI failure
Fixes: #133
Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
Reviewed-by: alicefr <afrosi@redhat.com>
According to QEMU's nvdimm documentation: When 'pmem' is 'on' and QEMU is
built with libpmem support, QEMU will take necessary operations to guarantee
the persistence of its own writes to the vNVDIMM backend.
Signed-off-by: Julio Montes <julio.montes@intel.com>
Caller can hotplug vhost-user device via qmp.
The Qemu vhost-user device, like vhost-user-blk-pci and
vhost-user-scsi-pci can be hotplugged by qmp API:
ExecuteCharDevUnixSocketAdd() together with
ExecutePCIVhostUserDevAdd()
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
The upper hyervisor manager application maybe need to wait some
QMP event to control boot sequence, but the event we wanted maybe
not exist in some older version, so we need query all QMP ABI and
check the event is supported or not.
related: kata-containers/runtime#1918
Signed-off-by: Ning Bo <ning.bo9@zte.com.cn>
In QEMU 4.1 the CPU topology for x86 will change to:
`socket > die > core > thread`.
Add `die-id` field to `CPUProperties` and include it in CPU hotplugging
Signed-off-by: Julio Montes <julio.montes@intel.com>
Hotplugged memory could be backed by a file on the host with sharing
turned on. This change allows qmp to pass that option to a govmm.
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
In newer versions of QEMU, like 4.0-rc2, QMP events can be thrown even before
the QMP-version response, one example of this behaviour is when a virtio serial
is closed and a VSERPORT_CHANGE event is thrown.
Re-implement mainLoop to check the data received from the VM channel, since
it's not a guarantee that the first data read from the VM channel is the
QMP version.
fixes https://github.com/kata-containers/runtime/issues/1474
Signed-off-by: Julio Montes <julio.montes@intel.com>
ExecuteNVDIMMDeviceAdd can add a nvdimm disk to qemu.
Not implement NVDIMM device delete function because qemu doesn't support it.
Signed-off-by: Hui Zhu <teawater@hyper.sh>
For devices that actually support the option disable-modern, this
current commit provides a proper flag to the caller. This will allow
for better support when used in nested environment as virtio-pci
devices should rely on virtio 0.9 instead of 1.0 due to a bug in
KVM.
Fixes#80
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
The PR adds the s390x support. It sets the CCW devices and sets to false
all the devices in the mapping isVirtioPCI. It reimplements the functions
QemuNetdevParam and QemuDeviceParam to print an error message if the vhost-user
devices are used. It introduces a new function ExecuteNetCCWDeviceAdd for qmp
for the CCW devices.
Fixes: #37
Co-authored-by: Yash D Jain <ydjainopensource@gmail.com>
Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
This commit updates the headers in the Go source files to adhere
to the new guidelines in the CONTRIBUTING.md file.
Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
ExecuteBlockdevAddWithCache has two more parameters direct and noFlush
than ExecuteBlockdevAdd.
They are cache-related options for block devices that are described in
https://github.com/qemu/qemu/blob/master/qapi/block-core.json.
direct denotes whether use of O_DIRECT (bypass the host page cache)
is enabled. noFlush denotes whether flush requests for the device are
ignored.
Signed-off-by: Hui Zhu <teawater@hyper.sh>
Also change TestQMPXBlockdevDel to TestQMPBlockdevDel because QMP verion
2.9 and older use blockdev-del but not x-blockdev-del.
Signed-off-by: Hui Zhu <teawater@hyper.sh>
Any device inheriting from virtio-pci can specify a ROM file. This
option is provisioned by default with "efi-virtio.rom", but most
of the time, firmwares such as OVMF or seabios will already support
what is provided by this ROM file.
In order to reduce the "forced" dependency on such ROM file, govmm
should provide an empty path if the consumer of the library does not
provide one.
This patch reorganizes the list of devices, so that it gets easier to
list which devices inherit from virtio-pci, and then adds the romfile
option to every single device that support this option.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Add support for virtio-balloon.
- Add test
- Support disable-modern
- Support deflate-on-oom
Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
If we hotplug a nic with args mq=on, its qdisc will be mq by default.
This aligns with cold plug nics.
Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
In order to be able to hotplug network devices such as vhost user
net, we need to be able to define a previously declared chardev as
a parameter of this new network device.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit adds a couple of negative test cases for qmp.go, one
which checks that failed commands return errors and the other
checks that QMPStart exits gracefully when passed an invalid
socket path.
Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
In addition to normal VFIO device, this patch adds VFIO mediated device
as a supplement to do hot plug on PCI(E) bridges.
Signed-off-by: Zhao Xinda <xinda.zhao@intel.com>
With qemu 2.10, a write lock was added for qcow images that
prevents the same image to be passed more than once.
This can be over-ridden using the --share-rw option which is
desired for raw images.
This solves an issue with running Kata with devicemapper
using the privileged mode as in this case all devices on the host
are passed to the container using the block device associated
with the rootfs, causing it to be passed twice to qemu.
Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
For machines types based on PCIe like q35, device addr and bus must be specified.
For machines types based on PCI like pc, device addr must be specified and bus
is optional since devices can be hot plugged directly on the root bus.
Signed-off-by: Julio Montes <julio.montes@intel.com>
Implement function to hotplug a network device to QEMU by fds.
Macvtap can only be hotplug by this way.
Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
Implement function to hotplug virtio serial ports, the serial ports
are visible in the guest at the directory /dev/virtio-ports.
Signed-off-by: Julio Montes <julio.montes@intel.com>