2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

Merge pull request #935 from zet809/fix_issue_863

Fix issue 863: mac could not be assigned to docker container
This commit is contained in:
chenglch 2016-04-15 17:20:22 +08:00
commit 802d8fc7fc

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);
}