mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
ch: add virCHMonitorRemoveDevice function
The function calls the respective CH API to remove a device of any type from a VM. On-behalf-of: SAP stefan.kober@sap.com Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
4ba796ab74
commit
f9cd2cf238
2 files changed
+14
No files matched your search
@@ -612,6 +612,16 @@ virCHMonitorBuildKeyValueStringJson(char **jsonstr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int virCHMonitorRemoveDevice(virCHMonitor *mon,
|
||||
const char* device_id)
|
||||
{
|
||||
g_autoptr(virJSONValue) payload = virCHMonitorBuildKeyValueJson("id", device_id);
|
||||
|
||||
VIR_DEBUG("Remove device %s", device_id);
|
||||
|
||||
return virCHMonitorPut(mon, URL_VM_REMOVE_DEVICE, payload, NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
chMonitorCreateSocket(const char *socket_path)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define URL_VM_SAVE "vm.snapshot"
|
||||
#define URL_VM_RESTORE "vm.restore"
|
||||
#define URL_VM_ADD_DISK "vm.add-disk"
|
||||
#define URL_VM_REMOVE_DEVICE "vm.remove-device"
|
||||
|
||||
#define VIRCH_THREAD_NAME_LEN 16
|
||||
|
||||
@@ -143,6 +144,9 @@ int
|
||||
virCHMonitorAddDisk(virCHMonitor* mon,
|
||||
virDomainDiskDef *diskdef);
|
||||
|
||||
int virCHMonitorRemoveDevice(virCHMonitor *mon,
|
||||
const char* device_id);
|
||||
|
||||
int virCHMonitorBuildRestoreJson(virDomainDef *vmdef,
|
||||
const char *from,
|
||||
char **jsonstr);
|
||||
Reference in new issue
Block a user