Skip to content

Commit f8300cc

Browse files
committed
fix for hostname RFC compliance
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent d25717c commit f8300cc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

server/src/main/java/org/apache/cloudstack/ingestion/VmIngestionManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ public UserVmResponse importUnmanagedInstance(ImportUnmanageInstanceCmd cmd) {
289289
}
290290
String hostName = cmd.getHostName();
291291
if (Strings.isNullOrEmpty(hostName)) {
292-
if (NetUtils.verifyDomainNameLabel(instanceName, true)) {
292+
if (!NetUtils.verifyDomainNameLabel(instanceName, true)) {
293293
throw new InvalidParameterValueException(String.format("Please provide hostname for the VM. VM name contains unsupported characters for it to be used as hostname"));
294294
}
295295
hostName = instanceName;
296296
}
297-
if (NetUtils.verifyDomainNameLabel(hostName, true)) {
297+
if (!NetUtils.verifyDomainNameLabel(hostName, true)) {
298298
throw new InvalidParameterValueException("Invalid VM hostname. VM hostname can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
299299
+ "and the hyphen ('-'), must be between 1 and 63 characters long, and can't start or end with \"-\" and can't start with digit");
300300
}

0 commit comments

Comments
 (0)