Skip to content

Commit bea778d

Browse files
committed
server,kvm: Calculate the device id of the config drive ISO
The config drive ISO is attached as a CD-ROM, but its device id was hardcoded to 4. The config drive ISO is now the CD-ROM following the ones of the ISOs, so its device id is the primary CD-ROM device id plus the number of the CD-ROMs of the ISOs (TemplateManager.getConfigDriveDeviceId). The number of the CD-ROMs of the ISOs is 1 as only one ISO can be attached to an Instance, so the device id of the config drive ISO is still 4. The number of CD-ROM devices of an Instance (TemplateManager.getVmCdromCount) includes the config drive ISO, so the device ids reserved for the volumes follow it, and the volume device id allocator does not need to know about the config drive any more. The KVM agent finds the config drive CD-ROM by the path of its ISO, and keeps its label and bus when refreshing it, instead of using the hardcoded id 4 and the label hdd (which does not match the SATA CD-ROMs of UEFI Instances).
1 parent 4eab500 commit bea778d

9 files changed

Lines changed: 249 additions & 113 deletions

File tree

‎engine/components-api/src/main/java/com/cloud/template/TemplateManager.java‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.cloud.storage.VMTemplateVO;
3838
import com.cloud.storage.VolumeVO;
3939
import com.cloud.utils.Pair;
40+
import com.cloud.vm.VirtualMachine;
4041
import com.cloud.vm.VirtualMachineProfile;
4142

