Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7b9fc0e
wip: dns provider framework
sudo87 Feb 4, 2026
b2d597c
add db schema, vo and dao classes
sudo87 Feb 10, 2026
6ef7f9b
add powerdns module in plugins
sudo87 Feb 11, 2026
9911c28
Changes done to AddDnsServer, ListDnsServer, DeleteDnsServer and Upda…
sudo87 Feb 12, 2026
df21318
1. Setup Dns zone schema
sudo87 Feb 13, 2026
f29b8be
following dns zone apis are integrated:
sudo87 Feb 15, 2026
9b77c37
Tested following flow:
sudo87 Feb 16, 2026
c5972ae
Add associate and disassociate zone to network APIs
sudo87 Feb 16, 2026
99f8c7d
following things are done:
sudo87 Feb 17, 2026
e011ce1
add missing license, cleanup, log std
sudo87 Feb 18, 2026
4a9f66d
following changes are done:
sudo87 Feb 19, 2026
c64cf81
include:
sudo87 Feb 20, 2026
4df11a4
normalize dns zone and record in svc layer, always use dotless data i…
sudo87 Feb 21, 2026
857436e
enable apis for all roles
sudo87 Feb 21, 2026
582b687
add ACL annotation, entitytype, minor cleanup
sudo87 Feb 21, 2026
add7763
acl related changes, fixes, mistakes
sudo87 Feb 25, 2026
1fe79bd
fixes related to acl, dao
sudo87 Feb 25, 2026
6ca9d5a
add views for dns_server and dns_zone
sudo87 Feb 26, 2026
1c1eef3
Add Listener for VM lifecycle to add dnsrecords for associated dns zone
sudo87 Mar 2, 2026
caf8533
1. implement event processing for vm start/stop/destroy, nic create/d…
sudo87 Mar 3, 2026
856158c
starting on ui work
sudo87 Mar 3, 2026
928db65
resolve merge conflict with main
sudo87 Mar 3, 2026
369bb16
fix lint issue
sudo87 Mar 3, 2026
0df50ce
fix list dnsservers api, ui screens for dns servers, generate events
sudo87 Mar 4, 2026
a9afbce
UI related work and fixes in updateDnsServer cmd
sudo87 Mar 10, 2026
6bcfbc6
resolve conflict with main
sudo87 Mar 13, 2026
c74a579
resolve build and licensefailure issue
sudo87 Mar 14, 2026
7f5e2a7
continue UI component work, fix minor issue with apis
sudo87 Mar 17, 2026
d8cca73
resolve conflict with main
sudo87 Mar 17, 2026
a1eca74
work on updateDnsServer ui screen, fixed acl issue for dns server and…
sudo87 Mar 18, 2026
981bb64
add associate and disassociate dns zone to network ui screens, networ…
sudo87 Mar 19, 2026
af7ce8e
fix addDnsRecord and deleteDnsRecord flow for automatic registration …
sudo87 Mar 20, 2026
bde9fd9
improve cleanup logic for DNS zone and server
sudo87 Mar 23, 2026
5682a5a
modify delete flow for dns zone and server, ask to key in name
sudo87 Mar 23, 2026
c6abed1
Following changes are part of this commit:
sudo87 Mar 25, 2026
f1dcd00
add unit tests
sudo87 Apr 1, 2026
f524bbe
resolve conflict with main
sudo87 Apr 1, 2026
9d4e141
unit tests
sudo87 Apr 1, 2026
8d10ae1
Following changes are done:
sudo87 Apr 6, 2026
3567819
fix automatic dns record registration based on vm and nic lifecycle
sudo87 Apr 9, 2026
883dc32
changes:
sudo87 Apr 10, 2026
3ae9834
fix normalizing dns record values for mx, srv and other type
sudo87 Apr 11, 2026
a036281
split cleanup of old dns urls and new record registration
sudo87 Apr 13, 2026
6466362
unit tests
sudo87 Apr 14, 2026
9d0884a
add marvin test for powerdns
sudo87 Apr 15, 2026
30566d1
merge main changes
sudo87 Apr 15, 2026
f96d4cd
trim trailing space
sudo87 Apr 15, 2026
2d14c26
rename credentials param in dns server vue files to apikey
sudo87 Apr 16, 2026
001a197
rename apikey to dnsapikey, refactor ui and add dig verification in i…
sudo87 Apr 17, 2026
172ac67
rename dnsrecordurl -> nicdnsname, DnsNicJoinView -> nicDnsJoinVo
sudo87 Apr 20, 2026
5f627aa
changes in this commit:
sudo87 Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changes:
1. handle vm hostname change for dns registration
2. generate event for dns name collision
3. remove dns record lifecycle subscriber
  • Loading branch information
