[libvirt-users] Libvirt remote-client compilation for RHEL4

Hi, We are trying to compile Libvirt 1.02 from source for an RHEL4 target. Our virtualization hosts are running the fedora 17/ RHEL6 with the latest standard libvirt binaries. This is where VMs will be created. But our user/development machines are RHEL4 and we would like users to be able to use virsh/libvirt/python to control the Vms running on RHEL6/fedora17 remotely from the their RHEL4 machines. We are trying to compile a minimalist libvirt necessary on RHEL4 that would make remote control of VMs possible. Has anyone tried this? Any suggestions on what options to pass to ./configure to minimize what needs to be compiled for this purpose? Or on RHEL 4? Thx, Sarvi

I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on —with-remote=yes, --with-python=yes —with-rhel5-api=yes ./configure --with-python --with-apparmor=no --with-apparmor-mount=no --with-attr=no --with-audit=no --with-avahi=no --with-blkid=no --with-capng=no --with-curl=no --with-dbus=no --with-fuse=no --with-hal=no --with-netcf=no --with-numactl=no --with-openwsman=no --with-pciaccess=no --with-sanlock=no --with-sasl=no --with-selinux=no --with-selinux-mount=no --with-ssh2=no --with-udev=no --with-yajl=no --with-xen=no --with-xen-inotify=no --with-qemu=no --with-uml=no --with-openvz=no --with-vmware=no --with-phyp=no --with-xenapi=no --with-libxl=no --with-vbox=no --with-lxc=no --with-esx=no --with-hyperv=no --with-parallels=no --with-test=no --with-remote=yes --with-libvirtd=no --with-rhel5-api=yes --with-gnutls=no --with-polkit=no --with-firewalld=no --with-secdriver-selinux=no --with-secdriver-apparmor=no --with-dtrace=no --with-numad=no --with-network=no --with-secrets=no --with-storage-dir=no --with-storage-fs=no --with-storage-lvm=no --with-storage-iscsi=no --with-storage-scsi=no --with-storage-mpath=no --with-storage-disk=no --with-storage-rbd=no --with-storage-sheepdog=no --with-python=yes --with-interface=no --with-qemu-user=no --with-qemu-group=no --with-macvtap=no --with-virtualport=no I am getting the following error/warnings. CC libvirt_util_la-virfile.lo In file included from util/virfile.c:36: /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h" In file included from util/virfile.c:42: util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: warning: shadowed declaration is here make-3.79.1-p7[3]: *** [libvirt_util_la-virfile.lo] Error 1 I also found this thread relating to compiling clients for RHEL4 from 2011 https://www.redhat.com/archives/libvirt-users/2011-January/msg00108.html But it doesn't talk about this error. Sarvi From: Cisco Employee <sarvi@cisco.com<mailto:sarvi@cisco.com>> Date: Wed, 6 Mar 2013 23:41:46 +0000 To: "libvirt-users@redhat.com<mailto:libvirt-users@redhat.com>" <libvirt-users@redhat.com<mailto:libvirt-users@redhat.com>> Subject: [libvirt-users] Libvirt remote-client compilation for RHEL4 Hi, We are trying to compile Libvirt 1.02 from source for an RHEL4 target. Our virtualization hosts are running the fedora 17/ RHEL6 with the latest standard libvirt binaries. This is where VMs will be created. But our user/development machines are RHEL4 and we would like users to be able to use virsh/libvirt/python to control the Vms running on RHEL6/fedora17 remotely from the their RHEL4 machines. We are trying to compile a minimalist libvirt necessary on RHEL4 that would make remote control of VMs possible. Has anyone tried this? Any suggestions on what options to pass to ./configure to minimize what needs to be compiled for this purpose? Or on RHEL 4? Thx, Sarvi _______________________________________________ libvirt-users mailing list libvirt-users@redhat.com<mailto:libvirt-users@redhat.com> https://www.redhat.com/mailman/listinfo/libvirt-users

