mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/4.17'
This commit is contained in:
		
						commit
						691fd469ea
					
				@ -210,6 +210,14 @@ public class NicResponse extends BaseResponse {
 | 
				
			|||||||
        this.extraDhcpOptions = extraDhcpOptions;
 | 
					        this.extraDhcpOptions = extraDhcpOptions;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @SerializedName(ApiConstants.VPC_ID)
 | 
				
			||||||
 | 
					    @Param(description = "Id of the vpc to which the nic belongs")
 | 
				
			||||||
 | 
					    private String vpcId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @SerializedName(ApiConstants.VPC_NAME)
 | 
				
			||||||
 | 
					    @Param(description = "name of the vpc to which the nic belongs")
 | 
				
			||||||
 | 
					    private String vpcName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public int hashCode() {
 | 
					    public int hashCode() {
 | 
				
			||||||
        final int prime = 31;
 | 
					        final int prime = 31;
 | 
				
			||||||
@ -364,4 +372,20 @@ public class NicResponse extends BaseResponse {
 | 
				
			|||||||
    public void setIpAddresses(List<String> ipAddresses) {
 | 
					    public void setIpAddresses(List<String> ipAddresses) {
 | 
				
			||||||
        this.ipAddresses = ipAddresses;
 | 
					        this.ipAddresses = ipAddresses;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getVpcId() {
 | 
				
			||||||
 | 
					        return vpcId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setVpcId(String vpcId) {
 | 
				
			||||||
 | 
					        this.vpcId = vpcId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getVpcName() {
 | 
				
			||||||
 | 
					        return vpcName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setVpcName(String vpcName) {
 | 
				
			||||||
 | 
					        this.vpcName = vpcName;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -37,6 +37,8 @@ import java.util.stream.Collectors;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.inject.Inject;
 | 
					import javax.inject.Inject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.cloud.api.query.dao.UserVmJoinDao;
 | 
				
			||||||
 | 
					import com.cloud.network.vpc.VpcVO;
 | 
				
			||||||
import org.apache.cloudstack.acl.ControlledEntity;
 | 
					import org.apache.cloudstack.acl.ControlledEntity;
 | 
				
			||||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 | 
					import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 | 
				
			||||||
import org.apache.cloudstack.affinity.AffinityGroup;
 | 
					import org.apache.cloudstack.affinity.AffinityGroup;
 | 
				
			||||||
@ -442,6 +444,8 @@ public class ApiResponseHelper implements ResponseGenerator {
 | 
				
			|||||||
    NetworkOfferingDao networkOfferingDao;
 | 
					    NetworkOfferingDao networkOfferingDao;
 | 
				
			||||||
    @Inject
 | 
					    @Inject
 | 
				
			||||||
    Ipv6Service ipv6Service;
 | 
					    Ipv6Service ipv6Service;
 | 
				
			||||||
 | 
					    @Inject
 | 
				
			||||||
 | 
					    UserVmJoinDao userVmJoinDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public UserResponse createUserResponse(User user) {
 | 
					    public UserResponse createUserResponse(User user) {
 | 
				
			||||||
@ -4318,6 +4322,13 @@ public class ApiResponseHelper implements ResponseGenerator {
 | 
				
			|||||||
                response.setNsxLogicalSwitchPort(((NicVO)result).getNsxLogicalSwitchPortUuid());
 | 
					                response.setNsxLogicalSwitchPort(((NicVO)result).getNsxLogicalSwitchPortUuid());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        UserVmJoinVO userVm =  userVmJoinDao.findById(vm.getId());
 | 
				
			||||||
 | 
					        if (userVm != null && userVm.getVpcUuid() != null) {
 | 
				
			||||||
 | 
					            response.setVpcId(userVm.getVpcUuid());
 | 
				
			||||||
 | 
					            VpcVO vpc = _entityMgr.findByUuidIncludingRemoved(VpcVO.class, userVm.getVpcUuid());
 | 
				
			||||||
 | 
					            response.setVpcName(vpc.getName());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return response;
 | 
					        return response;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -28,6 +28,8 @@ import java.util.stream.Collectors;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.inject.Inject;
 | 
					import javax.inject.Inject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.cloud.network.vpc.VpcVO;
 | 
				
			||||||
 | 
					import com.cloud.network.vpc.dao.VpcDao;
 | 
				
			||||||
import com.cloud.storage.DiskOfferingVO;
 | 
					import com.cloud.storage.DiskOfferingVO;
 | 
				
			||||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
 | 
					import org.apache.cloudstack.affinity.AffinityGroupResponse;
 | 
				
			||||||
import org.apache.cloudstack.annotation.AnnotationService;
 | 
					import org.apache.cloudstack.annotation.AnnotationService;
 | 
				
			||||||
@ -88,6 +90,8 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
 | 
				
			|||||||
    @Inject
 | 
					    @Inject
 | 
				
			||||||
    private AnnotationDao annotationDao;
 | 
					    private AnnotationDao annotationDao;
 | 
				
			||||||
    @Inject
 | 
					    @Inject
 | 
				
			||||||
 | 
					    private VpcDao vpcDao;
 | 
				
			||||||
 | 
					    @Inject
 | 
				
			||||||
    UserStatisticsDao userStatsDao;
 | 
					    UserStatisticsDao userStatsDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
 | 
					    private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
 | 
				
			||||||
@ -291,6 +295,12 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
 | 
				
			|||||||
                if (userVm.getGuestType() != null) {
 | 
					                if (userVm.getGuestType() != null) {
 | 
				
			||||||
                    nicResponse.setType(userVm.getGuestType().toString());
 | 
					                    nicResponse.setType(userVm.getGuestType().toString());
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (userVm.getVpcUuid() != null) {
 | 
				
			||||||
 | 
					                    nicResponse.setVpcId(userVm.getVpcUuid());
 | 
				
			||||||
 | 
					                    VpcVO vpc = vpcDao.findByUuidIncludingRemoved(userVm.getVpcUuid());
 | 
				
			||||||
 | 
					                    nicResponse.setVpcName(vpc.getName());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                nicResponse.setIsDefault(userVm.isDefaultNic());
 | 
					                nicResponse.setIsDefault(userVm.isDefaultNic());
 | 
				
			||||||
                nicResponse.setDeviceId(String.valueOf(userVm.getNicDeviceId()));
 | 
					                nicResponse.setDeviceId(String.valueOf(userVm.getNicDeviceId()));
 | 
				
			||||||
                List<NicSecondaryIpVO> secondaryIps = ApiDBUtils.findNicSecondaryIps(userVm.getNicId());
 | 
					                List<NicSecondaryIpVO> secondaryIps = ApiDBUtils.findNicSecondaryIps(userVm.getNicId());
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@ from nose.plugins.attrib import attr
 | 
				
			|||||||
from component.test_vpc_vm_life_cycle import Services
 | 
					from component.test_vpc_vm_life_cycle import Services
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
 | 
					class TestVMLifeCycleSharedNwVPC(cloudstackTesTODOtCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def setUpClass(cls):
 | 
					    def setUpClass(cls):
 | 
				
			||||||
 | 
				
			|||||||
@ -17,19 +17,22 @@
 | 
				
			|||||||
""" BVT tests for Hosts Maintenance
 | 
					""" BVT tests for Hosts Maintenance
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Import Local Modules
 | 
				
			||||||
 | 
					from marvin.codes import FAILED
 | 
				
			||||||
from marvin.cloudstackTestCase import *
 | 
					from marvin.cloudstackTestCase import *
 | 
				
			||||||
 | 
					from marvin.cloudstackAPI import *
 | 
				
			||||||
from marvin.lib.utils import *
 | 
					from marvin.lib.utils import *
 | 
				
			||||||
from marvin.lib.base import *
 | 
					from marvin.lib.base import *
 | 
				
			||||||
from marvin.lib.common import *
 | 
					from marvin.lib.common import *
 | 
				
			||||||
from nose.plugins.attrib import attr
 | 
					from nose.plugins.attrib import attr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from time import sleep
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_multiprocess_shared_ = False
 | 
					_multiprocess_shared_ = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestHostHA(cloudstackTestCase):
 | 
					class TestHostHA(cloudstackTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hostCountMsg = "Host HA can be tested with at least two hosts, only %s found"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def setUp(self):
 | 
					    def setUp(self):
 | 
				
			||||||
        self.logger = logging.getLogger('TestHM')
 | 
					        self.logger = logging.getLogger('TestHM')
 | 
				
			||||||
        self.stream_handler = logging.StreamHandler()
 | 
					        self.stream_handler = logging.StreamHandler()
 | 
				
			||||||
@ -83,8 +86,17 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
                         "timeout": 10,
 | 
					                         "timeout": 10,
 | 
				
			||||||
                         }
 | 
					                         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def tearDown(self):
 | 
					    def tearDown(self):
 | 
				
			||||||
        super(TestHostHA, self).tearDown()
 | 
					        try:
 | 
				
			||||||
 | 
					            # Clean up, terminate the created templates
 | 
				
			||||||
 | 
					            cleanup_resources(self.apiclient, self.cleanup)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        except Exception as e:
 | 
				
			||||||
 | 
					            raise Exception("Warning: Exception during cleanup : %s" % e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def createVMs(self, hostId, number, local):
 | 
					    def createVMs(self, hostId, number, local):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -307,9 +319,11 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
        for host in listHost:
 | 
					        for host in listHost:
 | 
				
			||||||
            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
					            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(listHost) < 2:
 | 
					
 | 
				
			||||||
            self.logger.debug(self.hostCountMsg % len(listHost))
 | 
					        if len(listHost) != 2:
 | 
				
			||||||
            raise unittest.SkipTest(self.hostCountMsg % len(listHost))
 | 
					            self.logger.debug("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					            raise unittest.SkipTest("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
					        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -317,6 +331,7 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.logger.debug("Number of VMS on hosts = %s" % no_of_vms)
 | 
					        self.logger.debug("Number of VMS on hosts = %s" % no_of_vms)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if no_of_vms < 5:
 | 
					        if no_of_vms < 5:
 | 
				
			||||||
            self.logger.debug("test_01: Create VMs as there are not enough vms to check host ha")
 | 
					            self.logger.debug("test_01: Create VMs as there are not enough vms to check host ha")
 | 
				
			||||||
            no_vm_req = 5 - no_of_vms
 | 
					            no_vm_req = 5 - no_of_vms
 | 
				
			||||||
@ -381,9 +396,10 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
        for host in listHost:
 | 
					        for host in listHost:
 | 
				
			||||||
            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
					            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(listHost) < 2:
 | 
					
 | 
				
			||||||
            self.logger.debug(self.hostCountMsg % len(listHost))
 | 
					        if len(listHost) != 2:
 | 
				
			||||||
            raise unittest.SkipTest(self.hostCountMsg % len(listHost))
 | 
					            self.logger.debug("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					            raise unittest.SkipTest("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
					        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -457,9 +473,10 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
        for host in listHost:
 | 
					        for host in listHost:
 | 
				
			||||||
            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
					            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(listHost) < 2:
 | 
					
 | 
				
			||||||
            self.logger.debug(self.hostCountMsg % len(listHost))
 | 
					        if len(listHost) != 2:
 | 
				
			||||||
            raise unittest.SkipTest(self.hostCountMsg % len(listHost))
 | 
					            self.logger.debug("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					            raise unittest.SkipTest("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
					        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -531,9 +548,10 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
        for host in listHost:
 | 
					        for host in listHost:
 | 
				
			||||||
            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
					            self.logger.debug('Hypervisor = {}'.format(host.id))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if len(listHost) < 2:
 | 
					
 | 
				
			||||||
            self.logger.debug(self.hostCountMsg % len(listHost))
 | 
					        if len(listHost) != 2:
 | 
				
			||||||
            raise unittest.SkipTest(self.hostCountMsg % len(listHost))
 | 
					            self.logger.debug("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					            raise unittest.SkipTest("Host HA can be tested with two host only %s, found" % len(listHost))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
					        no_of_vms = self.noOfVMsOnHost(listHost[0].id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -541,6 +559,7 @@ class TestHostHA(cloudstackTestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.logger.debug("Number of VMS on hosts = %s" % no_of_vms)
 | 
					        self.logger.debug("Number of VMS on hosts = %s" % no_of_vms)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if no_of_vms < 5:
 | 
					        if no_of_vms < 5:
 | 
				
			||||||
            self.logger.debug("test_01: Create VMs as there are not enough vms to check host ha")
 | 
					            self.logger.debug("test_01: Create VMs as there are not enough vms to check host ha")
 | 
				
			||||||
            no_vm_req = 5 - no_of_vms
 | 
					            no_vm_req = 5 - no_of_vms
 | 
				
			||||||
 | 
				
			|||||||
@ -773,7 +773,7 @@ class TestResizeVolume(cloudstackTestCase):
 | 
				
			|||||||
        return
 | 
					        return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @attr(tags=["advanced"], required_hardware="true")
 | 
					    @attr(tags=["advanced"], required_hardware="true")
 | 
				
			||||||
    def test_05_vmdeployment_with_size(self):
 | 
					    def test_5_vmdeployment_with_size(self):
 | 
				
			||||||
        """Test vm deployment with new rootdisk size parameter
 | 
					        """Test vm deployment with new rootdisk size parameter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Validate the following
 | 
					        # Validate the following
 | 
				
			||||||
@ -855,7 +855,7 @@ class TestResizeVolume(cloudstackTestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @attr(tags=["advanced"], required_hardware="true")
 | 
					    @attr(tags=["advanced"], required_hardware="true")
 | 
				
			||||||
    def test_06_resized_rootvolume_with_lessvalue(self):
 | 
					    def test_6_resized_rootvolume_with_lessvalue(self):
 | 
				
			||||||
        """Test resize root volume with less than original volume size
 | 
					        """Test resize root volume with less than original volume size
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Validate the following
 | 
					        # Validate the following
 | 
				
			||||||
@ -939,7 +939,7 @@ class TestResizeVolume(cloudstackTestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # @attr(tags=["advanced"], required_hrdware="true")
 | 
					    # @attr(tags=["advanced"], required_hrdware="true")
 | 
				
			||||||
    @attr(tags=["TODO"], required_hrdware="true")
 | 
					    @attr(tags=["TODO"], required_hrdware="true")
 | 
				
			||||||
    def test_07_usage_events_after_rootvolume_resized_(self):
 | 
					    def test_7_usage_events_after_rootvolume_resized_(self):
 | 
				
			||||||
        """Test check usage events after root volume resize
 | 
					        """Test check usage events after root volume resize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Validate the following
 | 
					        # Validate the following
 | 
				
			||||||
 | 
				
			|||||||
@ -58,7 +58,8 @@ const user = {
 | 
				
			|||||||
    darkMode: false,
 | 
					    darkMode: false,
 | 
				
			||||||
    defaultListViewPageSize: 20,
 | 
					    defaultListViewPageSize: 20,
 | 
				
			||||||
    countNotify: 0,
 | 
					    countNotify: 0,
 | 
				
			||||||
    logoutFlag: false
 | 
					    logoutFlag: false,
 | 
				
			||||||
 | 
					    customColumns: {}
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mutations: {
 | 
					  mutations: {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user