[PATCH v3 09/13] ch: assign aliases in ProcessPrepareDomain

Stefan Kober posted 13 patches 5 months, 1 week ago
[PATCH v3 09/13] ch: assign aliases in ProcessPrepareDomain
Posted by Stefan Kober 5 months, 1 week ago
This is required to have unique device aliases for devices throughout
the domain lifecycle.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
---
 src/ch/ch_process.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index cd2e88af1e..550bfefae1 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <poll.h>
 
+#include "ch_alias.h"
 #include "ch_domain.h"
 #include "ch_monitor.h"
 #include "ch_process.h"
@@ -889,6 +890,9 @@ virCHProcessPrepareDomain(virDomainObj *vm)
     if (virCHProcessPrepareDomainHostdevs(vm) < 0)
         return -1;
 
+    if (chAssignDeviceAliases(vm->def) < 0)
+        return -1;
+
     return 0;
 }
 
-- 
2.50.1
Re: [PATCH v3 09/13] ch: assign aliases in ProcessPrepareDomain
Posted by Michal Prívozník via Devel 5 months ago
On 9/4/25 14:10, Stefan Kober wrote:
> This is required to have unique device aliases for devices throughout
> the domain lifecycle.
> 
> On-behalf-of: SAP stefan.kober@sap.com
> Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
> ---
>  src/ch/ch_process.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
> index cd2e88af1e..550bfefae1 100644
> --- a/src/ch/ch_process.c
> +++ b/src/ch/ch_process.c
> @@ -24,6 +24,7 @@
>  #include <fcntl.h>
>  #include <poll.h>
>  
> +#include "ch_alias.h"
>  #include "ch_domain.h"
>  #include "ch_monitor.h"
>  #include "ch_process.h"
> @@ -889,6 +890,9 @@ virCHProcessPrepareDomain(virDomainObj *vm)
>      if (virCHProcessPrepareDomainHostdevs(vm) < 0)
>          return -1;
>  
> +    if (chAssignDeviceAliases(vm->def) < 0)
> +        return -1;
> +

I'd do this before preparing hostdevs. While it's strictly not needed
currently, it may happen that a hostdev code would expect device aliases
to be set (e.g. in case of QEMU driver the SCSI detach code expects that).

>      return 0;
>  }
>  

Michal