mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
From: Vijayendra <vijayendra.bhamidipati@citrix.com> Date: Mon, 25 Feb 2013 14:37:27 -0800 Subject: [PATCH] CS-670: Configurable setting to use linked clones or not on VMware Description: Providing support for creation of user VMs as full clones on ESX. Putting in unit tests for VO and Dao classes introduced in this commit. Signed-off-by: Vijayendra <vijayendra.bhamidipati@citrix.com> --- core/src/com/cloud/vm/UserVmCloneSettingVO.java | 50 ++++++ .../hypervisor/vmware/manager/VmwareManager.java | 3 + .../vmware/manager/VmwareManagerImpl.java | 18 +- .../hypervisor/vmware/resource/VmwareResource.java | 117 +++++++++---- server/conf/migration-components.xml | 1 + server/src/com/cloud/configuration/Config.java | 1 + server/src/com/cloud/vm/UserVmManagerImpl.java | 184 ++++++++++----------- .../com/cloud/vm/dao/UserVmCloneSettingDao.java | 37 +++++ .../cloud/vm/dao/UserVmCloneSettingDaoImpl.java | 74 +++++++++ .../vm/dao/UserVmCloneSettingDaoImplTest.java | 62 +++++++ .../UserVmCloneSettingDaoTestConfiguration.java | 52 ++++++ .../test/resources/CloneSettingDaoTestContext.xml | 42 +++++ setup/db/db/schema-410to420.sql | 9 + 13 files changed, 527 insertions(+), 123 deletions(-) create mode 100755 core/src/com/cloud/vm/UserVmCloneSettingVO.java create mode 100755 server/src/com/cloud/vm/dao/UserVmCloneSettingDao.java create mode 100755 server/src/com/cloud/vm/dao/UserVmCloneSettingDaoImpl.java create mode 100644 server/test/com/cloud/vm/dao/UserVmCloneSettingDaoImplTest.java create mode 100644 server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java create mode 100644 server/test/resources/CloneSettingDaoTestContext.xml
53 lines
2.1 KiB
Java
53 lines
2.1 KiB
Java
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
package com.cloud.storage.dao;
|
|
|
|
import java.io.IOException;
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.context.annotation.ComponentScan.Filter;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.FilterType;
|
|
import org.springframework.core.type.classreading.MetadataReader;
|
|
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
|
import org.springframework.core.type.filter.TypeFilter;
|
|
|
|
import com.cloud.utils.component.SpringComponentScanUtils;
|
|
import com.cloud.vm.dao.UserVmCloneSettingDaoImpl;
|
|
|
|
@Configuration
|
|
@ComponentScan(basePackageClasses={
|
|
UserVmCloneSettingDaoImpl.class},
|
|
includeFilters={@Filter(value=UserVmCloneSettingDaoTestConfiguration.Library.class, type=FilterType.CUSTOM)},
|
|
useDefaultFilters=false
|
|
)
|
|
public class UserVmCloneSettingDaoTestConfiguration {
|
|
|
|
|
|
public static class Library implements TypeFilter {
|
|
|
|
@Override
|
|
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
|
|
mdr.getClassMetadata().getClassName();
|
|
ComponentScan cs = UserVmCloneSettingDaoTestConfiguration.class.getAnnotation(ComponentScan.class);
|
|
return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
|
|
}
|
|
|
|
}
|
|
}
|