Skip to content

Commit 4004142

Browse files
liuwbryteise
authored andcommitted
ch: implement automatic host devices management
Call Cloud Hypervisor host devices management helpers at the right places. Signed-of-by: Wei Liu <[email protected]>
1 parent 048d477 commit 4004142

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ch/ch_process.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "ch_monitor.h"
3030
#include "ch_process.h"
3131
#include "ch_cgroup.h"
32+
#include "ch_hostdev.h"
3233
#include "virnuma.h"
3334
#include "viralloc.h"
3435
#include "virerror.h"
@@ -699,6 +700,11 @@ int virCHProcessStart(virCHDriverPtr driver,
699700
if (chProcessNetworkPrepareDevices(driver, vm) < 0)
700701
goto cleanup;
701702

703+
VIR_DEBUG("Preparing host devices");
704+
if (chHostdevPrepareDomainDevices(driver, vm->def,
705+
VIR_HOSTDEV_COLD_BOOT) < 0)
706+
goto cleanup;
707+
702708
if (!priv->monitor) {
703709
/* And we can get the first monitor connection now too */
704710
if (!(priv->monitor = virCHProcessConnectMonitor(driver, vm))) {
@@ -775,6 +781,8 @@ int virCHProcessStop(virCHDriverPtr driver G_GNUC_UNUSED,
775781
priv->monitor = NULL;
776782
}
777783

784+
chHostdevReAttachDomainDevices(driver, vm->def);
785+
778786
retry:
779787
if ((ret = chRemoveCgroup(vm)) < 0) {
780788
if (ret == -EBUSY && (retries++ < 5)) {

0 commit comments

Comments
 (0)