Darryl L. Pierce
2008-Jun-25 17:58 UTC
[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- ovirt-host-creator/common-pkgs.ks | 1 + ovirt-host-creator/common-post.ks | 3 ++- ovirt-managed-node/src/ovirt-identify-node.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) 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 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..3a6fde8 100644 --- a/ovirt-host-creator/common-post.ks +++ b/ovirt-host-creator/common-post.ks @@ -237,7 +237,8 @@ start() { echo -n $"Starting ovirt-post: " find_srv identify tcp - ovirt-identify-node -s $SRV_HOST -p $SRV_PORT + UUID=`/usr/sbin/dmidecode | grep -i uuid | awk '{ print $2; }'` + ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -u $UUID success echo 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; case 't': testing = 1; break; case 'd': debug = 1; break; case 'v': verbose = 1; break; -- 1.5.5.1
Perry N. Myers
2008-Jun-25 18:02 UTC
[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.
Darryl L. Pierce wrote:> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> > --- > ovirt-host-creator/common-pkgs.ks | 1 + > ovirt-host-creator/common-post.ks | 3 ++- > ovirt-managed-node/src/ovirt-identify-node.c | 3 ++- > 3 files changed, 5 insertions(+), 2 deletions(-) > > 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 > 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..3a6fde8 100644 > --- a/ovirt-host-creator/common-post.ks > +++ b/ovirt-host-creator/common-post.ks > @@ -237,7 +237,8 @@ start() { > echo -n $"Starting ovirt-post: " > > find_srv identify tcp > - ovirt-identify-node -s $SRV_HOST -p $SRV_PORT > + UUID=`/usr/sbin/dmidecode | grep -i uuid | awk '{ print $2; }'` > + ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -u $UUID > > success > echo > 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; > case 't': testing = 1; break; > case 'd': debug = 1; break; > case 'v': verbose = 1; break;I thought this was problematic on VMs since they all have the same UUID? We should use dmidecode for UUID only if we're running on bare metal. If running as the developer appliance (i.e. fake managed nodes) we should just use the hostname as UUID for now. Perry -- |=- Red Hat, Engineering, Emerging Technologies, Boston -=| |=- Email: pmyers at redhat.com -=| |=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=| |=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|
Daniel P. Berrange
2008-Jun-25 18:38 UTC
[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.
On Wed, Jun 25, 2008 at 01:58:05PM -0400, Darryl L. Pierce wrote:> - ovirt-identify-node -s $SRV_HOST -p $SRV_PORT > + UUID=`/usr/sbin/dmidecode | grep -i uuid | awk '{ print $2; }'`Don't use dmidecode - this is x86 specific and won't work in ia64/ppc I believe. Instead use HAL to get it eg $ lshal | grep system.hardware.uuid system.hardware.uuid = 'E9CD5280-4897-11CB-9596-A088B277D677' (string) This has added benefit of not needing root privileges Regards, Daniel. -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Darryl L. Pierce
2008-Jun-25 20:45 UTC
[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- ovirt-host-creator/common-pkgs.ks | 1 + ovirt-host-creator/common-post.ks | 11 ++++++++++- ovirt-managed-node/src/ovirt-identify-node.c | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) 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 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 + success echo 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; case 't': testing = 1; break; case 'd': debug = 1; break; case 'v': verbose = 1; break; -- 1.5.5.1
Darryl L. Pierce
2008-Jun-26 11:35 UTC
[Ovirt-devel] [PATCH] Changed the source for UUID to be dmidecode for now.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- ovirt-host-creator/common-pkgs.ks | 1 + ovirt-host-creator/common-post.ks | 14 +++++++++++++- ovirt-managed-node/src/ovirt-identify-node.c | 7 ++++--- 3 files changed, 18 insertions(+), 4 deletions(-) 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 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..232485f 100644 --- a/ovirt-host-creator/common-post.ks +++ b/ovirt-host-creator/common-post.ks @@ -237,7 +237,19 @@ start() { echo -n $"Starting ovirt-post: " find_srv identify tcp - ovirt-identify-node -s $SRV_HOST -p $SRV_PORT + + # TODO: In future, when libvirt supports getting the UUID, + # we will remove this check and let ovirt-identify-node + # grab the UUID internally + VENDOR=`dmidecode | awk ' /Vendor/{ print $2; } '` + UUID=`dmidecode | awk ' /UUID/{ 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 + success echo diff --git a/ovirt-managed-node/src/ovirt-identify-node.c b/ovirt-managed-node/src/ovirt-identify-node.c index 41dfec3..b882b55 100644 --- a/ovirt-managed-node/src/ovirt-identify-node.c +++ b/ovirt-managed-node/src/ovirt-identify-node.c @@ -53,7 +53,7 @@ char uuid[VIR_UUID_BUFLEN]; char memsize[BUFFER_LENGTH]; char numcpus[BUFFER_LENGTH]; char cpuspeed[BUFFER_LENGTH]; -char hostname[256]; +char* hostname; int hostport = -1; int socketfd; @@ -124,14 +124,15 @@ 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); switch(option) { - case 's': strcpy(hostname,optarg); break; + case 's': hostname = optarg; break; case 'p': hostport = atoi(optarg); break; + case 'u': strcpy(uuid,optarg); break; case 't': testing = 1; break; case 'd': debug = 1; break; case 'v': verbose = 1; break; -- 1.5.5.1