4243
/**
@@ -70,6 +71,25 @@ public interface TemplateManager {
7071
// KVM/libvirt maps deviceSeq=3 to hdc (hda/hdb are taken by the root volume on i440fx/IDE).
7172
int CDROM_PRIMARY_DEVICE_SEQ = 3;
7273

74+
/**
75+
* Returns the number of CD-ROM devices of the Instance. The CD-ROM devices occupy the device ids starting from
76+
* {@link #CDROM_PRIMARY_DEVICE_SEQ}, which therefore cannot be used by the volumes of the Instance.
77+
*
78+
* @param vm the Instance
79+
* @return the number of CD-ROM devices, including the one of the config drive ISO if the Instance uses config drive
80+
*/
81+
int getVmCdromCount(VirtualMachine vm);
82+
83+
/**
84+
* Returns the device id of the config drive ISO of the Instance. The config drive ISO is attached as the CD-ROM
85+
* following the ones of the ISOs, so it is {@link #CDROM_PRIMARY_DEVICE_SEQ} plus the number of the CD-ROMs of the ISOs.
86+
*
87+
* @param vm the Instance
88+
* @param hostId the host the Instance is (to be) deployed on, not used as the number of CD-ROMs does not depend on it
89+
* @return the device id of the config drive ISO
90+
*/
91+
int getConfigDriveDeviceId(VirtualMachine vm, Long hostId);
92+
7393
/**
7494
* Prepares a template for vm creation for a certain storage pool.
7595
*

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
515515
protected List<String> localStoragePaths = new ArrayList<>();
516516
protected List<String> localStorageUUIDs = new ArrayList<>();
517517

518-
private static final String CONFIG_DRIVE_ISO_DISK_LABEL = "hdd";
519-
private static final int CONFIG_DRIVE_ISO_DEVICE_ID = 4;
520518

521519
protected File qemuSocketsPath;
522520
private final String qemuGuestAgentSocketName = "org.qemu.guest_agent.0";
@@ -3975,24 +3973,33 @@ protected KVMStoragePoolManager getPoolManager() {
39753973
return storagePoolManager;
39763974
}
39773975

3976+
/**
3977+
* Checks if the CD-ROM is the one of the config drive ISO of the VM. The device id (and so the label) of the config
3978+
* drive ISO depends on the number of the CD-ROMs of the VM, so it is found by the path of the ISO.
3979+
*/
3980+
protected boolean isConfigDriveCdrom(final DiskDef disk, final String vmName) {
3981+
return disk.getDeviceType() == DiskDef.DeviceType.CDROM && disk.getDiskPath() != null
3982+
&& disk.getDiskPath().endsWith("/" + ConfigDrive.createConfigDrivePath(vmName));
3983+
}
3984+
39783985
public void detachAndAttachConfigDriveISO(final Connect conn, final String vmName) {
39793986
// detach and re-attach configdrive ISO
39803987
List<DiskDef> disks = getDisks(conn, vmName);
39813988
DiskDef configdrive = null;
39823989
for (DiskDef disk : disks) {
3983-
if (disk.getDeviceType() == DiskDef.DeviceType.CDROM && CONFIG_DRIVE_ISO_DISK_LABEL.equals(disk.getDiskLabel())) {
3990+
if (isConfigDriveCdrom(disk, vmName)) {
39843991
configdrive = disk;
39853992
}
39863993
}
39873994
if (configdrive != null) {
39883995
try {
39893996
LOGGER.debug(String.format("Detaching ConfigDrive ISO of the VM %s, at path %s", vmName, configdrive.getDiskPath()));
3990-
String result = attachOrDetachISO(conn, vmName, configdrive.getDiskPath(), false, CONFIG_DRIVE_ISO_DEVICE_ID);
3997+
String result = attachOrDetachISO(conn, vmName, configdrive.getDiskPath(), false, null, configdrive);
39913998
if (result != null) {
39923999
LOGGER.warn("Detach ConfigDrive ISO of the VM {}, at path {} with result: {}", vmName, configdrive.getDiskPath(), result);
39934000
}
39944001
LOGGER.debug(String.format("Attaching ConfigDrive ISO of the VM %s, at path %s", vmName, configdrive.getDiskPath()));
3995-
result = attachOrDetachISO(conn, vmName, configdrive.getDiskPath(), true, CONFIG_DRIVE_ISO_DEVICE_ID);
4002+
result = attachOrDetachISO(conn, vmName, configdrive.getDiskPath(), true, null, configdrive);
39964003
if (result != null) {
39974004
LOGGER.warn("Attach ConfigDrive ISO of the VM {}, at path {} with result: {}", vmName, configdrive.getDiskPath(), result);
39984005
}
@@ -4005,6 +4012,15 @@ public void detachAndAttachConfigDriveISO(final Connect conn, final String vmNam
40054012

40064013
public synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq) throws LibvirtException, URISyntaxException,
40074014
InternalErrorException {
4015+
return attachOrDetachISO(conn, vmName, isoPath, isAttach, diskSeq, null);
4016+
}
4017+
4018+
/**
4019+
* Attaches or detaches (ejects) an ISO. If {@code cdrom} is specified, the ISO is attached to that CD-ROM device
4020+
* (the label and bus of the device are kept), instead of the one of the device id.
4021+
*/
4022+
private synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq, final DiskDef cdrom) throws LibvirtException, URISyntaxException,
4023+
InternalErrorException {
40084024
final DiskDef iso = new DiskDef();
40094025
if (isAttach && StringUtils.isNotBlank(isoPath)) {
40104026
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) || isoPath.contains(vmName)) {
@@ -4023,13 +4039,17 @@ public synchronized String attachOrDetachISO(final Connect conn, final String vm
40234039
} else {
40244040
iso.defISODisk(null, diskSeq, DiskDef.DiskType.FILE);
40254041
}
4042+
if (cdrom != null) {
4043+
iso.setDiskLabel(cdrom.getDiskLabel());
4044+
iso.setBusType(cdrom.getBusType());
4045+
}
40264046

40274047
final String result = attachOrDetachDevice(conn, true, vmName, iso.toString());
40284048
if (result == null && !isAttach) {
40294049
final List<DiskDef> disks = getDisks(conn, vmName);
40304050
for (final DiskDef disk : disks) {
40314051
if (disk.getDeviceType() == DiskDef.DeviceType.CDROM
4032-
&& (diskSeq == null || disk.getDiskLabel().equals(iso.getDiskLabel()))) {
4052+
&& ((diskSeq == null && cdrom == null) || disk.getDiskLabel().equals(iso.getDiskLabel()))) {
40334053
cleanupDisk(disk);
40344054
}
40354055
}

‎plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7206,4 +7206,36 @@ public void defineDiskForDefaultPoolTypeHandlesNullDetails() {
72067206
libvirtComputingResourceSpy.defineDiskForDefaultPoolType(diskDef, volume, false, false, false, physicalDisk, DEV_ID, DISK_BUS_TYPE, DISK_BUS_TYPE_DATA, null);
72077207
Mockito.verify(diskDef).defFileBasedDisk(PHYSICAL_DISK_PATH, DEV_ID, DISK_BUS_TYPE_DATA, DiskDef.DiskFmtType.QCOW2);
72087208
}
7209+
7210+
private DiskDef createCdromWithSource(String path, String label, DiskDef.DiskBus bus) {
7211+
DiskDef cdrom = new DiskDef();
7212+
cdrom.defISODisk(path, null, label, DiskDef.DiskType.FILE);
7213+
cdrom.setBusType(bus);
7214+
return cdrom;
7215+
}
7216+
7217+
@Test
7218+
public void isConfigDriveCdromTestFindsConfigDriveIsoWhateverTheDeviceLabel() {
7219+
String vmName = "i-2-3-VM";
7220+
// the config drive ISO is the CD-ROM following the ones of the ISOs, so its label depends on the number of the CD-ROMs
7221+
Assert.assertTrue(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource("/mnt/pool/configdrive/i-2-3-VM.iso", "hdd", DiskDef.DiskBus.IDE), vmName));
7222+
Assert.assertTrue(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource("/mnt/pool/configdrive/i-2-3-VM.iso", "sde", DiskDef.DiskBus.SATA), vmName));
7223+
Assert.assertTrue(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource("/var/cache/cloud/configdrive/i-2-3-VM.iso", "sdf", DiskDef.DiskBus.SATA), vmName));
7224+
}
7225+
7226+
@Test
7227+
public void isConfigDriveCdromTestIgnoresOtherCdroms() {
7228+
String vmName = "i-2-3-VM";
7229+
Assert.assertFalse(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource("/mnt/pool/some-ubuntu.iso", "hdc", DiskDef.DiskBus.IDE), vmName));
7230+
Assert.assertFalse(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource("/mnt/pool/configdrive/i-2-30-VM.iso", "hdd", DiskDef.DiskBus.IDE), vmName));
7231+
Assert.assertFalse(libvirtComputingResourceSpy.isConfigDriveCdrom(createCdromWithSource(null, "hdc", DiskDef.DiskBus.IDE), vmName));
7232+
}
7233+
7234+
@Test
7235+
public void isConfigDriveCdromTestIgnoresDisks() {
7236+
DiskDef disk = new DiskDef();
7237+
disk.defFileBasedDisk("/mnt/pool/configdrive/i-2-3-VM.iso", 1, DiskDef.DiskBus.VIRTIO, DiskDef.DiskFmtType.RAW);
7238+
7239+
Assert.assertFalse(libvirtComputingResourceSpy.isConfigDriveCdrom(disk, "i-2-3-VM"));
7240+
}
72097241
}

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import com.cloud.storage.dao.GuestOSCategoryDao;
7474
import com.cloud.storage.dao.GuestOSDao;
7575
import com.cloud.storage.dao.VolumeDao;
76+
import com.cloud.template.TemplateManager;
7677
import com.cloud.utils.Pair;
7778
import com.cloud.utils.StringUtils;
7879
import com.cloud.utils.component.AdapterBase;
@@ -114,6 +115,8 @@ public class ConfigDriveNetworkElement extends AdapterBase implements NetworkEle
114115
@Inject
115116
NetworkModel _networkModel;
116117
@Inject
118+
TemplateManager _templateMgr;
119+
@Inject
117120
NetworkOrchestrationService _networkOrchestrationService;
118121
@Inject
119122
GuestOSCategoryDao _guestOSCategoryDao;
@@ -142,7 +145,9 @@ public class ConfigDriveNetworkElement extends AdapterBase implements NetworkEle
142145
@Inject
143146
private HypervisorGuruManager _hvGuruMgr;
144147

