mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
56fbabf1a1
Cloud-Hypervisor is a KVM virtualization using hypervisor. It functions similarly to qemu and the libvirt Cloud-Hypervisor driver uses a very similar structure to the libvirt driver. The biggest difference from the libvirt perspective is that the "monitor" socket is seperated into two sockets one that commands are issued to and one that events are notified from. The current implementation only uses the command socket (running over a REST API with json encoded data) with future changes to add support for the event socket (to better handle shutdowns from inside the VM). This patch adds support for the following initial VM actions using the Cloud-Hypervsior API: * vm.create * vm.delete * vm.boot * vm.shutdown * vm.reboot * vm.pause * vm.resume To use the Cloud-Hypervisor driver, the v15.0 release of Cloud-Hypervisor is required to be installed. Some additional notes: * The curl handle is persistent but not useful to detect ch process shutdown/crash (a future patch will address this shortcoming) * On a 64-bit host Cloud-Hypervisor needs to support PVH and so can emulate 32-bit mode but it isn't fully tested (a 64-bit kernel and 32-bit userspace is fine, a 32-bit kernel isn't validated) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: William Douglas <william.douglas@intel.com>
61 lines
1.7 KiB
C
61 lines
1.7 KiB
C
/*
|
|
* Copyright Intel Corp. 2020-2021
|
|
*
|
|
* ch_monitor.h: header file for managing Cloud-Hypervisor interactions
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#include "virobject.h"
|
|
#include "domain_conf.h"
|
|
|
|
#define URL_ROOT "http://localhost/api/v1"
|
|
#define URL_VMM_SHUTDOWN "vmm.shutdown"
|
|
#define URL_VM_CREATE "vm.create"
|
|
#define URL_VM_DELETE "vm.delete"
|
|
#define URL_VM_BOOT "vm.boot"
|
|
#define URL_VM_SHUTDOWN "vm.shutdown"
|
|
#define URL_VM_REBOOT "vm.reboot"
|
|
#define URL_VM_Suspend "vm.pause"
|
|
#define URL_VM_RESUME "vm.resume"
|
|
|
|
typedef struct _virCHMonitor virCHMonitor;
|
|
|
|
struct _virCHMonitor {
|
|
virObjectLockable parent;
|
|
|
|
CURL *handle;
|
|
|
|
char *socketpath;
|
|
|
|
pid_t pid;
|
|
|
|
virDomainObj *vm;
|
|
};
|
|
|
|
virCHMonitor *virCHMonitorNew(virDomainObj *vm, const char *socketdir);
|
|
void virCHMonitorClose(virCHMonitor *mon);
|
|
|
|
int virCHMonitorCreateVM(virCHMonitor *mon);
|
|
int virCHMonitorBootVM(virCHMonitor *mon);
|
|
int virCHMonitorShutdownVM(virCHMonitor *mon);
|
|
int virCHMonitorRebootVM(virCHMonitor *mon);
|
|
int virCHMonitorSuspendVM(virCHMonitor *mon);
|
|
int virCHMonitorResumeVM(virCHMonitor *mon);
|