Skip to content

Commit 95b4817

Browse files
system vms doesn't require config drive data configuration
1 parent 41a2743 commit 95b4817

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineP
341341
try {
342342
if (isConfigDriveIsoOnHostCache(vm.getId())) {
343343
vm.setConfigDriveLocation(Location.HOST);
344-
configureConfigDriveData(vm, nic, dest);
345-
346-
// Create the config drive on dest host cache
347-
createConfigDriveIsoOnHostCache(vm, dest.getHost().getId());
344+
if (configureConfigDriveData(vm, nic, dest)) {
345+
// Create the config drive on dest host cache
346+
createConfigDriveIsoOnHostCache(vm, dest.getHost().getId());
347+
}
348348
} else {
349349
vm.setConfigDriveLocation(getConfigDriveLocation(vm.getId()));
350350
addPasswordAndUserdata(network, nic, vm, dest, context);
@@ -760,7 +760,7 @@ private void addConfigDriveDisk(final VirtualMachineProfile profile, final DataS
760760

761761
private boolean configureConfigDriveData(final VirtualMachineProfile profile, final NicProfile nic, final DeployDestination dest) {
762762
final UserVmVO vm = _userVmDao.findById(profile.getId());
763-
if (vm.getType() != VirtualMachine.Type.User) {
763+
if (vm == null || vm.getType() != VirtualMachine.Type.User) {
764764
return false;
765765
}
766766
final Nic defaultNic = _networkModel.getDefaultNic(vm.getId());

0 commit comments

Comments
 (0)