hi,

This minor fix will fix the head node  fileds that are not correct.
- fqdn was not set (fully qualified hostname)
- hostname was the fqdn

Before:
mysql> select * from Nodes;
+------------+---------+-----------+--------------+------+--------------+-----------------------+----+----------+-----------+--------------+------+------+-------+---------+
| cluster_id | cpu_num | cpu_speed | dns_domain   | fqdn | group_name   | 
hostname              | id | image_id | installer | name         | ram  | swap 
| units | virtual |
+------------+---------+-----------+--------------+------+--------------+-----------------------+----+----------+-----------+--------------+------+------+-------+---------+
|          1 |    NULL | NULL      | intra.cea.fr | NULL | oscar_server | 
is005760.intra.cea.fr |  1 |        0 | NULL      | oscar_server | NULL | NULL 
| NULL  | NULL    |
+------------+---------+-----------+--------------+------+--------------+-----------------------+----+----------+-----------+--------------+------+------+-------+---------+
1 row in set (0.00 sec)

After:
mysql> select * from Nodes;
+------------+---------+-----------+--------------+----------------------+--------------+----------+----+----------+-----------+--------------+------+------+-------+---------+
| cluster_id | cpu_num | cpu_speed | dns_domain   | fqdn                 | 
group_name   | hostname | id | image_id | installer | name         | ram  | 
swap | units | virtual |
+------------+---------+-----------+--------------+----------------------+--------------+----------+----+----------+-----------+--------------+------+------+-------+---------+
|          1 |    NULL | NULL      | intra.cea.fr | is005760intra.cea.fr | 
oscar_server | is005760 |  1 |        0 | NULL      | oscar_server | NULL | 
NULL | NULL  | NULL    |
+------------+---------+-----------+--------------+----------------------+--------------+----------+----+----------+-----------+--------------+------+------+-------+---------+
1 row in set (0.00 sec)

I've also inserted 2 chomps for hostname and dnsdomainname that disapeared or 
were misplaced during last commit.

Regards,

-- 
        Olivier LAHAYE
        CEA Saclay
        DRT-LIST-DETECS-SSTM
Index: create_and_populate_basic_node_info
===================================================================
--- create_and_populate_basic_node_info	(révision 9116)
+++ create_and_populate_basic_node_info	(copie de travail)
@@ -86,14 +86,26 @@
 
 # Then, we update some of the fields in the node record for oscar_server.
 # If the entry does not exist, we include it.
+# fqdn: fully qualified domain name: = $hostname.$dns_domain
+# name: hostname without dns domainname
 my $hostname = `hostname`;
+chomp $hostname;
 print "Updating the hostname field in the oscar_server node to <$hostname> ...\n";
-%field_value_hash = ( "hostname" => $hostname );
+%field_value_hash = ( );
 my $dns_domain = `dnsdomainname`;
-chomp $hostname;
+chomp $dns_domain;
 if ( defined $dns_domain && $dns_domain ne "" ) {
     $field_value_hash{"dns_domain"} = $dns_domain;
+    # Get the non fqdn hostname.
+    # Note: when dnsdomainname is set, sometimes hostname returns fqdn, sometimes not.
+    $hostname =~ s/\.$dns_domain//g;
+    $field_value_hash{"hostname"} = $hostname;
+    # We are sure it is a fqdn
+    $field_value_hash{"fqdn"} = $hostname.$dns_domain;
+} else {
+    %field_value_hash = ( "hostname" => $hostname );
 }
+
 if (OSCAR::Database::update_node ('oscar_server',
                                   \%field_value_hash,
                                   undef,
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Oscar-devel mailing list
Oscar-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to