2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Fix issue 863: mac could not be assigned to docker container

This commit is contained in:
ertaozh 2016-04-15 05:13:55 -04:00
parent d42b386f52
commit 3d4b215b33

View File

@ -1078,6 +1078,10 @@ sub genreq_for_mkdocker {
my ($node, $dockerhost, $method, $api) = @_;
my $dockerinfo = $node_hash_variable{$node};
my %info_hash = ();
if (defined($dockerinfo->{flag})) {
my $flag_hash = decode_json($dockerinfo->{flag});
%info_hash = %$flag_hash;
}
#$info_hash{name} = '/'.$node;
#$info_hash{Hostname} = '';
#$info_hash{Domainname} = '';
@ -1089,11 +1093,6 @@ sub genreq_for_mkdocker {
$info_hash{HostConfig}->{NetworkMode} = $dockerinfo->{nics};
$info_hash{NetworkDisabled} = JSON::false;
$info_hash{NetworkingConfig}->{EndpointsConfig}->{"$dockerinfo->{nics}"}->{IPAMConfig}->{IPv4Address} = $dockerinfo->{ip};
$info_hash{NetworkingConfig}->{EndpointsConfig}->{"$dockerinfo->{nics}"}->{MacAddress} = $dockerinfo->{mac};
if (defined($dockerinfo->{flag})) {
my $flag_hash = decode_json($dockerinfo->{flag});
%info_hash = (%info_hash, %$flag_hash);
}
my $content = encode_json \%info_hash;
return genreq($node, $dockerhost, $method, $api, $content);
}