[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.

Chris Lalancette clalance at redhat.com
Thu Jun 26 06:52:39 UTC 2008


Darryl L. Pierce wrote:
> diff --git a/ovirt-host-creator/common-pkgs.ks b/ovirt-host-creator/common-pkgs.ks
> index 6fe4f26..3ad8fa0 100644
> --- a/ovirt-host-creator/common-pkgs.ks
> +++ b/ovirt-host-creator/common-pkgs.ks
> @@ -26,6 +26,7 @@ augeas
>  nc
>  bind-utils
>  syslinux
> +dmidecode

Have you checked what the dmidecode package does to the size of the managed node
image?  I'm sure the package itself is small, but I'm just wondering about it's
dependencies.  As long as the resulting image is still < 64MB, it's no problem
at all.  If it brings in a lot of dependencies, we'll have to look at trying to
cut them down.

>  ovirt-managed-node
>  -policycoreutils
>  -audit-libs-python
> diff --git a/ovirt-host-creator/common-post.ks b/ovirt-host-creator/common-post.ks
> index a7dc987..a35f40e 100644
> --- a/ovirt-host-creator/common-post.ks
> +++ b/ovirt-host-creator/common-post.ks
> @@ -237,7 +237,16 @@ start() {
>      echo -n $"Starting ovirt-post: "
>  
>      find_srv identify tcp
> -    ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
> +
> +    VENDOR=`dmidecode | grep Vendor | awk ' { print $2; } '`
> +    UUID=`dmidecode | grep UUID | awk ' { print $2; } '`
> +
> +    if [ $VENDOR != "QEMU" ]; then
> +        ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -u $UUID
> +    else
> +        ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
> +    fi
> +

OK.  I think this is almost right, but still needs to be changed a little, since
we should always send over a UUID.  So something like this:

VENDOR=`dmidecode | awk ' /Vendor/{ print $2; } '`
UUID=`dmidecode | awk ' /UUID/{ print $2; } '`
if [ -z "$UUID" -o "$VENDOR" = "QEMU" ]; then
	UUID=get_my_hostname
fi

ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -u $UUID

That way you always have some UUID, either the value from the DMI tables in the
case of bare-metal, or the hostname in the case of QEMU/KVM guest or missing
UUID in bare-metal.

> diff --git a/ovirt-managed-node/src/ovirt-identify-node.c b/ovirt-managed-node/src/ovirt-identify-node.c
> index 41dfec3..d46eeac 100644
> --- a/ovirt-managed-node/src/ovirt-identify-node.c
> +++ b/ovirt-managed-node/src/ovirt-identify-node.c
> @@ -124,7 +124,7 @@ int config(int argc,char** argv)
>      int result = 0;
>      int option;
>  
> -    while((option = getopt(argc,argv,"s:p:dvth")) != -1)
> +    while((option = getopt(argc,argv,"s:p:u:dvth")) != -1)
>      {
>          if(debug) fprintf(stdout,"Processing argument: %c (optarg:%s)\n",option,optarg);
>  
> @@ -132,6 +132,7 @@ int config(int argc,char** argv)
>          {
>              case 's': strcpy(hostname,optarg); break;
>              case 'p': hostport = atoi(optarg); break;
> +            case 'u': strcpy(uuid,optarg);     break;

Nit here (and in fact for all of the option processing): you don't need to
strcpy from optarg into your variable.  You can just make uuid a pointer and
then point it at optarg, since glibc has already allocated the optarg memory for
you.

Chris Lalancette




More information about the ovirt-devel mailing list