mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-13 08:58:33 +03:00
qemuProcessRefreshDisks: Extract update of a single disk
Extract the logic to update one single disk (without emitting any events) so that it can be reused when updating the state after a disk hotplug. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c8e7ed7f7b
commit
b60efa9a39
@ -8673,6 +8673,29 @@ qemuProcessAutoDestroy(virDomainObj *dom,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
qemuProcessRefreshDiskProps(virDomainDiskDef *disk,
|
||||
struct qemuDomainDiskInfo *info)
|
||||
{
|
||||
qemuDomainDiskPrivate *diskpriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
|
||||
if (info->removable) {
|
||||
if (info->empty)
|
||||
virDomainDiskEmptySource(disk);
|
||||
|
||||
if (info->tray) {
|
||||
if (info->tray_open)
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
|
||||
else
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
diskpriv->removable = info->removable;
|
||||
diskpriv->tray = info->tray;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
virDomainAsyncJob asyncJob)
|
||||
@ -8703,21 +8726,7 @@ qemuProcessRefreshDisks(virDomainObj *vm,
|
||||
if (!(info = virHashLookup(table, entryname)))
|
||||
continue;
|
||||
|
||||
if (info->removable) {
|
||||
if (info->empty)
|
||||
virDomainDiskEmptySource(disk);
|
||||
|
||||
if (info->tray) {
|
||||
if (info->tray_open)
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN;
|
||||
else
|
||||
disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
/* fill in additional data */
|
||||
diskpriv->removable = info->removable;
|
||||
diskpriv->tray = info->tray;
|
||||
qemuProcessRefreshDiskProps(disk, info);
|
||||
|
||||
if (diskpriv->tray &&
|
||||
old_tray_status != disk->tray_status) {
|
||||
|
@ -235,3 +235,6 @@ bool qemuProcessRebootAllowed(const virDomainDef *def);
|
||||
|
||||
void qemuProcessCleanupMigrationJob(virQEMUDriver *driver,
|
||||
virDomainObj *vm);
|
||||
|
||||
void qemuProcessRefreshDiskProps(virDomainDiskDef *disk,
|
||||
struct qemuDomainDiskInfo *info);
|
||||
|
Loading…
x
Reference in New Issue
Block a user