145-
public static final Integer CONFIGDRIVEDISKSEQ = 4;
148+
// Device id of the config drive ISO when the Instance has a single ISO CD-ROM (the config drive ISO is the CD-ROM
149+
// following the ones of the ISOs, see TemplateManager#getConfigDriveDeviceId). Used where the Instance is not known.
150+
public static final Integer CONFIGDRIVEDISKSEQ = TemplateManager.CDROM_PRIMARY_DEVICE_SEQ + 1;
146151

147152
private boolean canHandle(TrafficType trafficType) {
148153
return trafficType.equals(TrafficType.Guest);
@@ -591,7 +596,7 @@ private boolean createConfigDriveIsoOnHostCache(NicProfile nic, VirtualMachinePr
591596

592597
profile.setConfigDriveLocation(answer.getConfigDriveLocation());
593598
updateConfigDriveLocationInVMDetails(profile.getId(), answer.getConfigDriveLocation());
594-
addConfigDriveDisk(profile, null);
599+
addConfigDriveDisk(profile, null, host.getId());
595600
return true;
596601
}
597602

@@ -676,7 +681,7 @@ public boolean createConfigDriveIso(NicProfile nic, VirtualMachineProfile profil
676681
}
677682
profile.setConfigDriveLocation(answer.getConfigDriveLocation());
678683
updateConfigDriveLocationInVMDetails(profile.getId(), answer.getConfigDriveLocation());
679-
addConfigDriveDisk(profile, dataStore);
684+
addConfigDriveDisk(profile, dataStore, dest != null && dest.getHost() != null ? dest.getHost().getId() : null);
680685
return true;
681686
}
682687

