@@ -587,17 +587,18 @@ public DnsZone allocateDnsZone(CreateDnsZoneCmd cmd) {
587587 }
588588
589589 @ Override
590- public DnsZone provisionDnsZone (long dnsZoneId , boolean isImport ) {
590+ public DnsZone provisionDnsZone (long dnsZoneId , boolean isExistingZone ) {
591591 DnsZoneVO dnsZone = dnsZoneDao .findById (dnsZoneId );
592592 if (dnsZone == null ) {
593593 throw new CloudRuntimeException ("DNS zone not found during provisioning" );
594594 }
595595 DnsServerVO server = dnsServerDao .findById (dnsZone .getDnsServerId ());
596596 try {
597597 DnsProvider provider = getProviderByType (server .getProviderType ());
598- if (isImport ) {
598+ if (isExistingZone ) {
599599 if (!provider .dnsZoneExists (server , dnsZone )) {
600- throw new CloudRuntimeException (String .format ("DNS zone '%s' cannot be imported because it does not exist in the DNS provider" , dnsZone ));
600+ throw new CloudRuntimeException (
601+ String .format ("DNS zone '%s' cannot be imported because it does not exist in the DNS provider" , dnsZone .getName ()));
601602 }
602603 } else {
603604 String externalReferenceId = provider .provisionZone (server , dnsZone );
@@ -610,10 +611,12 @@ public DnsZone provisionDnsZone(long dnsZoneId, boolean isImport) {
610611 dnsZoneDao .remove (dnsZoneId );
611612 logger .error ("Failed to provision DNS zone: {} on DNS server: {}" , dnsZone .getName (), server .getName (), ex );
612613 String errorMsg = "" ;
613- if ( ex instanceof DnsConflictException ) {
614+ if (ex instanceof DnsConflictException ) {
614615 errorMsg = String .format ("DNS zone: %s already exists" , dnsZone .getName ());
615- } else if (ex instanceof DnsTransportException ){
616+ } else if (ex instanceof DnsTransportException ) {
616617 errorMsg = String .format ("DNS server: %s not reachable" , server .getName ());
618+ } else if (ex instanceof CloudRuntimeException ) {
619+ errorMsg = ex .getMessage ();
617620 }
618621 throw new CloudRuntimeException (errorMsg );
619622 }
0 commit comments