sudo87 committed Apr 10, 2026
commit 883dc32abff13b324680c2d20279b14dd7b3e45a
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/event/EventTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ public class EventTypes {
public static final String EVENT_DNS_ZONE_DELETE = "DNS.ZONE.DELETE";
public static final String EVENT_DNS_RECORD_CREATE = "DNS.RECORD.CREATE";
public static final String EVENT_DNS_RECORD_DELETE = "DNS.RECORD.DELETE";
public static final String EVENT_DNS_NAME_COLLISION = "DNS.NAME.COLLISION";

static {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ public class ApiConstants {
public static final String INSTANCE_ID = "instanceId";
public static final String OLD_STATE = "oldState";
public static final String NEW_STATE = "newState";
public static final String OLD_HOST_NAME = "oldHostName";


public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " +
Expand Down
5 changes: 0 additions & 5 deletions api/src/main/java/org/apache/cloudstack/dns/DnsProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
import com.cloud.utils.component.Adapter;

public interface DnsProvider extends Adapter {

interface Topics {
String DNS_RECORD_LIFECYCLE = "dns.record.lifecycle";
}

DnsProviderType getProviderType();

// Validates connectivity to the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@
import org.apache.cloudstack.api.response.DnsZoneResponse;
import org.apache.cloudstack.api.response.ListResponse;

import com.cloud.network.Network;
import com.cloud.user.Account;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.PluggableService;
import com.cloud.vm.Nic;
import com.cloud.vm.VirtualMachine;

public interface DnsProviderManager extends Manager, PluggableService {

Expand Down Expand Up @@ -75,8 +72,6 @@ public interface DnsProviderManager extends Manager, PluggableService {

boolean disassociateZoneFromNetwork(DisassociateDnsZoneFromNetworkCmd cmd);

void deleteDnsRecordForVM(VirtualMachine instance, Network network, Nic nic);

void checkDnsServerPermission(Account caller, DnsServer dnsServer);

void checkDnsZonePermission(Account caller, DnsZone dnsZone);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public interface VirtualMachineManager extends Manager {

interface Topics {
String VM_POWER_STATE = "vm.powerstate";
String VM_LIFECYCLE = "vm.lifecycle";
String VM_LIFECYCLE_STATE = "vm.lifecycle.state";
String VM_ACTION = "vm.action";
}

/**
Expand Down
28 changes: 25 additions & 3 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

import static com.cloud.event.EventTypes.EVENT_NIC_CREATE;
import static com.cloud.event.EventTypes.EVENT_NIC_DELETE;
import static com.cloud.event.EventTypes.EVENT_VM_UPDATE;
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality;
import static com.cloud.storage.Volume.IOPS_LIMIT;
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
import static com.cloud.vm.VirtualMachineManager.Topics.VM_LIFECYCLE;
import static com.cloud.vm.VirtualMachineManager.Topics.VM_ACTION;
import static com.cloud.vm.VirtualMachineManager.Topics.VM_LIFECYCLE_STATE;
import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS;
import static org.apache.cloudstack.api.ApiConstants.MIN_IOPS;

Expand Down Expand Up @@ -163,6 +165,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.logging.log4j.util.Strings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
Expand Down Expand Up @@ -1554,7 +1557,7 @@ private void publishVmLifecycleMessageBus(UserVm instance, @Nullable VirtualMach
event.put(ApiConstants.OLD_STATE, oldState != null ? oldState : State.Unknown);
event.put(ApiConstants.NEW_STATE, newState);
event.put(ApiConstants.TIME_STAMP, System.currentTimeMillis());
messageBus.publish(_name, VM_LIFECYCLE, PublishScope.GLOBAL, event);
messageBus.publish(_name, VM_LIFECYCLE_STATE, PublishScope.GLOBAL, event);
} catch (Exception ex) {
logger.warn("Failed to publish lifecycle event for Instance: {}", instance.getUuid(), ex);
}
Expand All @@ -1576,6 +1579,24 @@ private void publishNicEventMessageBus(Long instanceId, Long accountId, Long nic
}
}

private void publishVmHostNameUpdateMessageBus(long instanceId, String oldHostName, String hostName) {
if (Strings.isBlank(hostName) || oldHostName.equalsIgnoreCase(hostName)) {
return;
}
try {
Map<String, Object> event = new HashMap<>();
event.put(ApiConstants.EVENT_ID, UUID.randomUUID().toString());
event.put(ApiConstants.INSTANCE_ID, instanceId);
event.put(ApiConstants.OLD_HOST_NAME, oldHostName);
event.put(ApiConstants.HOST_NAME, hostName);
event.put(ApiConstants.EVENT_TYPE, EVENT_VM_UPDATE);
event.put(ApiConstants.TIME_STAMP, System.currentTimeMillis());
messageBus.publish(_name, VM_ACTION, PublishScope.GLOBAL, event);
} catch (Exception ex) {
logger.error("Failed to publish Instance action event for ID: {}", instanceId, ex);
}
}

/**
* Set NIC as default if VM has no default NIC
* @param vmInstance VM instance to be checked
Expand Down Expand Up @@ -2964,7 +2985,7 @@ protected void updateVmExtraConfig(UserVmVO userVm, String extraConfig, boolean
}

@Override
@ActionEvent(eventType = EventTypes.EVENT_VM_UPDATE, eventDescription = "updating Vm")
@ActionEvent(eventType = EVENT_VM_UPDATE, eventDescription = "updating Vm")
public UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException {
validateInputsAndPermissionForUpdateVirtualMachineCommand(cmd);

Expand Down Expand Up @@ -3340,6 +3361,7 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo
}

if (State.Running == vm.getState()) {
publishVmHostNameUpdateMessageBus(vm.getId(), vm.getHostName(), hostName);
updateDns(vm, hostName);
}

Expand Down
Loading
Loading