Skip to content

Duplicated mac addresses in a zone #7633

@weizhouapache

Description

@weizhouapache

Note: This issue is difficult to reproduce,but we do notice it in one environment, which caused some issues.

When create a VM on isolated network, the mac address is generated by the following method

    @Override
    public String getNextAvailableMacAddress(final long networkConfigId, Integer zoneMacIdentifier) {
        final SequenceFetcher fetch = SequenceFetcher.getInstance();
        long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId);
        if(zoneMacIdentifier != null && zoneMacIdentifier.intValue() != 0 ){
            seq = seq | _prefix << 40 | (long)zoneMacIdentifier << 32 | networkConfigId << 16 & 0x00000000ffff0000l;
        }
        else {
            seq = seq | _prefix << 40 | _rand.nextInt(Short.MAX_VALUE) << 16 & 0x00000000ffff0000l;
        }
        return NetUtils.long2Mac(seq);
    }

It could happen that the mac addresses are duplicated in the same network or among different networks.
Ideally the mac address should be unique in a zone.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

CLOUDSTACK VERSION

CONFIGURATION
OS / ENVIRONMENT
SUMMARY
STEPS TO REPRODUCE

EXPECTED RESULTS

ACTUAL RESULTS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions