DaanHoogland commented on a change in pull request #3976: Enable sending 
hypervior host name via metadata - VR and Config Drive
URL: https://github.com/apache/cloudstack/pull/3976#discussion_r399329465
 
 

 ##########
 File path: 
server/src/main/java/com/cloud/network/router/CommandSetupHelper.java
 ##########
 @@ -177,23 +180,30 @@
     private VlanDao _vlanDao;
     @Inject
     private IPAddressDao _ipAddressDao;
-
     @Inject
     private RouterControlHelper _routerControlHelper;
+    @Inject
+    private HostDao _hostDao;
 
     @Autowired
     @Qualifier("networkHelper")
     protected NetworkHelper _networkHelper;
 
     public void createVmDataCommand(final VirtualRouter router, final UserVm 
vm, final NicVO nic, final String publicKey, final Commands cmds) {
-        final String serviceOffering = 
_serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), 
vm.getServiceOfferingId()).getDisplayText();
-        final String zoneName = 
_dcDao.findById(router.getDataCenterId()).getName();
-        final IPAddressVO staticNatIp = 
_ipAddressDao.findByVmIdAndNetworkId(nic.getNetworkId(), vm.getId());
-        cmds.addCommand(
-                "vmdata",
-                generateVmDataCommand(router, nic.getIPv4Address(), 
vm.getUserData(), serviceOffering, zoneName,
-                        staticNatIp == null || staticNatIp.getState() != 
IpAddress.State.Allocated ? null : staticNatIp.getAddress().addr(), 
vm.getHostName(), vm.getInstanceName(),
-                        vm.getId(), vm.getUuid(), publicKey, 
nic.getNetworkId()));
+        if (vm != null && router != null && nic != null) {
 
 Review comment:
   so why wasn't this need before?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to