weizhouapache commented on issue #13989:
URL: https://github.com/apache/cloudstack/issues/13989#issuecomment-5946703727

   > Workaround until the libvirtd fix is available
   > 
   > **Save this code as rados_compat.c**
   > 
   > ```
   > #define _GNU_SOURCE
   > 
   > #include <stdio.h>
   > #include <string.h>
   > #include <dlfcn.h>
   > #include <errno.h>
   > 
   > typedef int (*rados_conf_set_fn)(
   >     void *cluster,
   >     const char *option,
   >     const char *value
   > );
   > 
   > int rados_conf_set(void *cluster, const char *option, const char *value)
   > {
   >     static rados_conf_set_fn real_rados_conf_set = NULL;
   > 
   >     if (option && strcmp(option, "auth_supported") == 0) {
   >         fprintf(stderr,
   >                 "[rados-compat] ignoring deprecated option: "
   >                 "auth_supported=%s\n",
   >                 value ? value : "(null)");
   > 
   >         return 0;
   >     }
   > 
   >     if (!real_rados_conf_set) {
   >         dlerror();
   > 
   >         real_rados_conf_set =
   >             (rados_conf_set_fn)dlsym(RTLD_NEXT, "rados_conf_set");
   > 
   >         const char *err = dlerror();
   > 
   >         if (err || !real_rados_conf_set) {
   >             fprintf(stderr,
   >                     "[rados-compat] dlsym(rados_conf_set) failed: %s\n",
   >                     err ? err : "unknown error");
   > 
   >             return -EIO;
   >         }
   >     }
   > 
   >     return real_rados_conf_set(cluster, option, value);
   > } 
   > ```
   > 
   > **Then compile and install it:** _gcc -shared -fPIC -O2 -Wall -Wextra -o 
librados_compat.so rados_compat.c -ldl install -o root -g root -m 0755 
librados_compat.so /usr/local/lib/librados_compat.so_
   > 
   > **Preload it into libvirtd:** _systemctl edit libvirtd_
   > 
   > ```
   > [Service]
   > Environment="LD_PRELOAD=/usr/local/lib/librados_compat.so"
   > ```
   > 
   > _systemctl daemon-reload systemctl restart libvirtd systemctl restart 
cloudstack-agent_
   
   @akoskuczi-bw 
   I applied a similar change several days ago, and the libvirt pool can be 
created successfully. However, VMs cannot be deployed due to a segmentation 
fault in the QEMU process.
   As a workaround, I had to override the QEMU command and unset LD_PRELOAD 
before running the actual QEMU process.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to