Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
John Simpson 2013-10-31 11:33:11 -04:00
commit c76c88f0e2
9 changed files with 547 additions and 17 deletions

View File

@ -145,12 +145,13 @@ sub getcloudres
}
#$cloudres .= "hput $client cloud $cloud\n";
$cloudres .= "HASH".$client."cloud='$cloud'\nexport HASH".$client."cloud\n";
if ( $cloudlist !~ $cloud ) {
$cloudlist .="$cloud,";
if( defined($cloud) ) {
if ( $cloudlist !~ $cloud ) {
$cloudlist .="$cloud,";
}
}
my $t = $cloudinfo_hash->{$cloud}->{repository};
if( !defined($repos) ) {
if( !defined($repos) && defined($t) ) {
$repos = $t;
}
if( defined($repos) && ( $repos != $t && "$repos/" != $t && $repos != "$t/" ) ) {

View File

@ -167,7 +167,7 @@ sub process_request
unless ( -r "$tmplfile") {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="The $cloud environment template $tmplfile doesn't exist.";
$rsp->{error}->[0]="The environment template for the cloud $cloud doesn't exist. Please check the clouds table";
$callback->($rsp);
next;
}
@ -175,7 +175,7 @@ sub process_request
unless ( -r "$repos") {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="The $cloud repository $repos doesn't exist.";
$rsp->{error}->[0]="The repository $repos for the cloud $cloud doesn't exist. Pleae check the clouds table.";
$callback->($rsp);
next;
}

View File

@ -70,13 +70,19 @@ else
done
fi
if [ -z $CLOUDLIST ]
then
errmsg="Error! No Cloud name is assigned to the chef-client of the chef-server $NODE. Please check the cloud table."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
fi
# enter the repository director
# for example: cd /install/chef-cookbooks/grizzy-xcat/
if [ ! -d "$REPOSITORY" ]
then
errmsg="$REPOSITORY is not a OpenStack Chef cookbooks directory."
errmsg="Error! Not an available OpenStack Chef cookbooks repository for the cloud $CLOUDLIST.Please check the clouds table."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
@ -91,7 +97,7 @@ then
if [ $? != 0 ]
then
errmsg="Failed to run knife cookbook upload -o cookbooks --all on the chefserver $NODE."
logger -t xcat -p local4.err $errmsg
logger -t xcat -p local4.err "$errmsg"
echo $errmsg
exit 1
fi
@ -104,7 +110,7 @@ then
knife role from file roles/*.rb
if [ $? != 0 ]
then
errmsg="Failed to run knife role from file roles/*.rb on the chefserver $NODE."
errmsg="Failed to run \'knife role from file roles/*.rb\' on the chefserver $NODE."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
@ -144,7 +150,7 @@ then
knife environment from file environments/$cloud.rb
if [ $? != 0 ]
then
errmsg="Failed to run knife environment from file environments/$cloud.rb on the chef-server $NODE."
errmsg="Failed to run \'knife environment from file environments/$cloud.rb\' on the chef-server $NODE."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
@ -167,7 +173,7 @@ then
knife node create $c_fullname -d
if [ $? != 0 ]
then
errmsg="Failed to run knife node create $client -d on the chef-server $NODE."
errmsg="Failed to run \'knife node create $client -d\' on the chef-server $NODE."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
@ -176,7 +182,7 @@ then
roles=`hget $client roles`
if [ -z $roles ]
then
errmsg="No roles for $client. Please check the cfgmgt table."
errmsg="No value of the attribute cfgmgtroles is set for $client. Please check the cfgmgt table."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1
@ -196,7 +202,7 @@ then
newenv=`hget $client cloud`
if [ -z $newenv ]
then
errmsg="No cloud for $client. Please check the cloud table."
errmsg="No value of the attribute cloud is set for $client. Please check the cloud table."
logger -t xcat -p local4.err $errmsg
echo $errmsg
exit 1

View File

@ -0,0 +1,158 @@
#
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
#
name "$CLOUD"
description "Grizzly allinone environment file."
override_attributes(
"mysql" => {
"server_root_password" => "cluster",
"server_debian_password" => "cluster",
"server_repl_password" => "cluster",
"allow_remote_root" => true,
"root_network_acl" => "%"
},
"openstack" => {
"developer_mode" => true,
"db"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"compute"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"identity"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"image"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"network"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"volume"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"dashboard"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"metering"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
}
},
"mq"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"identity"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"db"=>{
"username"=>"keystone",
"password"=> "keystone"
}
},
"endpoints"=>{
"identity-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"identity-admin"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-ec2-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-ec2-admin"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-xvpvnc"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-novnc"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"network-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"image-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"image-registry"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"volume-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"metering-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
}
},
"image" => {
"api"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"registry"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"image_upload" => false,
"upload_images" => ["cirros"],
"upload_image" => {
"cirros" => "https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
},
"identity_service_chef_role" => "allinone-compute"
},
"block-storage" => {
"keystone_service_chef_role" => "allinone-compute"
},
"dashboard" => {
"keystone_service_chef_role" => "allinone-compute",
"use_ssl" => "false"
},
"network" => {
"metadata"=>{
"nova_metadata_ip"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"rabbit"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"api"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"rabbit_server_chef_role" => "allinone-compute",
"l3"=>{
"external_network_bridge_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"openvswitch"=> {
"tenant_network_type"=>"vlan",
"network_vlan_ranges"=>"physnet1",
"bridge_mappings"=>"physnet1:#TABLE:clouds:name=$CLOUD:datainterface#"
}
},
"compute" => {
"identity_service_chef_role" => "allinone-compute",
"rabbit"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"xvpvnc_proxy"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"novnc_proxy"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"network" => {
"service_type" => "quantum"
},
"config" => {
"ram_allocation_ratio" => 5.0
},
"libvirt" => {
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"virt_type" => "#TABLE:clouds:name=$CLOUD:virttype#"
}
}
}
)

View File

@ -0,0 +1,156 @@
#
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
# http://docs.openstack.org/grizzly/openstack-network/admin/content/app_demo_routers_with_private_networks.html
#
#
name "$CLOUD"
description "Grizzly environment file based on Per-tenant Routers with Private Networks"
override_attributes(
"mysql" => {
"server_root_password" => "cluster",
"server_debian_password" => "cluster",
"server_repl_password" => "cluster",
"allow_remote_root" => true,
"root_network_acl" => "%"
},
"openstack" => {
"developer_mode" => true,
"db"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"compute"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"identity"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"image"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"network"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"volume"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"dashboard"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"metering"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
}
},
"mq"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"identity"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"db"=>{
"username"=>"keystone",
"password"=> "keystone"
}
},
"endpoints"=>{
"identity-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"identity-admin"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-ec2-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-ec2-admin"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-xvpvnc"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"compute-novnc"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"network-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"image-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"image-registry"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"volume-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
},
"metering-api"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#",
}
},
"image" => {
"api"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"registry"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"image_upload" => false,
"upload_images" => ["cirros"],
"upload_image" => {
"cirros" => "https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
},
},
"dashboard" => {
"use_ssl" => "false"
},
"network" => {
"metadata"=>{
"nova_metadata_ip"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"rabbit"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"api"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#"
},
"l3"=>{
"external_network_bridge_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"allow_overlapping_ips" => "True",
"use_namespaces" => "True",
"openvswitch"=> {
"tenant_network_type"=>"gre",
"tunnel_id_ranges"=>"1:1000",
"enable_tunneling"=>"True",
"local_ip_interface"=>"#TABLE:clouds:name=$CLOUD:datainterface#"
}
},
"compute" => {
"identity_service_chef_role" => "os-compute-single-controller",
"rabbit"=>{
"host"=>"#TABLE:clouds:name=$CLOUD:hostip#"
},
"xvpvnc_proxy"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"novnc_proxy"=>{
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:pubinterface#"
},
"network" => {
"service_type" => "quantum",
},
"config" => {
"ram_allocation_ratio" => 5.0
},
"libvirt" => {
"bind_interface"=>"#TABLE:clouds:name=$CLOUD:mgtinterface#",
"virt_type" => "#TABLE:clouds:name=$CLOUD:virttype#"
}
}
}
)

View File

@ -54,8 +54,8 @@ chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/*
cp -a postscripts/* $RPM_BUILD_ROOT/install/postscripts
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
cp -a share/xcat/mypostscript/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/mypostscript
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/mypostscript/*
cp -a share/xcat/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/*
%clean
rm -rf $RPM_BUILD_ROOT

View File

@ -1061,6 +1061,9 @@ sub extract_bundle {
}
#print Dumper($data);
#push @{$datas}, $data;
#support imgimport osimage exported by xCAT 2.7
manifest_adapter($data);
# now we need to import the files...
unless(verify_manifest($data, $callback)){
@ -1362,6 +1365,36 @@ sub set_config {
return 1;
}
#an adapter to convert the manifest structure from 2.7 to 2.8
sub manifest_adapter {
my $data = shift;
if(exists($data->{osimage}) or exists($data->{linuximage})){
return 0;
}
my %colstodel;
foreach my $col (@{$xCAT::Schema::tabspec{osimage}->{cols}}){
if(defined($data->{$col})){
$colstodel{$col}=1;
$data->{osimage}->{$col}=$data->{$col};
}
}
foreach my $col (@{$xCAT::Schema::tabspec{linuximage}->{cols}}){
if(defined($data->{$col})){
$colstodel{$col}=1;
$data->{linuximage}->{$col}=$data->{$col};
}
}
foreach my $col(keys %colstodel){
delete($data->{$col});
}
return 1;
}
sub verify_manifest {
my $data = shift;

View File

@ -15,7 +15,7 @@ use xCAT::Table;
my $request;
my %breaknetbootnodes;
my %normalnodes;
our %normalnodes;
my $callback;
my $sub_req;
my $dhcpconf = "/etc/dhcpd.conf";

176
xCAT/postscripts/configeth_aix Executable file
View File

@ -0,0 +1,176 @@
#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# Sample xCAT post script for configuring eth1 based on eth0 settings and
# some conventions.
# This scripts works for both diskfull installs, diskless boots on AIX or Linux.
# To use, change the settings of the following variables at the top of this script:
# $nic_num - set this to the interface number, e.g. 1 for eth1 or en1
# $netmask - the netmask that should be used when ifconfig'ing this NIC
use strict;
use Socket;
# Set these 2 variables appropriately for your cluster
my $nic_num = 1;
my $netmask = '255.255.255.0';
my $nic;
if ($^O =~ /^aix/i) {
$nic = "en$nic_num";
} else {
$nic = "eth$nic_num";
}
# Usually do not have to set this...
my $gateway;
#$gateway = '1.2.3.254';
# Take primary node name, add "-eth1" for linux and "-en1" for AIX and
# then reverse resolve to get what ip should be
sub getipaddr()
{
my ($iporhost) = @_;
my $socket6support = eval { require Socket6 };
if (($iporhost =~ /\d+\.\d+\.\d+\.\d+/) || ($iporhost =~ /:/))
{
#pass in an ip and only want an ip??
return $iporhost;
}
if ($socket6support) # the getaddrinfo and getnameinfo supports both IPv4 and IPv6
{
my ($family, $socket, $protocol, $ip, $name) = Socket6::getaddrinfo($iporhost,0);
if ($ip)
{
return (Socket6::getnameinfo($ip, Socket6::NI_NUMERICHOST()))[0];
}
return undef;
}
else
{
return inet_ntoa(inet_aton($iporhost))
}
}
my $host = `echo $ENV{NODE} |sed "s/-hf[0-9]//g"`;
chomp($host);
my $hostname = "$host-$nic";
my $ip = &getipaddr($hostname);
if (!$ip) { system("logger -t xcat 'configeth: cannot resolve $hostname.'"); exit 1; }
if ($^O =~ /^aix/i) {
if ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
runcmd("chdev -l 'en$nic_num' -a netaddr=$ip -a netmask=$netmask -a state='up'");
} else { #ipv6
runcmd("autoconf6 -6i en$nic_num");
}
}
elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /sles|suse/i)) || (-f "/etc/SuSE-release")) {
# Write the info to the ifcfg file
my $dir = "/etc/sysconfig/network";
if (!open(FILE, ">$dir/ifcfg-$nic")) { system("logger -t xcat 'configeth: cannot open $dir/ifcfg-$nic.'"); exit 1; }
# Not sure what is really REQUIRED from below -- copied the eth file from
# the system
print FILE "BOOTPROTO=\'static\'\n";
print FILE "BROADCAST=\'\'\n";
print FILE "ETHTOOL_OPTIONS=\'\'\n";
print FILE "IPADDR=\'".$ip."\'\n";
print FILE "MTU=\'\'\n";
print FILE "NAME=\'\'\n";
print FILE "NETMASK=\'".$netmask."\'\n";
print FILE "NETWORK=\'\'\n";
print FILE "REMOTE_IPADDR=\'\'\n";
print FILE "STARTMODE=\'onboot\'\n";
print FILE "UNIQUE=\'\'\n";
print FILE "USERCONTROL=\'no\'\n";
print FILE "_nm_name=\'static-0\'\n";
close FILE;
runcmd("ifup $nic");
my $nic = 'eth0';
# make file for eth0, too
if (! -f "$dir/ifcfg-$nic") {
my $hostname = "$ENV{NODE}";
my $ip = &getipaddr($hostname);
if (!$ip) { system("logger -t xcat 'configeth: cannot resolve $hostname.'"); exit 1; }
# Write the info to the ifcfg file
my $dir = "/etc/sysconfig/network";
if (!open(FILE, ">$dir/ifcfg-$nic")) { system("logger -t xcat 'configeth: cannot open $dir/ifcfg-$nic.'"); exit 1; }
# Not sure what is really REQUIRED from below -- copied the eth file from
# the system
print FILE "BOOTPROTO=\'static\'\n";
print FILE "BROADCAST=\'\'\n";
print FILE "ETHTOOL_OPTIONS=\'\'\n";
print FILE "IPADDR=\'".$ip."\'\n";
print FILE "MTU=\'\'\n";
print FILE "NAME=\'\'\n";
print FILE "NETMASK=\'".$netmask."\'\n";
print FILE "NETWORK=\'\'\n";
print FILE "REMOTE_IPADDR=\'\'\n";
print FILE "STARTMODE=\'onboot\'\n";
print FILE "UNIQUE=\'\'\n";
print FILE "USERCONTROL=\'no\'\n";
print FILE "_nm_name=\'static-0\'\n";
close FILE;
runcmd("ifup $nic");
}
}
else {
# Write the info to the ifcfg file
my $dir = "/etc/sysconfig/network-scripts";
if (!open(FILE, ">$dir/ifcfg-$nic")) { system("logger -t xcat 'configeth: cannot open $dir/ifcfg-$nic.'"); exit 1; }
print FILE "DEVICE=$nic\n";
print FILE "BOOTPROTO=none\n";
print FILE "IPADDR=$ip\n";
print FILE "NETMASK=$netmask\n";
if (defined($gateway)) { print FILE "GATEWAY=$gateway\n"; }
print FILE "ONBOOT=yes\n";
close FILE;
runcmd("$dir/ifup $nic");
}
system("logger -t xcat 'configeth: successfully configured $nic.'");
exit 0;
sub runcmd {
my $cmd = shift @_;
$cmd .= ' 2>&1';
my @output = `$cmd`;
my $rc = $? >> 8;
if ($rc) {
system("logger -t xcat 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'");
my $errout= "configeth: command $cmd failed with rc $rc.";
echo $errout;
exit $rc;
}
}
#$master=$ENV{MASTER};
#if ($^O =~ /^aix/i) { }
#elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /fedora/i)) || (-f "/etc/fedora-release")) { }
#elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /sles|suse/i)) || (-f "/etc/SuSE-release")) { }
#$result=`grep "^SYSLOG_DAEMON=" $sysconfig 2>&1`;
#`logger -t xcat "Install: syslog setup"`;