On 03/06/2013 06:05 PM, Saravanan Shanmugham (sarvi) wrote:
I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on —with-remote=yes, --with-python=yes —with-rhel5-api=yes
[your mailer doesn't wrap long lines, which makes it harder to read]
./configure --with-python --with-apparmor=no ...
You can also spell --without-apparmor instead of --with-apparmor=no (and so forth). Many of those options are automatically disabled if you use --without-libvirtd, or if a particular library is detected as not installed; it might be worth minimizing your configure line to prune options that don't make a difference. The resulting summary printed at the end of the configure run will show you which pieces were detected as enabled or disabled.
I am getting the following error/warnings. CC libvirt_util_la-virfile.lo In file included from util/virfile.c:36: /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h"
You'll have to debug this one yourself - something in your old system header doesn't like the order in which other files were included.
In file included from util/virfile.c:42: util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: warning: shadowed declaration is here
This one's a trivial fix. In fact, it looks like we've fixed a similar problem for other platforms before, given that commit de53eff fixed the same problem for virShrinkN. I'll push this shortly under the trivial rule. diff --git i/src/util/viralloc.h w/src/util/viralloc.h index 3c97a58..6f46d0b 100644 --- i/src/util/viralloc.h +++ w/src/util/viralloc.h @@ -64,7 +64,7 @@ int virInsertElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, bool clearOriginal, bool inPlace) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, - size_t remove, bool inPlace) + size_t toremove, bool inPlace) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virAllocVar(void *ptrptr, size_t struct_size, Finally, you mentioned using libvirt 1.0.2; you'll have similar issues with 1.0.3, where you will have to backport patches yourself. For now, you might want to try libvirt.git to automatically pick up fixes as they get pushed; but I have no idea how well git worked in RHEL4. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Mar 07, 2013 at 01:05:22AM +0000, Saravanan Shanmugham (sarvi) wrote:
I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on —with-remote=yes, --with-python=yes —with-rhel5-api=yes
./configure --with-python --with-apparmor=no --with-apparmor-mount=no --with-attr=no --with-audit=no --with-avahi=no --with-blkid=no --with-capng=no --with-curl=no --with-dbus=no --with-fuse=no --with-hal=no --with-netcf=no --with-numactl=no --with-openwsman=no --with-pciaccess=no --with-sanlock=no --with-sasl=no --with-selinux=no --with-selinux-mount=no --with-ssh2=no --with-udev=no --with-yajl=no --with-xen=no --with-xen-inotify=no --with-qemu=no --with-uml=no --with-openvz=no --with-vmware=no --with-phyp=no --with-xenapi=no --with-libxl=no --with-vbox=no --with-lxc=no --with-esx=no --with-hyperv=no --with-parallels=no --with-test=no --with-remote=yes --with-libvirtd=no --with-rhel5-api=yes --with-gnutls=no --with-polkit=no --with-firewalld=no --with-secdriver-selinux=no --with-secdriver-apparmor=no --with-dtrace=no --with-numad=no --with-network=no --with-secrets=no --with-storage-dir=no --with-storage-fs=no --with-storage-lvm=no --with-storage-iscsi=no --with-storage-scsi=no --with-storage-mpath=no --with-storage-disk=no --with-storage-rbd=no --with-storage-sheepdog=no --with-python=yes --with-interface=no --with-qemu-user=no --with-qemu-group=no --with-macvtap=no --with-virtualport=no
I am getting the following error/warnings. CC libvirt_util_la-virfile.lo In file included from util/virfile.c:36: /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h" In file included from util/virfile.c:42: util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: warning: shadowed declaration is here make-3.79.1-p7[3]: *** [libvirt_util_la-virfile.lo] Error 1
I also found this thread relating to compiling clients for RHEL4 from 2011 https://www.redhat.com/archives/libvirt-users/2011-January/msg00108.html
Attached is a patch which makes 1.0.3 compile on RHEL-4. Apply to a fresh 1.0.3 libvirt codebase, and then run something like this: # ./configure --without-libvirtd --without-python --without-numactl --without-vbox --prefix=/home/berrange/libvirt --localstatedir=/var --sysconfdir=/etc # make # make install You could probably also pass --without-esx --without-parallels and --without-vbox I'll get this patch applied to GIT for the next release Regards, Daniel diff -rup libvirt-1.0.3/src/driver.h libvirt-1.0.3.new/src/driver.h --- libvirt-1.0.3/src/driver.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/driver.h 2013-03-07 09:57:21.000000000 -0500 @@ -1443,7 +1443,7 @@ typedef char * typedef virStorageVolPtr (*virDrvStorageVolCreateXMLFrom) (virStoragePoolPtr pool, const char *xmldesc, - virStorageVolPtr clone, + virStorageVolPtr clonefrom, unsigned int flags); typedef int (*virDrvStorageVolDownload) (virStorageVolPtr vol, diff -rup libvirt-1.0.3/src/rpc/virnetclient.h libvirt-1.0.3.new/src/rpc/virnetclient.h --- libvirt-1.0.3/src/rpc/virnetclient.h 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/rpc/virnetclient.h 2013-03-07 10:07:48.000000000 -0500 @@ -37,7 +37,7 @@ virNetClientPtr virNetClientNewUNIX(const char *path, bool spawnDaemon, - const char *daemon); + const char *binary); virNetClientPtr virNetClientNewTCP(const char *nodename, const char *service); Only in libvirt-1.0.3.new/src/rpc: virnetclient.h~ diff -rup libvirt-1.0.3/src/util/viralloc.c libvirt-1.0.3.new/src/util/viralloc.c --- libvirt-1.0.3/src/util/viralloc.c 2012-12-21 08:30:55.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.c 2013-03-07 09:47:29.000000000 -0500 @@ -341,12 +341,12 @@ virInsertElementsN(void *ptrptr, size_t */ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, - size_t *countptr, size_t remove, + size_t *countptr, size_t toremove, bool inPlace) { - if (at + remove > *countptr) { + if (at + toremove > *countptr) { VIR_WARN("out of bounds index - count %zu at %zu remove %zu", - *countptr, at, remove); + *countptr, at, toremove); return -1; } @@ -355,12 +355,12 @@ virDeleteElementsN(void *ptrptr, size_t * already been cleared. */ memmove(*(char**)ptrptr + (size * at), - *(char**)ptrptr + (size * (at + remove)), - size * (*countptr - remove - at)); + *(char**)ptrptr + (size * (at + toremove)), + size * (*countptr - toremove - at)); if (inPlace) - *countptr -= remove; + *countptr -= toremove; else - virShrinkN(ptrptr, size, countptr, remove); + virShrinkN(ptrptr, size, countptr, toremove); return 0; } diff -rup libvirt-1.0.3/src/util/viralloc.h libvirt-1.0.3.new/src/util/viralloc.h --- libvirt-1.0.3/src/util/viralloc.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.h 2013-03-07 09:47:09.000000000 -0500 @@ -64,7 +64,7 @@ int virInsertElementsN(void *ptrptr, siz bool clearOriginal, bool inPlace) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, - size_t remove, bool inPlace) + size_t toremove, bool inPlace) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virAllocVar(void *ptrptr, size_t struct_size, diff -rup libvirt-1.0.3/src/util/virfile.c libvirt-1.0.3.new/src/util/virfile.c --- libvirt-1.0.3/src/util/virfile.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virfile.c 2013-03-07 09:53:25.000000000 -0500 @@ -32,7 +32,8 @@ #include <unistd.h> #include <dirent.h> -#ifdef __linux__ +#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR +# include <sys/types.h> # include <linux/loop.h> # include <sys/ioctl.h> #endif diff -rup libvirt-1.0.3/src/util/virnetdevbridge.c libvirt-1.0.3.new/src/util/virnetdevbridge.c --- libvirt-1.0.3/src/util/virnetdevbridge.c 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdevbridge.c 2013-03-07 10:06:29.000000000 -0500 @@ -46,7 +46,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, int domain, @@ -89,7 +89,7 @@ static int virNetDevSetupControl(const c } #endif -#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) # define SYSFS_NET_DIR "/sys/class/net" /* * Bridge parameters can be set via sysfs on newish kernels, @@ -211,7 +211,7 @@ cleanup: * * Returns 0 in case of success or -1 on failure */ -#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR) int virNetDevBridgeCreate(const char *brname) { int fd = -1; @@ -249,7 +249,7 @@ int virNetDevBridgeCreate(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR) int virNetDevBridgeDelete(const char *brname) { int fd = -1; @@ -288,7 +288,7 @@ int virNetDevBridgeDelete(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRADDIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF) int virNetDevBridgeAddPort(const char *brname, const char *ifname) { @@ -335,7 +335,7 @@ int virNetDevBridgeAddPort(const char *b * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF) int virNetDevBridgeRemovePort(const char *brname, const char *ifname) { @@ -375,7 +375,7 @@ int virNetDevBridgeRemovePort(const char #endif -#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) /** * virNetDevBridgeSetSTPDelay: * @brname: the bridge name Only in libvirt-1.0.3.new/src/util: virnetdevbridge.c~ diff -rup libvirt-1.0.3/src/util/virnetdev.c libvirt-1.0.3.new/src/util/virnetdev.c --- libvirt-1.0.3/src/util/virnetdev.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdev.c 2013-03-07 10:04:54.000000000 -0500 @@ -673,6 +673,9 @@ int virNetDevGetIndex(const char *ifname #if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) +# ifndef GET_VLAN_VID_CMD +# define GET_VLAN_VID_CMD 9 +# endif int virNetDevGetVLanID(const char *ifname, int *vlanid) { struct vlan_ioctl_args vlanargs = { Only in libvirt-1.0.3.new/src/util: virnetdev.c~ diff -rup libvirt-1.0.3/tools/virsh-domain.c libvirt-1.0.3.new/tools/virsh-domain.c --- libvirt-1.0.3/tools/virsh-domain.c 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/tools/virsh-domain.c 2013-03-07 10:23:23.000000000 -0500 @@ -56,6 +56,13 @@ #include "virtypedparam.h" #include "virxml.h" +#ifndef xmlSaveToBuffer +XMLPUBFUN xmlSaveCtxtPtr XMLCALL +xmlSaveToBuffer (xmlBufferPtr buffer, + const char *encoding, + int options); +#endif + /* Gnulib doesn't guarantee SA_SIGINFO support. */ #ifndef SA_SIGINFO # define SA_SIGINFO 0 Only in libvirt-1.0.3.new/tools: virsh-domain.c~ -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Thanks for the patch, Daniel. On 3/7/13 8:29 AM, "Daniel P. Berrange" <berrange@redhat.com> wrote:
On Thu, Mar 07, 2013 at 01:05:22AM +0000, Saravanan Shanmugham (sarvi) wrote:
I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on ‹with-remote=yes, --with-python=yes ‹with-rhel5-api=yes
./configure --with-python --with-apparmor=no --with-apparmor-mount=no --with-attr=no --with-audit=no --with-avahi=no --with-blkid=no --with-capng=no --with-curl=no --with-dbus=no --with-fuse=no --with-hal=no --with-netcf=no --with-numactl=no --with-openwsman=no --with-pciaccess=no --with-sanlock=no --with-sasl=no --with-selinux=no --with-selinux-mount=no --with-ssh2=no --with-udev=no --with-yajl=no --with-xen=no --with-xen-inotify=no --with-qemu=no --with-uml=no --with-openvz=no --with-vmware=no --with-phyp=no --with-xenapi=no --with-libxl=no --with-vbox=no --with-lxc=no --with-esx=no --with-hyperv=no --with-parallels=no --with-test=no --with-remote=yes --with-libvirtd=no --with-rhel5-api=yes --with-gnutls=no --with-polkit=no --with-firewalld=no --with-secdriver-selinux=no --with-secdriver-apparmor=no --with-dtrace=no --with-numad=no --with-network=no --with-secrets=no --with-storage-dir=no --with-storage-fs=no --with-storage-lvm=no --with-storage-iscsi=no --with-storage-scsi=no --with-storage-mpath=no --with-storage-disk=no --with-storage-rbd=no --with-storage-sheepdog=no --with-python=yes --with-interface=no --with-qemu-user=no --with-qemu-group=no --with-macvtap=no --with-virtualport=no
I am getting the following error/warnings. CC libvirt_util_la-virfile.lo In file included from util/virfile.c:36: /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h" In file included from util/virfile.c:42: util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: warning: shadowed declaration is here make-3.79.1-p7[3]: *** [libvirt_util_la-virfile.lo] Error 1
I also found this thread relating to compiling clients for RHEL4 from 2011 https://www.redhat.com/archives/libvirt-users/2011-January/msg00108.html
Attached is a patch which makes 1.0.3 compile on RHEL-4. Apply to a fresh 1.0.3 libvirt codebase, and then run something like this:
# ./configure --without-libvirtd --without-python --without-numactl --without-vbox --prefix=/home/berrange/libvirt --localstatedir=/var --sysconfdir=/etc # make # make install
You could probably also pass --without-esx --without-parallels and --without-vbox
I'll get this patch applied to GIT for the next release
Regards, Daniel
diff -rup libvirt-1.0.3/src/driver.h libvirt-1.0.3.new/src/driver.h --- libvirt-1.0.3/src/driver.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/driver.h 2013-03-07 09:57:21.000000000 -0500 @@ -1443,7 +1443,7 @@ typedef char * typedef virStorageVolPtr (*virDrvStorageVolCreateXMLFrom) (virStoragePoolPtr pool, const char *xmldesc, - virStorageVolPtr clone, + virStorageVolPtr clonefrom, unsigned int flags); typedef int (*virDrvStorageVolDownload) (virStorageVolPtr vol, diff -rup libvirt-1.0.3/src/rpc/virnetclient.h libvirt-1.0.3.new/src/rpc/virnetclient.h --- libvirt-1.0.3/src/rpc/virnetclient.h 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/rpc/virnetclient.h 2013-03-07 10:07:48.000000000 -0500 @@ -37,7 +37,7 @@
virNetClientPtr virNetClientNewUNIX(const char *path, bool spawnDaemon, - const char *daemon); + const char *binary);
virNetClientPtr virNetClientNewTCP(const char *nodename, const char *service); Only in libvirt-1.0.3.new/src/rpc: virnetclient.h~ diff -rup libvirt-1.0.3/src/util/viralloc.c libvirt-1.0.3.new/src/util/viralloc.c --- libvirt-1.0.3/src/util/viralloc.c 2012-12-21 08:30:55.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.c 2013-03-07 09:47:29.000000000 -0500 @@ -341,12 +341,12 @@ virInsertElementsN(void *ptrptr, size_t */ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, - size_t *countptr, size_t remove, + size_t *countptr, size_t toremove, bool inPlace) { - if (at + remove > *countptr) { + if (at + toremove > *countptr) { VIR_WARN("out of bounds index - count %zu at %zu remove %zu", - *countptr, at, remove); + *countptr, at, toremove); return -1; }
@@ -355,12 +355,12 @@ virDeleteElementsN(void *ptrptr, size_t * already been cleared. */ memmove(*(char**)ptrptr + (size * at), - *(char**)ptrptr + (size * (at + remove)), - size * (*countptr - remove - at)); + *(char**)ptrptr + (size * (at + toremove)), + size * (*countptr - toremove - at)); if (inPlace) - *countptr -= remove; + *countptr -= toremove; else - virShrinkN(ptrptr, size, countptr, remove); + virShrinkN(ptrptr, size, countptr, toremove); return 0; }
diff -rup libvirt-1.0.3/src/util/viralloc.h libvirt-1.0.3.new/src/util/viralloc.h --- libvirt-1.0.3/src/util/viralloc.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.h 2013-03-07 09:47:09.000000000 -0500 @@ -64,7 +64,7 @@ int virInsertElementsN(void *ptrptr, siz bool clearOriginal, bool inPlace) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, - size_t remove, bool inPlace) + size_t toremove, bool inPlace) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virAllocVar(void *ptrptr, size_t struct_size, diff -rup libvirt-1.0.3/src/util/virfile.c libvirt-1.0.3.new/src/util/virfile.c --- libvirt-1.0.3/src/util/virfile.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virfile.c 2013-03-07 09:53:25.000000000 -0500 @@ -32,7 +32,8 @@ #include <unistd.h> #include <dirent.h>
-#ifdef __linux__ +#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR +# include <sys/types.h> # include <linux/loop.h> # include <sys/ioctl.h> #endif diff -rup libvirt-1.0.3/src/util/virnetdevbridge.c libvirt-1.0.3.new/src/util/virnetdevbridge.c --- libvirt-1.0.3/src/util/virnetdevbridge.c 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdevbridge.c 2013-03-07 10:06:29.000000000 -0500 @@ -46,7 +46,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE
-#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, int domain, @@ -89,7 +89,7 @@ static int virNetDevSetupControl(const c } #endif
-#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) # define SYSFS_NET_DIR "/sys/class/net" /* * Bridge parameters can be set via sysfs on newish kernels, @@ -211,7 +211,7 @@ cleanup: * * Returns 0 in case of success or -1 on failure */ -#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR) int virNetDevBridgeCreate(const char *brname) { int fd = -1; @@ -249,7 +249,7 @@ int virNetDevBridgeCreate(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR) int virNetDevBridgeDelete(const char *brname) { int fd = -1; @@ -288,7 +288,7 @@ int virNetDevBridgeDelete(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRADDIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF) int virNetDevBridgeAddPort(const char *brname, const char *ifname) { @@ -335,7 +335,7 @@ int virNetDevBridgeAddPort(const char *b * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF) int virNetDevBridgeRemovePort(const char *brname, const char *ifname) { @@ -375,7 +375,7 @@ int virNetDevBridgeRemovePort(const char #endif
-#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) /** * virNetDevBridgeSetSTPDelay: * @brname: the bridge name Only in libvirt-1.0.3.new/src/util: virnetdevbridge.c~ diff -rup libvirt-1.0.3/src/util/virnetdev.c libvirt-1.0.3.new/src/util/virnetdev.c --- libvirt-1.0.3/src/util/virnetdev.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdev.c 2013-03-07 10:04:54.000000000 -0500 @@ -673,6 +673,9 @@ int virNetDevGetIndex(const char *ifname
#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) +# ifndef GET_VLAN_VID_CMD +# define GET_VLAN_VID_CMD 9 +# endif int virNetDevGetVLanID(const char *ifname, int *vlanid) { struct vlan_ioctl_args vlanargs = { Only in libvirt-1.0.3.new/src/util: virnetdev.c~ diff -rup libvirt-1.0.3/tools/virsh-domain.c libvirt-1.0.3.new/tools/virsh-domain.c --- libvirt-1.0.3/tools/virsh-domain.c 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/tools/virsh-domain.c 2013-03-07 10:23:23.000000000 -0500 @@ -56,6 +56,13 @@ #include "virtypedparam.h" #include "virxml.h"
+#ifndef xmlSaveToBuffer +XMLPUBFUN xmlSaveCtxtPtr XMLCALL +xmlSaveToBuffer (xmlBufferPtr buffer, + const char *encoding, + int options); +#endif + /* Gnulib doesn't guarantee SA_SIGINFO support. */ #ifndef SA_SIGINFO # define SA_SIGINFO 0 Only in libvirt-1.0.3.new/tools: virsh-domain.c~
-- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

BTW, does the following work for you? --prefix=/home/berrange/libvirt --localstatedir=/var --sysconfdir=/etc For me make succeeds, but "make install" fails. I got around it by changing src/remote/remote_driver.h to the following and got things to work. But that¹s a hack. # define LIBVIRTD_PRIV_UNIX_SOCKET "/var" "/run/libvirt/libvirt-sock" # define LIBVIRTD_PRIV_UNIX_SOCKET_RO "/var" "/run/libvirt/libvirt-sock-ro" Sarvi On 3/7/13 8:29 AM, "Daniel P. Berrange" <berrange@redhat.com> wrote:
On Thu, Mar 07, 2013 at 01:05:22AM +0000, Saravanan Shanmugham (sarvi) wrote:
I am using the following configure to minimize dependencies and avoid anything unrelated to getting a libvirt remote client going. Turned on ‹with-remote=yes, --with-python=yes ‹with-rhel5-api=yes
./configure --with-python --with-apparmor=no --with-apparmor-mount=no --with-attr=no --with-audit=no --with-avahi=no --with-blkid=no --with-capng=no --with-curl=no --with-dbus=no --with-fuse=no --with-hal=no --with-netcf=no --with-numactl=no --with-openwsman=no --with-pciaccess=no --with-sanlock=no --with-sasl=no --with-selinux=no --with-selinux-mount=no --with-ssh2=no --with-udev=no --with-yajl=no --with-xen=no --with-xen-inotify=no --with-qemu=no --with-uml=no --with-openvz=no --with-vmware=no --with-phyp=no --with-xenapi=no --with-libxl=no --with-vbox=no --with-lxc=no --with-esx=no --with-hyperv=no --with-parallels=no --with-test=no --with-remote=yes --with-libvirtd=no --with-rhel5-api=yes --with-gnutls=no --with-polkit=no --with-firewalld=no --with-secdriver-selinux=no --with-secdriver-apparmor=no --with-dtrace=no --with-numad=no --with-network=no --with-secrets=no --with-storage-dir=no --with-storage-fs=no --with-storage-lvm=no --with-storage-iscsi=no --with-storage-scsi=no --with-storage-mpath=no --with-storage-disk=no --with-storage-rbd=no --with-storage-sheepdog=no --with-python=yes --with-interface=no --with-qemu-user=no --with-qemu-group=no --with-macvtap=no --with-virtualport=no
I am getting the following error/warnings. CC libvirt_util_la-virfile.lo In file included from util/virfile.c:36: /usr/include/linux/loop.h:31:2: #error "Wrong dev_t in loop.h" In file included from util/virfile.c:42: util/viralloc.h:67: warning: declaration of 'remove' shadows a global declaration /usr/include/stdio.h:154: warning: shadowed declaration is here make-3.79.1-p7[3]: *** [libvirt_util_la-virfile.lo] Error 1
I also found this thread relating to compiling clients for RHEL4 from 2011 https://www.redhat.com/archives/libvirt-users/2011-January/msg00108.html
Attached is a patch which makes 1.0.3 compile on RHEL-4. Apply to a fresh 1.0.3 libvirt codebase, and then run something like this:
# ./configure --without-libvirtd --without-python --without-numactl --without-vbox --prefix=/home/berrange/libvirt --localstatedir=/var --sysconfdir=/etc # make # make install
You could probably also pass --without-esx --without-parallels and --without-vbox
I'll get this patch applied to GIT for the next release
Regards, Daniel
diff -rup libvirt-1.0.3/src/driver.h libvirt-1.0.3.new/src/driver.h --- libvirt-1.0.3/src/driver.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/driver.h 2013-03-07 09:57:21.000000000 -0500 @@ -1443,7 +1443,7 @@ typedef char * typedef virStorageVolPtr (*virDrvStorageVolCreateXMLFrom) (virStoragePoolPtr pool, const char *xmldesc, - virStorageVolPtr clone, + virStorageVolPtr clonefrom, unsigned int flags); typedef int (*virDrvStorageVolDownload) (virStorageVolPtr vol, diff -rup libvirt-1.0.3/src/rpc/virnetclient.h libvirt-1.0.3.new/src/rpc/virnetclient.h --- libvirt-1.0.3/src/rpc/virnetclient.h 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/rpc/virnetclient.h 2013-03-07 10:07:48.000000000 -0500 @@ -37,7 +37,7 @@
virNetClientPtr virNetClientNewUNIX(const char *path, bool spawnDaemon, - const char *daemon); + const char *binary);
virNetClientPtr virNetClientNewTCP(const char *nodename, const char *service); Only in libvirt-1.0.3.new/src/rpc: virnetclient.h~ diff -rup libvirt-1.0.3/src/util/viralloc.c libvirt-1.0.3.new/src/util/viralloc.c --- libvirt-1.0.3/src/util/viralloc.c 2012-12-21 08:30:55.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.c 2013-03-07 09:47:29.000000000 -0500 @@ -341,12 +341,12 @@ virInsertElementsN(void *ptrptr, size_t */ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, - size_t *countptr, size_t remove, + size_t *countptr, size_t toremove, bool inPlace) { - if (at + remove > *countptr) { + if (at + toremove > *countptr) { VIR_WARN("out of bounds index - count %zu at %zu remove %zu", - *countptr, at, remove); + *countptr, at, toremove); return -1; }
@@ -355,12 +355,12 @@ virDeleteElementsN(void *ptrptr, size_t * already been cleared. */ memmove(*(char**)ptrptr + (size * at), - *(char**)ptrptr + (size * (at + remove)), - size * (*countptr - remove - at)); + *(char**)ptrptr + (size * (at + toremove)), + size * (*countptr - toremove - at)); if (inPlace) - *countptr -= remove; + *countptr -= toremove; else - virShrinkN(ptrptr, size, countptr, remove); + virShrinkN(ptrptr, size, countptr, toremove); return 0; }
diff -rup libvirt-1.0.3/src/util/viralloc.h libvirt-1.0.3.new/src/util/viralloc.h --- libvirt-1.0.3/src/util/viralloc.h 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/src/util/viralloc.h 2013-03-07 09:47:09.000000000 -0500 @@ -64,7 +64,7 @@ int virInsertElementsN(void *ptrptr, siz bool clearOriginal, bool inPlace) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, - size_t remove, bool inPlace) + size_t toremove, bool inPlace) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); int virAllocVar(void *ptrptr, size_t struct_size, diff -rup libvirt-1.0.3/src/util/virfile.c libvirt-1.0.3.new/src/util/virfile.c --- libvirt-1.0.3/src/util/virfile.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virfile.c 2013-03-07 09:53:25.000000000 -0500 @@ -32,7 +32,8 @@ #include <unistd.h> #include <dirent.h>
-#ifdef __linux__ +#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR +# include <sys/types.h> # include <linux/loop.h> # include <sys/ioctl.h> #endif diff -rup libvirt-1.0.3/src/util/virnetdevbridge.c libvirt-1.0.3.new/src/util/virnetdevbridge.c --- libvirt-1.0.3/src/util/virnetdevbridge.c 2013-01-17 01:01:39.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdevbridge.c 2013-03-07 10:06:29.000000000 -0500 @@ -46,7 +46,7 @@ #define VIR_FROM_THIS VIR_FROM_NONE
-#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) static int virNetDevSetupControlFull(const char *ifname, struct ifreq *ifr, int domain, @@ -89,7 +89,7 @@ static int virNetDevSetupControl(const c } #endif
-#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) # define SYSFS_NET_DIR "/sys/class/net" /* * Bridge parameters can be set via sysfs on newish kernels, @@ -211,7 +211,7 @@ cleanup: * * Returns 0 in case of success or -1 on failure */ -#ifdef SIOCBRADDBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR) int virNetDevBridgeCreate(const char *brname) { int fd = -1; @@ -249,7 +249,7 @@ int virNetDevBridgeCreate(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELBR +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR) int virNetDevBridgeDelete(const char *brname) { int fd = -1; @@ -288,7 +288,7 @@ int virNetDevBridgeDelete(const char *br * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRADDIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF) int virNetDevBridgeAddPort(const char *brname, const char *ifname) { @@ -335,7 +335,7 @@ int virNetDevBridgeAddPort(const char *b * * Returns 0 in case of success or an errno code in case of failure. */ -#ifdef SIOCBRDELIF +#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF) int virNetDevBridgeRemovePort(const char *brname, const char *ifname) { @@ -375,7 +375,7 @@ int virNetDevBridgeRemovePort(const char #endif
-#ifdef __linux__ +#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__) /** * virNetDevBridgeSetSTPDelay: * @brname: the bridge name Only in libvirt-1.0.3.new/src/util: virnetdevbridge.c~ diff -rup libvirt-1.0.3/src/util/virnetdev.c libvirt-1.0.3.new/src/util/virnetdev.c --- libvirt-1.0.3/src/util/virnetdev.c 2013-02-17 22:20:07.000000000 -0500 +++ libvirt-1.0.3.new/src/util/virnetdev.c 2013-03-07 10:04:54.000000000 -0500 @@ -673,6 +673,9 @@ int virNetDevGetIndex(const char *ifname
#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) +# ifndef GET_VLAN_VID_CMD +# define GET_VLAN_VID_CMD 9 +# endif int virNetDevGetVLanID(const char *ifname, int *vlanid) { struct vlan_ioctl_args vlanargs = { Only in libvirt-1.0.3.new/src/util: virnetdev.c~ diff -rup libvirt-1.0.3/tools/virsh-domain.c libvirt-1.0.3.new/tools/virsh-domain.c --- libvirt-1.0.3/tools/virsh-domain.c 2013-02-25 06:20:25.000000000 -0500 +++ libvirt-1.0.3.new/tools/virsh-domain.c 2013-03-07 10:23:23.000000000 -0500 @@ -56,6 +56,13 @@ #include "virtypedparam.h" #include "virxml.h"
+#ifndef xmlSaveToBuffer +XMLPUBFUN xmlSaveCtxtPtr XMLCALL +xmlSaveToBuffer (xmlBufferPtr buffer, + const char *encoding, + int options); +#endif + /* Gnulib doesn't guarantee SA_SIGINFO support. */ #ifndef SA_SIGINFO # define SA_SIGINFO 0 Only in libvirt-1.0.3.new/tools: virsh-domain.c~
-- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 03/06/2013 04:41 PM, Saravanan Shanmugham (sarvi) wrote:
Hi, We are trying to compile Libvirt 1.02 from source for an RHEL4 target.
Good luck. Unfortunately, upstream libvirt does not target RHEL4 (we have only tested that upstream libvirt can build on RHEL5), so there are probably lots of gotchas, and you will have to do lots of legwork yourself. Feel free to submit patches on what you changed to get things to work.
We are trying to compile a minimalist libvirt necessary on RHEL4 that would make remote control of VMs possible.
So all you need is the libvirt.so with RPC support, and then the python bindings. Use of --without-libvirtd will force a client-only configure, which should help. Any further compile issues are probably related to really old portability problems in your system headers. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Saravanan Shanmugham (sarvi)