@@ -776,7 +781,7 @@ private boolean deleteConfigDriveIso(final VirtualMachine vm) throws ResourceUna
776781
return true;
777782
}
778783

779-
private void addConfigDriveDisk(final VirtualMachineProfile profile, final DataStore dataStore) throws ResourceUnavailableException {
784+
private void addConfigDriveDisk(final VirtualMachineProfile profile, final DataStore dataStore, final Long hostId) throws ResourceUnavailableException {
780785
boolean isoAvailable = false;
781786
final String isoPath = ConfigDrive.createConfigDrivePath(profile.getInstanceName());
782787
for (DiskTO dataTo : profile.getDisks()) {
@@ -798,7 +803,7 @@ private void addConfigDriveDisk(final VirtualMachineProfile profile, final DataS
798803
dataTO.setPath(isoPath);
799804
dataTO.setFormat(Storage.ImageFormat.ISO);
800805

801-
profile.addDisk(new DiskTO(dataTO, CONFIGDRIVEDISKSEQ.longValue(), isoPath, Volume.Type.ISO));
806+
profile.addDisk(new DiskTO(dataTO, (long) _templateMgr.getConfigDriveDeviceId(profile.getVirtualMachine(), hostId), isoPath, Volume.Type.ISO));
802807
} else {
803808
logger.warn("Config drive ISO already is in Instance profile.");
804809
}

‎server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java‎

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@
160160
import com.cloud.hypervisor.Hypervisor.HypervisorType;
161161
import com.cloud.hypervisor.HypervisorCapabilitiesVO;
162162
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
163-
import com.cloud.network.Network.Provider;
164-
import com.cloud.network.Network.Service;
165-
import com.cloud.network.NetworkModel;
166-
import com.cloud.network.element.ConfigDriveNetworkElement;
167163
import com.cloud.offering.DiskOffering;
168164
import com.cloud.org.Cluster;
169165
import com.cloud.org.Grouping;
@@ -223,7 +219,6 @@
223219
import com.cloud.utils.fsm.NoTransitionException;
224220
import com.cloud.utils.fsm.StateMachine2;
225221
import com.cloud.vm.DiskProfile;
226-
import com.cloud.vm.NicVO;
227222
import com.cloud.vm.VMInstanceDetailVO;
228223
import com.cloud.vm.UserVmManager;
229224
import com.cloud.vm.UserVmService;
@@ -245,7 +240,6 @@
245240
import com.cloud.vm.VmWorkResizeVolume;
246241
import com.cloud.vm.VmWorkSerializer;
247242
import com.cloud.vm.VmWorkTakeVolumeSnapshot;
248-
import com.cloud.vm.dao.NicDao;
249243
import com.cloud.vm.dao.UserVmDao;
250244
import com.cloud.vm.dao.VMInstanceDetailsDao;
251245
import com.cloud.vm.dao.VMInstanceDao;
@@ -299,10 +293,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
299293
@Inject
300294
private VMInstanceDetailsDao vmInstanceDetailsDao;
301295
@Inject
302-
private NicDao _nicDao;
303-
@Inject
304-
private NetworkModel _networkModel;
305-
@Inject
306296
private UserVmService _userVmService;
307297
@Inject
308298
private VolumeDataStoreDao _volumeStoreDao;
@@ -5048,31 +5038,11 @@ protected String getMinimumHypervisorVersionInDatacenter(long datacenterId, Hype
50485038
}
50495039

50505040
/**
5051-
* The number of CD-ROM devices of the Instance. Each CD-ROM device occupies a device id, starting from
5052-
* {@link TemplateManager#CDROM_PRIMARY_DEVICE_SEQ}.
5041+
* The number of CD-ROM devices of the Instance (including the one of the config drive ISO, if any). Each CD-ROM
5042+
* device occupies a device id, starting from {@link TemplateManager#CDROM_PRIMARY_DEVICE_SEQ}.
50535043
*/
50545044
protected int getVmCdromCount(VirtualMachine vm) {
5055-
return 1;
5056-
}
5057-
5058-
/**
5059-
* Checks if a config drive ISO is (or will be) attached to the Instance, which is the case when any of its networks
5060-
* has ConfigDrive as the provider of the Dhcp, Dns or UserData service. Checking the network providers (instead of
5061-
* only the config drive location detail, which is added when the ISO is created) also covers Instances which have
5062-
* never been started.
5063-
*/
5064-
protected boolean isConfigDriveUsed(VirtualMachine vm) {
5065-
if (vmInstanceDetailsDao.findDetail(vm.getId(), VmDetailConstants.CONFIG_DRIVE_LOCATION) != null) {
5066-
return true;
5067-
}
5068-
for (NicVO nic : _nicDao.listByVmId(vm.getId())) {
5069-
for (Service service : Arrays.asList(Service.UserData, Service.Dhcp, Service.Dns)) {
5070-
if (_networkModel.isProviderSupportServiceInNetwork(nic.getNetworkId(), service, Provider.ConfigDrive)) {
5071-
return true;
5072-
}
5073-
}
5074-
}
5075-
return false;
5045+
return _tmpltMgr.getVmCdromCount(vm);
50765046
}
50775047

50785048
@Override
@@ -5081,9 +5051,6 @@ public Set<Long> getReservedDeviceIds(VirtualMachine vm) {
50815051
for (int i = 0; i < getVmCdromCount(vm); i++) {
50825052
reservedDeviceIds.add((long) TemplateManager.CDROM_PRIMARY_DEVICE_SEQ + i);
50835053
}
5084-
if (isConfigDriveUsed(vm)) {
5085-
reservedDeviceIds.add(ConfigDriveNetworkElement.CONFIGDRIVEDISKSEQ.longValue());
5086-
}
50875054
return reservedDeviceIds;
50885055
}
50895056

‎server/src/main/java/com/cloud/template/TemplateManagerImpl.java‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
import com.cloud.hypervisor.Hypervisor.HypervisorType;
152152
import com.cloud.hypervisor.HypervisorGuru;
153153
import com.cloud.hypervisor.HypervisorGuruManager;
154+
import com.cloud.network.Network.Provider;
155+
import com.cloud.network.Network.Service;
156+
import com.cloud.network.NetworkModel;
154157
import com.cloud.projects.Project;
155158
import com.cloud.projects.ProjectManager;
156159
import com.cloud.resourcelimit.CheckedReservation;
@@ -215,6 +218,7 @@
215218
import com.cloud.utils.db.TransactionCallbackNoReturn;
216219
import com.cloud.utils.db.TransactionStatus;
217220
import com.cloud.utils.exception.CloudRuntimeException;
221+
import com.cloud.vm.NicVO;
218222
import com.cloud.vm.UserVmManager;
219223
import com.cloud.vm.UserVmVO;
220224
import com.cloud.vm.VMInstanceVO;
@@ -223,8 +227,10 @@
223227
import com.cloud.vm.VirtualMachineProfile;
224228
import com.cloud.vm.VirtualMachineProfileImpl;
225229
import com.cloud.vm.VmDetailConstants;
230+
import com.cloud.vm.dao.NicDao;
226231
import com.cloud.vm.dao.UserVmDao;
227232
import com.cloud.vm.dao.VMInstanceDao;
233+
import com.cloud.vm.dao.VMInstanceDetailsDao;
228234
import com.google.gson.Gson;
229235
import com.google.gson.GsonBuilder;
230236

@@ -257,6 +263,12 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
257263
@Inject
258264
private UserVmDao _userVmDao;
259265
@Inject
266+
private NicDao _nicDao;
267+
@Inject
268+
private NetworkModel _networkModel;
269+
@Inject
270+
private VMInstanceDetailsDao _vmInstanceDetailsDao;
271+
@Inject
260272
private VolumeDao _volumeDao;
261273
@Inject
262274
private SnapshotDao _snapshotDao;
@@ -686,6 +698,49 @@ private String extract(Account caller, Long templateId, String url, Long zoneId,
686698
return extractUrl;
687699
}
688700

701+
/**
702+
* The number of CD-ROM devices of the Instance which are used for ISOs.
703+
*/
704+
private int getIsoCdromCount(VirtualMachine vm) {
705+
return 1;
706+
}
707+
708+
@Override
709+
public int getVmCdromCount(VirtualMachine vm) {
710+
// the config drive ISO is attached as the CD-ROM following the ones of the ISOs
711+
return getIsoCdromCount(vm) + (isConfigDriveUsed(vm) ? 1 : 0);
712+
}
713+
714+
@Override
715+
public int getConfigDriveDeviceId(VirtualMachine vm, Long hostId) {
716+
// the config drive ISO is attached as the CD-ROM following the ones of the ISOs
717+
return CDROM_PRIMARY_DEVICE_SEQ + getIsoCdromCount(vm);
718+
}
719+
720+
/**
721+
* Checks if a config drive ISO is (or will be) attached to the Instance, which is the case when any of its networks
722+
* has ConfigDrive as the provider of the Dhcp, Dns or UserData service. Checking the network providers (instead of
723+
* only the config drive location detail, which is added when the ISO is created) also covers Instances which have
724+
* never been started.
725+
*/
726+
boolean isConfigDriveUsed(VirtualMachine vm) {
727+
if (_vmInstanceDetailsDao.findDetail(vm.getId(), VmDetailConstants.CONFIG_DRIVE_LOCATION) != null) {
728+
return true;
729+
}
730+
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
731+
if (CollectionUtils.isEmpty(nics)) {
732+
return false;
733+
}
734+
for (NicVO nic : nics) {
735+
for (Service service : Arrays.asList(Service.UserData, Service.Dhcp, Service.Dns)) {
736+
if (_networkModel.isProviderSupportServiceInNetwork(nic.getNetworkId(), service, Provider.ConfigDrive)) {
737+
return true;
738+
}
739+
}
740+
}
741+
return false;
742+
}
743+
689744
@Override
690745
public void prepareIsoForVmProfile(VirtualMachineProfile profile, DeployDestination dest) {
691746
UserVmVO vm = _userVmDao.findById(profile.getId());

0 commit comments

Comments
 (0)