From c6110a88c53fcaae258377dc3bf8ce7505d5dc37 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Mon, 7 Jan 2013 22:02:28 -0500 Subject: [PATCH 01/19] Updating copyright year in the LICENSE file to 2013 Signed-off-by: Chip Childers --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index afb662a77e2..714f6847ae8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012 The Apache Software Foundation +Copyright (c) 2013 The Apache Software Foundation Apache License From db2033d2e683ea5a2a398291cf2d7728a5be27b0 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 8 Jan 2013 11:27:12 -0800 Subject: [PATCH 02/19] List view UI: Disable overflow scrolling --- ui/css/cloudstack3.css | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index e1c9c86a04f..58563a6711a 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -452,11 +452,6 @@ div.list-view table tbody td span { white-space: nowrap; } -div.list-view table tbody td span:hover { - overflow: auto; - margin-top: 4px; -} - div.list-view div.toolbar div.section-switcher div.section-select label { margin: 0 9px 0 0; } From 74c15a22a05023d639dc24329f1ea4c4a6c8932f Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 8 Jan 2013 12:33:18 -0800 Subject: [PATCH 03/19] Create DB view for ListStoragePools API performance optimization. Signed-off-by: Min Chen --- .../com/cloud/server/ManagementService.java | 8 - .../admin/storage/ListStoragePoolsCmd.java | 12 +- .../apache/cloudstack/query/QueryService.java | 4 + server/src/com/cloud/api/ApiDBUtils.java | 19 + .../src/com/cloud/api/ApiResponseHelper.java | 46 +-- server/src/com/cloud/api/ApiServer.java | 2 + .../com/cloud/api/query/QueryManagerImpl.java | 100 +++++ .../cloud/api/query/ViewResponseHelper.java | 21 ++ .../api/query/dao/StoragePoolJoinDao.java | 37 ++ .../api/query/dao/StoragePoolJoinDaoImpl.java | 185 ++++++++++ .../com/cloud/api/query/vo/BaseViewVO.java | 2 - .../cloud/api/query/vo/StoragePoolJoinVO.java | 341 ++++++++++++++++++ .../DefaultComponentLibrary.java | 2 + .../cloud/server/ManagementServerImpl.java | 17 - server/test/com/cloud/api/ListPerfTest.java | 17 + setup/db/create-schema-view.sql | 37 ++ setup/db/db/schema-40to410.sql | 40 ++ 17 files changed, 812 insertions(+), 78 deletions(-) create mode 100644 server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java create mode 100644 server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java create mode 100644 server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java index e547954fff3..fb8af1a5b4b 100755 --- a/api/src/com/cloud/server/ManagementService.java +++ b/api/src/com/cloud/server/ManagementService.java @@ -243,14 +243,6 @@ public interface ManagementService { */ List searchForDiskOfferings(ListDiskOfferingsCmd cmd); - /** - * List storage pools that match the given criteria - * - * @param cmd - * the command that wraps the search criteria (zone, pod, name, IP address, path, and cluster id) - * @return a list of storage pools that match the given criteria - */ - Pair, Integer> searchForStoragePools(ListStoragePoolsCmd cmd); /** * List system VMs by the given search criteria diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java index 3723f8b3996..9c5c584b7cb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.async.AsyncJob; import com.cloud.storage.StoragePool; @@ -116,16 +117,7 @@ public class ListStoragePoolsCmd extends BaseListCmd { @Override public void execute(){ - Pair, Integer> pools = _mgr.searchForStoragePools(this); - ListResponse response = new ListResponse(); - List poolResponses = new ArrayList(); - for (StoragePool pool : pools.first()) { - StoragePoolResponse poolResponse = _responseGenerator.createStoragePoolResponse(pool); - poolResponse.setObjectName("storagepool"); - poolResponses.add(poolResponse); - } - - response.setResponses(poolResponses, pools.second()); + ListResponse response = _queryService.searchForStoragePools(this); response.setResponseName(getCommandName()); this.setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java index 480eb316e97..b03a7fc0062 100644 --- a/api/src/org/apache/cloudstack/query/QueryService.java +++ b/api/src/org/apache/cloudstack/query/QueryService.java @@ -20,6 +20,7 @@ import java.util.List; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.user.account.ListAccountsCmd; import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd; @@ -44,6 +45,7 @@ import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; @@ -85,6 +87,8 @@ public interface QueryService { public ListResponse searchForVolumes(ListVolumesCmd cmd); + public ListResponse searchForStoragePools(ListStoragePoolsCmd cmd); + public ListResponse searchForAccounts(ListAccountsCmd cmd); public ListResponse searchForAsyncJobs(ListAsyncJobsCmd cmd); diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 343dad9b67a..5e8a044691d 100755 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -35,6 +35,7 @@ import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; @@ -49,6 +50,7 @@ import com.cloud.api.query.dao.ProjectInvitationJoinDao; import com.cloud.api.query.dao.ProjectJoinDao; import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.api.query.dao.SecurityGroupJoinDao; +import com.cloud.api.query.dao.StoragePoolJoinDao; import com.cloud.api.query.dao.UserAccountJoinDao; import com.cloud.api.query.dao.UserVmJoinDao; import com.cloud.api.query.dao.VolumeJoinDao; @@ -63,6 +65,7 @@ import com.cloud.api.query.vo.ProjectInvitationJoinVO; import com.cloud.api.query.vo.ProjectJoinVO; import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; +import com.cloud.api.query.vo.StoragePoolJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.api.query.vo.VolumeJoinVO; @@ -183,6 +186,7 @@ import com.cloud.storage.Snapshot; import com.cloud.storage.SnapshotVO; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageManager; +import com.cloud.storage.StoragePool; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.StorageStats; import com.cloud.storage.UploadVO; @@ -324,6 +328,7 @@ public class ApiDBUtils { private static ProjectInvitationJoinDao _projectInvitationJoinDao; private static HostJoinDao _hostJoinDao; private static VolumeJoinDao _volJoinDao; + private static StoragePoolJoinDao _poolJoinDao; private static AccountJoinDao _accountJoinDao; private static AsyncJobJoinDao _jobJoinDao; @@ -414,6 +419,7 @@ public class ApiDBUtils { _projectInvitationJoinDao = locator.getDao(ProjectInvitationJoinDao.class); _hostJoinDao = locator.getDao(HostJoinDao.class); _volJoinDao = locator.getDao(VolumeJoinDao.class); + _poolJoinDao = locator.getDao(StoragePoolJoinDao.class); _accountJoinDao = locator.getDao(AccountJoinDao.class); _jobJoinDao = locator.getDao(AsyncJobJoinDao.class); @@ -1358,6 +1364,19 @@ public class ApiDBUtils { return _volJoinDao.newVolumeView(vr); } + public static StoragePoolResponse newStoragePoolResponse(StoragePoolJoinVO vr) { + return _poolJoinDao.newStoragePoolResponse(vr); + } + + public static StoragePoolResponse fillStoragePoolDetails(StoragePoolResponse vrData, StoragePoolJoinVO vr){ + return _poolJoinDao.setStoragePoolResponse(vrData, vr); + } + + public static List newStoragePoolView(StoragePool vr){ + return _poolJoinDao.newStoragePoolView(vr); + } + + public static AccountResponse newAccountResponse(AccountJoinVO ve) { return _accountJoinDao.newAccountResponse(ve); } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index d5cbb71dd9a..37be83efc5c 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -53,6 +53,7 @@ import com.cloud.api.query.vo.ProjectInvitationJoinVO; import com.cloud.api.query.vo.ProjectJoinVO; import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; +import com.cloud.api.query.vo.StoragePoolJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.api.query.vo.VolumeJoinVO; @@ -868,49 +869,12 @@ public class ApiResponseHelper implements ResponseGenerator { @Override public StoragePoolResponse createStoragePoolResponse(StoragePool pool) { - StoragePoolResponse poolResponse = new StoragePoolResponse(); - poolResponse.setId(pool.getUuid()); - poolResponse.setName(pool.getName()); - poolResponse.setState(pool.getStatus()); - poolResponse.setPath(pool.getPath()); - poolResponse.setIpAddress(pool.getHostAddress()); - DataCenter zone = ApiDBUtils.findZoneById(pool.getDataCenterId()); - if ( zone != null ){ - poolResponse.setZoneId(zone.getUuid()); - poolResponse.setZoneName(zone.getName()); - } - if (pool.getPoolType() != null) { - poolResponse.setType(pool.getPoolType().toString()); - } - if (pool.getPodId() != null) { - HostPodVO pod = ApiDBUtils.findPodById(pool.getPodId()); - if (pod != null) { - poolResponse.setPodId(pod.getUuid()); - poolResponse.setPodName(pod.getName()); - } - } - if (pool.getCreated() != null) { - poolResponse.setCreated(pool.getCreated()); - } + List viewPools = ApiDBUtils.newStoragePoolView(pool); + List listPools = ViewResponseHelper.createStoragePoolResponse(viewPools.toArray(new StoragePoolJoinVO[viewPools.size()])); + assert listPools != null && listPools.size() == 1 : "There should be one storage pool returned"; + return listPools.get(0); - StorageStats stats = ApiDBUtils.getStoragePoolStatistics(pool.getId()); - long allocatedSize = ApiDBUtils.getStorageCapacitybyPool(pool.getId(), Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED); - poolResponse.setDiskSizeTotal(pool.getCapacityBytes()); - poolResponse.setDiskSizeAllocated(allocatedSize); - if (stats != null) { - Long used = stats.getByteUsed(); - poolResponse.setDiskSizeUsed(used); - } - - if (pool.getClusterId() != null) { - ClusterVO cluster = ApiDBUtils.findClusterById(pool.getClusterId()); - poolResponse.setClusterId(cluster.getUuid()); - poolResponse.setClusterName(cluster.getName()); - } - poolResponse.setTags(ApiDBUtils.getStoragePoolTags(pool.getId())); - poolResponse.setObjectName("storagepool"); - return poolResponse; } @Override diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index 620917190cc..e2dc9ce2bbf 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -91,6 +91,7 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.user.project.ListProjectInvitationsCmd; import org.apache.cloudstack.api.command.user.project.ListProjectsCmd; @@ -476,6 +477,7 @@ public class ApiServer implements HttpRequestHandler { && !(cmdObj instanceof ListVolumesCmd) && !(cmdObj instanceof ListUsersCmd) && !(cmdObj instanceof ListAccountsCmd) + && !(cmdObj instanceof ListStoragePoolsCmd) ) { buildAsyncListResponse((BaseListCmd) cmdObj, caller); } diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index ceec932f942..b61f10a1ade 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -26,6 +26,7 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; +import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.user.account.ListAccountsCmd; import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd; @@ -50,6 +51,7 @@ import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; @@ -66,6 +68,7 @@ import com.cloud.api.query.dao.ProjectInvitationJoinDao; import com.cloud.api.query.dao.ProjectJoinDao; import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.api.query.dao.SecurityGroupJoinDao; +import com.cloud.api.query.dao.StoragePoolJoinDao; import com.cloud.api.query.dao.UserAccountJoinDao; import com.cloud.api.query.dao.UserVmJoinDao; import com.cloud.api.query.dao.VolumeJoinDao; @@ -80,6 +83,7 @@ import com.cloud.api.query.vo.ProjectInvitationJoinVO; import com.cloud.api.query.vo.ProjectJoinVO; import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; +import com.cloud.api.query.vo.StoragePoolJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.api.query.vo.VolumeJoinVO; @@ -100,6 +104,8 @@ import com.cloud.projects.ProjectManager; import com.cloud.projects.dao.ProjectAccountDao; import com.cloud.projects.dao.ProjectDao; import com.cloud.server.Criteria; +import com.cloud.storage.StoragePool; +import com.cloud.storage.StoragePoolVO; import com.cloud.storage.Volume; import com.cloud.user.Account; import com.cloud.user.AccountManager; @@ -199,6 +205,9 @@ public class QueryManagerImpl implements QueryService, Manager { @Inject private AsyncJobJoinDao _jobJoinDao; + @Inject + private StoragePoolJoinDao _poolJoinDao; + @Inject private HighAvailabilityManager _haMgr; @@ -1789,4 +1798,95 @@ public class QueryManagerImpl implements QueryService, Manager { return _jobJoinDao.searchAndCount(sc, searchFilter); } + @Override + public ListResponse searchForStoragePools(ListStoragePoolsCmd cmd) { + Pair, Integer> result = searchForStoragePoolsInternal(cmd); + ListResponse response = new ListResponse(); + + List poolResponses = ViewResponseHelper.createStoragePoolResponse(result.first().toArray(new StoragePoolJoinVO[result.first().size()])); + response.setResponses(poolResponses, result.second()); + return response; + } + + public Pair, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) { + + Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId()); + Object id = cmd.getId(); + Object name = cmd.getStoragePoolName(); + Object path = cmd.getPath(); + Object pod = cmd.getPodId(); + Object cluster = cmd.getClusterId(); + Object address = cmd.getIpAddress(); + Object keyword = cmd.getKeyword(); + Long startIndex = cmd.getStartIndex(); + Long pageSize = cmd.getPageSizeVal(); + + + Filter searchFilter = new Filter(StoragePoolJoinVO.class, "id", Boolean.TRUE, startIndex, pageSize); + + SearchBuilder sb = _poolJoinDao.createSearchBuilder(); + sb.select(null, Func.DISTINCT, sb.entity().getId()); // select distinct ids + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE); + sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ); + sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); + sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ); + sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ); + sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ); + + + SearchCriteria sc = sb.create(); + + + if (keyword != null) { + SearchCriteria ssc = _poolJoinDao.createSearchCriteria(); + ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + ssc.addOr("poolType", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + + sc.addAnd("name", SearchCriteria.Op.SC, ssc); + } + + if (id != null) { + sc.setParameters("id", id); + } + + if (name != null) { + sc.setParameters("name", SearchCriteria.Op.LIKE, "%" + name + "%"); + } + + if (path != null) { + sc.setParameters("path", SearchCriteria.Op.EQ, path); + } + if (zoneId != null) { + sc.setParameters("dataCenterId", SearchCriteria.Op.EQ, zoneId); + } + if (pod != null) { + sc.setParameters("podId", SearchCriteria.Op.EQ, pod); + } + if (address != null) { + sc.setParameters("hostAddress", SearchCriteria.Op.EQ, address); + } + if (cluster != null) { + sc.setParameters("clusterId", SearchCriteria.Op.EQ, cluster); + } + + // search Pool details by ids + Pair, Integer> uniquePoolPair = _poolJoinDao.searchAndCount(sc, searchFilter); + Integer count = uniquePoolPair.second(); + if (count.intValue() == 0) { + // empty result + return uniquePoolPair; + } + List uniquePools = uniquePoolPair.first(); + Long[] vrIds = new Long[uniquePools.size()]; + int i = 0; + for (StoragePoolJoinVO v : uniquePools) { + vrIds[i++] = v.getId(); + } + List vrs = _poolJoinDao.searchByIds(vrIds); + return new Pair, Integer>(vrs, count); + + } + + } diff --git a/server/src/com/cloud/api/query/ViewResponseHelper.java b/server/src/com/cloud/api/query/ViewResponseHelper.java index 08495860b20..39c108eb932 100644 --- a/server/src/com/cloud/api/query/ViewResponseHelper.java +++ b/server/src/com/cloud/api/query/ViewResponseHelper.java @@ -34,6 +34,7 @@ import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; @@ -51,6 +52,7 @@ import com.cloud.api.query.vo.ProjectInvitationJoinVO; import com.cloud.api.query.vo.ProjectJoinVO; import com.cloud.api.query.vo.ResourceTagJoinVO; import com.cloud.api.query.vo.SecurityGroupJoinVO; +import com.cloud.api.query.vo.StoragePoolJoinVO; import com.cloud.api.query.vo.UserAccountJoinVO; import com.cloud.api.query.vo.UserVmJoinVO; import com.cloud.api.query.vo.VolumeJoinVO; @@ -238,6 +240,25 @@ public class ViewResponseHelper { return new ArrayList(vrDataList.values()); } + public static List createStoragePoolResponse(StoragePoolJoinVO... pools) { + Hashtable vrDataList = new Hashtable(); + // Initialise the vrdatalist with the input data + for (StoragePoolJoinVO vr : pools) { + StoragePoolResponse vrData = vrDataList.get(vr.getId()); + if ( vrData == null ){ + // first time encountering this vm + vrData = ApiDBUtils.newStoragePoolResponse(vr); + } + else{ + // update tags + vrData = ApiDBUtils.fillStoragePoolDetails(vrData, vr); + } + vrDataList.put(vr.getId(), vrData); + } + return new ArrayList(vrDataList.values()); + } + + public static List createAccountResponse(AccountJoinVO... accounts) { List respList = new ArrayList(); for (AccountJoinVO vt : accounts){ diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java new file mode 100644 index 00000000000..bbb02428981 --- /dev/null +++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java @@ -0,0 +1,37 @@ +// 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 +// with 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.api.query.dao; + +import java.util.List; + +import org.apache.cloudstack.api.response.StoragePoolResponse; + +import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.storage.StoragePool; +import com.cloud.utils.db.GenericDao; + +public interface StoragePoolJoinDao extends GenericDao { + + StoragePoolResponse newStoragePoolResponse(StoragePoolJoinVO host); + + StoragePoolResponse setStoragePoolResponse(StoragePoolResponse response, StoragePoolJoinVO host); + + List newStoragePoolView(StoragePool group); + + List searchByIds(Long... spIds); + +} diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java new file mode 100644 index 00000000000..44ed1303af5 --- /dev/null +++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java @@ -0,0 +1,185 @@ +// 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 +// with 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.api.query.dao; + +import java.util.ArrayList; +import java.util.List; +import javax.ejb.Local; + +import org.apache.log4j.Logger; + +import com.cloud.api.ApiDBUtils; +import com.cloud.api.query.vo.StoragePoolJoinVO; +import com.cloud.configuration.dao.ConfigurationDao; +import org.apache.cloudstack.api.response.StoragePoolResponse; + +import com.cloud.storage.StoragePool; +import com.cloud.storage.StorageStats; +import com.cloud.utils.component.Inject; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + + +@Local(value={StoragePoolJoinDao.class}) +public class StoragePoolJoinDaoImpl extends GenericDaoBase implements StoragePoolJoinDao { + public static final Logger s_logger = Logger.getLogger(StoragePoolJoinDaoImpl.class); + + @Inject + private ConfigurationDao _configDao; + + private SearchBuilder spSearch; + + private SearchBuilder spIdSearch; + + + protected StoragePoolJoinDaoImpl() { + + spSearch = createSearchBuilder(); + spSearch.and("idIN", spSearch.entity().getId(), SearchCriteria.Op.IN); + spSearch.done(); + + spIdSearch = createSearchBuilder(); + spIdSearch.and("id", spIdSearch.entity().getId(), SearchCriteria.Op.EQ); + spIdSearch.done(); + + this._count = "select count(distinct id) from storage_pool_view WHERE "; + } + + + + + + @Override + public StoragePoolResponse newStoragePoolResponse(StoragePoolJoinVO pool) { + StoragePoolResponse poolResponse = new StoragePoolResponse(); + poolResponse.setId(pool.getUuid()); + poolResponse.setName(pool.getName()); + poolResponse.setState(pool.getStatus()); + poolResponse.setPath(pool.getPath()); + poolResponse.setIpAddress(pool.getHostAddress()); + poolResponse.setZoneId(pool.getZoneUuid()); + poolResponse.setZoneName(pool.getZoneName()); + if (pool.getPoolType() != null) { + poolResponse.setType(pool.getPoolType().toString()); + } + poolResponse.setPodId(pool.getPodUuid()); + poolResponse.setPodName(pool.getPodName()); + poolResponse.setCreated(pool.getCreated()); + + + long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity(); + poolResponse.setDiskSizeTotal(pool.getCapacityBytes()); + poolResponse.setDiskSizeAllocated(allocatedSize); + + //TODO: StatsCollector does not persist data + StorageStats stats = ApiDBUtils.getStoragePoolStatistics(pool.getId()); + if (stats != null) { + Long used = stats.getByteUsed(); + poolResponse.setDiskSizeUsed(used); + } + + poolResponse.setClusterId(pool.getClusterUuid()); + poolResponse.setClusterName(pool.getClusterName()); + poolResponse.setTags(pool.getTag()); + + // set async job + poolResponse.setJobId(pool.getJobUuid()); + poolResponse.setJobStatus(pool.getJobStatus()); + + poolResponse.setObjectName("storagepool"); + return poolResponse; + } + + + + + + @Override + public StoragePoolResponse setStoragePoolResponse(StoragePoolResponse response, StoragePoolJoinVO sp) { + String tag = sp.getTag(); + if (tag != null) { + if ( response.getTags() != null && response.getTags().length() > 0){ + response.setTags(response.getTags() + "," + tag); + } + else{ + response.setTags(tag); + } + } + return response; + } + + + + @Override + public List newStoragePoolView(StoragePool host) { + SearchCriteria sc = spIdSearch.create(); + sc.setParameters("id", host.getId()); + return searchIncludingRemoved(sc, null, null, false); + + } + + + + @Override + public List searchByIds(Long... spIds) { + // set detail batch query size + int DETAILS_BATCH_SIZE = 2000; + String batchCfg = _configDao.getValue("detail.batch.query.size"); + if ( batchCfg != null ){ + DETAILS_BATCH_SIZE = Integer.parseInt(batchCfg); + } + // query details by batches + List uvList = new ArrayList(); + // query details by batches + int curr_index = 0; + if ( spIds.length > DETAILS_BATCH_SIZE ){ + while ( (curr_index + DETAILS_BATCH_SIZE ) <= spIds.length ) { + Long[] ids = new Long[DETAILS_BATCH_SIZE]; + for (int k = 0, j = curr_index; j < curr_index + DETAILS_BATCH_SIZE; j++, k++) { + ids[k] = spIds[j]; + } + SearchCriteria sc = spSearch.create(); + sc.setParameters("idIN", ids); + List vms = searchIncludingRemoved(sc, null, null, false); + if (vms != null) { + uvList.addAll(vms); + } + curr_index += DETAILS_BATCH_SIZE; + } + } + if (curr_index < spIds.length) { + int batch_size = (spIds.length - curr_index); + // set the ids value + Long[] ids = new Long[batch_size]; + for (int k = 0, j = curr_index; j < curr_index + batch_size; j++, k++) { + ids[k] = spIds[j]; + } + SearchCriteria sc = spSearch.create(); + sc.setParameters("idIN", ids); + List vms = searchIncludingRemoved(sc, null, null, false); + if (vms != null) { + uvList.addAll(vms); + } + } + return uvList; + } + + + + +} diff --git a/server/src/com/cloud/api/query/vo/BaseViewVO.java b/server/src/com/cloud/api/query/vo/BaseViewVO.java index 604f4597a0e..6b1ddd6561a 100644 --- a/server/src/com/cloud/api/query/vo/BaseViewVO.java +++ b/server/src/com/cloud/api/query/vo/BaseViewVO.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.api.query.vo; -import javax.persistence.Column; - public abstract class BaseViewVO { public abstract long getId(); diff --git a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java new file mode 100644 index 00000000000..fd837bd5d88 --- /dev/null +++ b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java @@ -0,0 +1,341 @@ +// 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 +// with 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.api.query.vo; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Table; +import com.cloud.org.Cluster; +import com.cloud.storage.StoragePoolStatus; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.utils.db.GenericDao; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +/** + * Storage Pool DB view. + * @author minc + * + */ +@Entity +@Table(name="storage_pool_view") +public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, Identity { + + @Id + @Column(name="id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name="name") + private String name; + + @Column(name="path") + private String path; + + @Column(name="host_address") + private String hostAddress; + + + @Column(name="status") + @Enumerated(value=EnumType.STRING) + private StoragePoolStatus status; + + @Column(name="pool_type") + @Enumerated(value=EnumType.STRING) + private StoragePoolType poolType; + + @Column(name=GenericDao.CREATED_COLUMN) + private Date created; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name="capacity_bytes") + private long capacityBytes; + + @Column(name="cluster_id") + private long clusterId; + + @Column(name="cluster_uuid") + private String clusterUuid; + + @Column(name="cluster_name") + private String clusterName; + + @Column(name="cluster_type") + @Enumerated(value=EnumType.STRING) + private Cluster.ClusterType clusterType; + + @Column(name="data_center_id") + private long zoneId; + + @Column(name="data_center_uuid") + private String zoneUuid; + + @Column(name="data_center_name") + private String zoneName; + + @Column(name="pod_id") + private long podId; + + @Column(name="pod_uuid") + private String podUuid; + + @Column(name="pod_name") + private String podName; + + + @Column(name="tag") + private String tag; + + @Column(name="disk_used_capacity") + private long usedCapacity; + + @Column(name="disk_reserved_capacity") + private long reservedCapacity; + + + @Column(name="job_id") + private long jobId; + + @Column(name="job_uuid") + private String jobUuid; + + @Column(name="job_status") + private int jobStatus; + + @Override + public long getId() { + return id; + } + + @Override + public void setId(long id) { + this.id = id; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getHostAddress() { + return hostAddress; + } + + public void setHostAddress(String hostAddress) { + this.hostAddress = hostAddress; + } + + public StoragePoolStatus getStatus() { + return status; + } + + public void setStatus(StoragePoolStatus status) { + this.status = status; + } + + public StoragePoolType getPoolType() { + return poolType; + } + + public void setPoolType(StoragePoolType poolType) { + this.poolType = poolType; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public long getCapacityBytes() { + return capacityBytes; + } + + public void setCapacityBytes(long capacityBytes) { + this.capacityBytes = capacityBytes; + } + + public long getClusterId() { + return clusterId; + } + + public void setClusterId(long clusterId) { + this.clusterId = clusterId; + } + + public String getClusterUuid() { + return clusterUuid; + } + + public void setClusterUuid(String clusterUuid) { + this.clusterUuid = clusterUuid; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public Cluster.ClusterType getClusterType() { + return clusterType; + } + + public void setClusterType(Cluster.ClusterType clusterType) { + this.clusterType = clusterType; + } + + public long getZoneId() { + return zoneId; + } + + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + + public String getZoneUuid() { + return zoneUuid; + } + + public void setZoneUuid(String zoneUuid) { + this.zoneUuid = zoneUuid; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public long getPodId() { + return podId; + } + + public void setPodId(long podId) { + this.podId = podId; + } + + public String getPodUuid() { + return podUuid; + } + + public void setPodUuid(String podUuid) { + this.podUuid = podUuid; + } + + public String getPodName() { + return podName; + } + + public void setPodName(String podName) { + this.podName = podName; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public long getUsedCapacity() { + return usedCapacity; + } + + public void setUsedCapacity(long usedCapacity) { + this.usedCapacity = usedCapacity; + } + + public long getReservedCapacity() { + return reservedCapacity; + } + + public void setReservedCapacity(long reservedCapacity) { + this.reservedCapacity = reservedCapacity; + } + + public long getJobId() { + return jobId; + } + + public void setJobId(long jobId) { + this.jobId = jobId; + } + + public String getJobUuid() { + return jobUuid; + } + + public void setJobUuid(String jobUuid) { + this.jobUuid = jobUuid; + } + + public int getJobStatus() { + return jobStatus; + } + + public void setJobStatus(int jobStatus) { + this.jobStatus = jobStatus; + } + + +} diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java index 8d8ee9a69a4..8c6d35f45e0 100755 --- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java +++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java @@ -34,6 +34,7 @@ import com.cloud.api.query.dao.ProjectInvitationJoinDaoImpl; import com.cloud.api.query.dao.ProjectJoinDaoImpl; import com.cloud.api.query.dao.ResourceTagJoinDaoImpl; import com.cloud.api.query.dao.SecurityGroupJoinDaoImpl; +import com.cloud.api.query.dao.StoragePoolJoinDaoImpl; import com.cloud.api.query.dao.UserAccountJoinDaoImpl; import com.cloud.api.query.dao.UserVmJoinDaoImpl; import com.cloud.api.query.dao.HostJoinDaoImpl; @@ -388,6 +389,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com addDao("VolumeJoinDao", VolumeJoinDaoImpl.class); addDao("AccountJoinDao", AccountJoinDaoImpl.class); addDao("AsyncJobJoinDao", AsyncJobJoinDaoImpl.class); + addDao("StoragePoolJoinDao", StoragePoolJoinDaoImpl.class); } @Override diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 22ae1799948..dcecaf40a57 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -2335,23 +2335,6 @@ public class ManagementServerImpl implements ManagementServer { } } - @Override - public Pair, Integer> searchForStoragePools(ListStoragePoolsCmd cmd) { - - Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId()); - Criteria c = new Criteria("id", Boolean.TRUE, cmd.getStartIndex(), cmd.getPageSizeVal()); - c.addCriteria(Criteria.ID, cmd.getId()); - c.addCriteria(Criteria.NAME, cmd.getStoragePoolName()); - c.addCriteria(Criteria.CLUSTERID, cmd.getClusterId()); - c.addCriteria(Criteria.ADDRESS, cmd.getIpAddress()); - c.addCriteria(Criteria.KEYWORD, cmd.getKeyword()); - c.addCriteria(Criteria.PATH, cmd.getPath()); - c.addCriteria(Criteria.PODID, cmd.getPodId()); - c.addCriteria(Criteria.DATACENTERID, zoneId); - - Pair, Integer> result = searchForStoragePools(c); - return new Pair, Integer>(result.first(), result.second()); - } @Override public Pair, Integer> searchForStoragePools(Criteria c) { diff --git a/server/test/com/cloud/api/ListPerfTest.java b/server/test/com/cloud/api/ListPerfTest.java index 7402cea711a..eb98d9187fe 100644 --- a/server/test/com/cloud/api/ListPerfTest.java +++ b/server/test/com/cloud/api/ListPerfTest.java @@ -148,4 +148,21 @@ public class ListPerfTest extends APITest { System.out.println("Time taken to list Users: " + (after - before) + " ms"); } + + @Test + public void testListStoragePools(){ + // issue list Storage pool calls + HashMap params = new HashMap(); + params.put("response", "json"); + params.put("listAll", "true"); + params.put("sessionkey", sessionKey); + long before = System.currentTimeMillis(); + String result = this.sendRequest("listStoragePools", params); + long after = System.currentTimeMillis(); + System.out.println("Time taken to list StoragePools: " + (after - before) + " ms"); + + } + + + } diff --git a/setup/db/create-schema-view.sql b/setup/db/create-schema-view.sql index f502c88a90d..bf04c1caa57 100755 --- a/setup/db/create-schema-view.sql +++ b/setup/db/create-schema-view.sql @@ -782,3 +782,40 @@ left join autoscale_policies on async_job.instance_id = autoscale_policies.id left join autoscale_vmprofiles on async_job.instance_id = autoscale_vmprofiles.id left join autoscale_vmgroups on async_job.instance_id = autoscale_vmgroups.id; +DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; +CREATE VIEW storage_pool_view AS +select +storage_pool.id, +storage_pool.uuid, +storage_pool.name, +storage_pool.status, +storage_pool.path, +storage_pool.pool_type, +storage_pool.host_address, +storage_pool.created, +storage_pool.removed, +storage_pool.capacity_bytes, +cluster.id cluster_id, +cluster.uuid cluster_uuid, +cluster.name cluster_name, +cluster.cluster_type, +data_center.id data_center_id, +data_center.uuid data_center_uuid, +data_center.name data_center_name, +host_pod_ref.id pod_id, +host_pod_ref.uuid pod_uuid, +host_pod_ref.name pod_name, +storage_pool_details.name tag, +op_host_capacity.used_capacity disk_used_capacity, +op_host_capacity.reserved_capacity disk_reserved_capacity, +async_job.id job_id, +async_job.uuid job_uuid, +async_job.job_status job_status, +async_job.account_id job_account_id +from storage_pool +left join cluster on storage_pool.cluster_id = cluster.id +left join data_center on storage_pool.data_center_id = data_center.id +left join host_pod_ref on storage_pool.pod_id = host_pod_ref.id +left join storage_pool_details on storage_pool_details.pool_id = storage_pool.id and storage_pool_details.value = 'true' +left join op_host_capacity on storage_pool.id = op_host_capacity.host_id and op_host_capacity.capacity_type = 3 +left join async_job on async_job.instance_id = storage_pool.id and async_job.instance_type = "StoragePool" and async_job.job_status = 0; \ No newline at end of file diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 11423200c86..bf3fb303e5b 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -143,6 +143,8 @@ UPDATE `cloud`.`conditions` set uuid=id WHERE uuid is NULL; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', '"detail.batch.query.size"', '2000', 'Default entity detail batch query size for listing'); --- DB views for list api --- +use cloud; + DROP VIEW IF EXISTS `cloud`.`user_vm_view`; CREATE VIEW `cloud`.`user_vm_view` AS select @@ -905,3 +907,41 @@ left join conditions on async_job.instance_id = conditions.id left join autoscale_policies on async_job.instance_id = autoscale_policies.id left join autoscale_vmprofiles on async_job.instance_id = autoscale_vmprofiles.id left join autoscale_vmgroups on async_job.instance_id = autoscale_vmgroups.id; + +DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; +CREATE VIEW storage_pool_view AS +select +storage_pool.id, +storage_pool.uuid, +storage_pool.name, +storage_pool.status, +storage_pool.path, +storage_pool.pool_type, +storage_pool.host_address, +storage_pool.created, +storage_pool.removed, +storage_pool.capacity_bytes, +cluster.id cluster_id, +cluster.uuid cluster_uuid, +cluster.name cluster_name, +cluster.cluster_type, +data_center.id data_center_id, +data_center.uuid data_center_uuid, +data_center.name data_center_name, +host_pod_ref.id pod_id, +host_pod_ref.uuid pod_uuid, +host_pod_ref.name pod_name, +storage_pool_details.name tag, +op_host_capacity.used_capacity disk_used_capacity, +op_host_capacity.reserved_capacity disk_reserved_capacity, +async_job.id job_id, +async_job.uuid job_uuid, +async_job.job_status job_status, +async_job.account_id job_account_id +from storage_pool +left join cluster on storage_pool.cluster_id = cluster.id +left join data_center on storage_pool.data_center_id = data_center.id +left join host_pod_ref on storage_pool.pod_id = host_pod_ref.id +left join storage_pool_details on storage_pool_details.pool_id = storage_pool.id and storage_pool_details.value = 'true' +left join op_host_capacity on storage_pool.id = op_host_capacity.host_id and op_host_capacity.capacity_type = 3 +left join async_job on async_job.instance_id = storage_pool.id and async_job.instance_type = "StoragePool" and async_job.job_status = 0; From aa9ccf73022412a7edba7bf266bbbc5ef86add53 Mon Sep 17 00:00:00 2001 From: radhikap Date: Wed, 19 Dec 2012 10:05:28 +0530 Subject: [PATCH 04/19] fix for CLOUDSTACK-481 Signed-off-by: radhikap --- docs/en-US/build-deb.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en-US/build-deb.xml b/docs/en-US/build-deb.xml index deee3ceb1de..37e5a7d7474 100644 --- a/docs/en-US/build-deb.xml +++ b/docs/en-US/build-deb.xml @@ -110,7 +110,7 @@ cloud-utils_4.0.0-incubating_amd64.deb create /etc/apt/sources.list.d/cloudstack.list with this line: - deb http://server.url/cloudstack/repo binary/ + deb http://server.url/cloudstack/repo binary ./ Now that you have the repository info in place, you'll want to run another update so that APT knows where to find the &PRODUCT; packages. From d22229eb9dd4890efd788b07c39b477abb806288 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 8 Jan 2013 17:12:14 -0800 Subject: [PATCH 05/19] Remove updateUuids code in ConfigurationServerImpl (which is not the right approach to populate uuid column since it will impact upgrade as well), and populate UUID column in seed data sql script. Signed-off-by: Min Chen --- developer/developer-prefill.sql | 20 +- .../cloud/server/ConfigurationServerImpl.java | 31 +- setup/db/create-schema.sql | 8 +- setup/db/server-setup.sql | 2 +- setup/db/templates.kvm.sql | 100 ++--- setup/db/templates.simulator.sql | 8 +- setup/db/templates.sql | 384 +++++++++--------- setup/db/templates.vmware.sql | 146 +++---- setup/db/templates.xenserver.sql | 162 ++++---- 9 files changed, 432 insertions(+), 429 deletions(-) diff --git a/developer/developer-prefill.sql b/developer/developer-prefill.sql index e14ac375e98..6300d35df64 100644 --- a/developer/developer-prefill.sql +++ b/developer/developer-prefill.sql @@ -18,24 +18,24 @@ -- Add a default ROOT domain use cloud; -INSERT INTO `cloud`.`domain` (id, name, parent, path, owner) VALUES - (1, 'ROOT', NULL, '/', 2); +INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES + (1, UUID(), 'ROOT', NULL, '/', 2); -- Add system and admin accounts -INSERT INTO `cloud`.`account` (id, account_name, type, domain_id, state) VALUES - (1, 'system', 1, 1, 'enabled'); +INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES + (1, UUID(), 'system', 1, 1, 'enabled'); -INSERT INTO `cloud`.`account` (id, account_name, type, domain_id, state) VALUES - (2, 'admin', 1, 1, 'enabled'); +INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES + (2, UUID(), 'admin', 1, 1, 'enabled'); -- Add system user -INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, - lastname, email, state, created) VALUES (1, 'system', RAND(), +INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, + lastname, email, state, created) VALUES (1, UUID(), 'system', RAND(), '1', 'system', 'cloud', NULL, 'enabled', NOW()); -- Add system user with encrypted password=password -INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, - lastname, email, state, created) VALUES (2, 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', +INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, + lastname, email, state, created) VALUES (2, UUID(), 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', '2', 'Admin', 'User', 'admin@mailprovider.com', 'enabled', NOW()); -- Add configurations diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 43a1d99c888..af5989cf003 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -5,7 +5,7 @@ // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with 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, @@ -254,12 +254,14 @@ public class ConfigurationServerImpl implements ConfigurationServer { // Update the cloud identifier updateCloudIdentifier(); - updateUuids(); + // We should not update seed data UUID column here since this will be invoked in upgrade case as well. + //updateUuids(); // Set init to true _configDao.update("init", "Hidden", "true"); } + /* private void updateUuids() { _identityDao.initializeDefaultUuid("disk_offering"); _identityDao.initializeDefaultUuid("network_offerings"); @@ -281,6 +283,7 @@ public class ConfigurationServerImpl implements ConfigurationServer { _identityDao.initializeDefaultUuid("user_ip_address"); _identityDao.initializeDefaultUuid("counter"); } + */ private String getMountParent() { return getEnvironmentProperty("mount.parent"); @@ -307,7 +310,7 @@ public class ConfigurationServerImpl implements ConfigurationServer { @DB protected void saveUser() { // insert system account - String insertSql = "INSERT INTO `cloud`.`account` (id, account_name, type, domain_id) VALUES (1, 'system', '1', '1')"; + String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (1, UUID(), 'system', '1', '1')"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); @@ -315,8 +318,8 @@ public class ConfigurationServerImpl implements ConfigurationServer { } catch (SQLException ex) { } // insert system user - insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created)" + - " VALUES (1, 'system', RAND(), 1, 'system', 'cloud', now())"; + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created)" + + " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now())"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); @@ -332,7 +335,7 @@ public class ConfigurationServerImpl implements ConfigurationServer { String lastname = "cloud"; // create an account for the admin user first - insertSql = "INSERT INTO `cloud`.`account` (id, account_name, type, domain_id) VALUES (" + id + ", '" + username + "', '1', '1')"; + insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1')"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); @@ -341,8 +344,8 @@ public class ConfigurationServerImpl implements ConfigurationServer { } // now insert the user - insertSql = "INSERT INTO `cloud`.`user` (id, username, account_id, firstname, lastname, created, state) " + - "VALUES (" + id + ",'" + username + "', 2, '" + firstname + "','" + lastname + "',now(), 'disabled')"; + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, account_id, firstname, lastname, created, state) " + + "VALUES (" + id + ", UUID(), '" + username + "', 2, '" + firstname + "','" + lastname + "',now(), 'disabled')"; txn = Transaction.currentTxn(); try { @@ -368,8 +371,8 @@ public class ConfigurationServerImpl implements ConfigurationServer { if (!rs.next()) { // save default security group if (tableName.equals("security_group")) { - insertSql = "INSERT INTO " + tableName + " (name, description, account_id, domain_id) " + - "VALUES ('default', 'Default Security Group', 2, 1)"; + insertSql = "INSERT INTO " + tableName + " (uuid, name, description, account_id, domain_id) " + + "VALUES (UUID(), 'default', 'Default Security Group', 2, 1)"; } else { insertSql = "INSERT INTO " + tableName + " (name, description, account_id, domain_id, account_name) " + "VALUES ('default', 'Default Security Group', 2, 1, 'admin')"; @@ -842,16 +845,16 @@ public class ConfigurationServerImpl implements ConfigurationServer { @DB protected void createDefaultNetworkOfferings() { - NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPublicNetwork, + NetworkOfferingVO publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPublicNetwork, TrafficType.Public, true); publicNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(publicNetworkOffering); - NetworkOfferingVO managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemManagementNetwork, + NetworkOfferingVO managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemManagementNetwork, TrafficType.Management, false); managementNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(managementNetworkOffering); - NetworkOfferingVO controlNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemControlNetwork, + NetworkOfferingVO controlNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemControlNetwork, TrafficType.Control, false); controlNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(controlNetworkOffering); - NetworkOfferingVO storageNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemStorageNetwork, + NetworkOfferingVO storageNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemStorageNetwork, TrafficType.Storage, true); storageNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(storageNetworkOffering); NetworkOfferingVO privateGatewayNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemPrivateGatewayNetworkOffering, GuestType.Isolated); diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 0a463631723..37d52539f16 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -2539,10 +2539,10 @@ CREATE TABLE `cloud`.`autoscale_vmgroup_policy_map` ( INDEX `i_autoscale_vmgroup_policy_map__vmgroup_id`(`vmgroup_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `cloud`.`counter` (id, source, name, value,created) VALUES (1,'snmp','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.0', now()); -INSERT INTO `cloud`.`counter` (id, source, name, value,created) VALUES (2,'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now()); -INSERT INTO `cloud`.`counter` (id, source, name, value,created) VALUES (3,'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now()); -INSERT INTO `cloud`.`counter` (id, source, name, value,created) VALUES (100,'netscaler','Response Time - microseconds', 'RESPTIME', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (1, UUID(), 'snmp','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2, UUID(), 'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(), 'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(), 'netscaler','Response Time - microseconds', 'RESPTIME', now()); SET foreign_key_checks = 1; diff --git a/setup/db/server-setup.sql b/setup/db/server-setup.sql index 2cbfc162e1f..faab38e33fc 100644 --- a/setup/db/server-setup.sql +++ b/setup/db/server-setup.sql @@ -18,7 +18,7 @@ /* This file specifies default values that go into the database, before the Management Server is run. */ /* Root Domain */ -INSERT INTO `cloud`.`domain` (id, name, parent, path, owner) VALUES (1, 'ROOT', NULL, '/', 2); +INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES (1, UUID(), 'ROOT', NULL, '/', 2); /* Configuration Table */ diff --git a/setup/db/templates.kvm.sql b/setup/db/templates.kvm.sql index 7b9502719da..bc275f5285d 100644 --- a/setup/db/templates.kvm.sql +++ b/setup/db/templates.kvm.sql @@ -15,56 +15,56 @@ -- specific language governing permissions and limitations -- under the License. -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) - VALUES (1, 'routing', 'DomR Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/a88232bf-6a18-38e7-aeee-c1702725079f.qcow2.bz2', 'e39c55e93ae96bd43bfd588ca6ee3269', 'DomR Template', 0, 'QCOW2', 21, 0, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) - VALUES (2, 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 9, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) + VALUES (1, UUID(), 'routing', 'DomR Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/a88232bf-6a18-38e7-aeee-c1702725079f.qcow2.bz2', 'e39c55e93ae96bd43bfd588ca6ee3269', 'DomR Template', 0, 'QCOW2', 21, 0, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) + VALUES (2, UUID(), 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 9, 1, 1); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Ubuntu'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (5, 'RedHat'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (7, 'Windows'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (8, 'Other'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (1, UUID(), 'CentOS'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (2, UUID(), 'Ubuntu'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (5, UUID(), 'RedHat'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (7, UUID(), 'Windows'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (8, UUID(), 'Other'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 4.5', 'CentOS 4.5'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 4.6', 'CentOS 4.6'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 4.7', 'CentOS 4.7'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.0', 'CentOS 5.0'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.1', 'CentOS 5.1'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.2', 'CentOS 5.2'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.3', 'CentOS 5.3'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.4', 'CentOS 5.4'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (1, 'CentOS 5.5', 'CentOS 5.5'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 4.5', 'Red Hat Enterprise Linux 4.5'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 4.6', 'Red Hat Enterprise Linux 4.6'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 4.7', 'Red Hat Enterprise Linux 4.7'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.0', 'Red Hat Enterprise Linux 5.0'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.1', 'Red Hat Enterprise Linux 5.1'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.2', 'Red Hat Enterprise Linux 5.2'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.3', 'Red Hat Enterprise Linux 5.3'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.4', 'Red Hat Enterprise Linux 5.4'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 5.5', 'Red Hat Enterprise Linux 5.5'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Red Hat Enterprise Linux 6', 'Red Hat Enterprise Linux 6'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 13', 'Fedora 13'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 12', 'Fedora 12'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 11', 'Fedora 11'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 10', 'Fedora 10'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 9', 'Fedora 9'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (5, 'Fedora 8', 'Fedora 8'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Ubuntu 10.04', 'Ubuntu 10.04'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Ubuntu 9.10', 'Ubuntu 9.10'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Ubuntu 9.04', 'Ubuntu 9.04'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Ubuntu 8.10', 'Ubuntu 8.10'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Ubuntu 8.04', 'Ubuntu 8.04'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Debian Squeeze', 'Debian Squeeze'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Debian Lenny', 'Debian Lenny'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (2, 'Debian Etch', 'Debian Etch'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows 7', 'Windows 7'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows Server 2003', 'Windows Server 2003'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows Server 2008', 'Windows Server 2008'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows 2000 SP4', 'Windows 2000 SP4'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows Vista', 'Windows Vista'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows XP SP2', 'Windows XP SP2'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (7, 'Windows XP SP3', 'Windows XP SP3'); -INSERT INTO `cloud`.`guest_os` (category_id, name, display_name) VALUES (8, 'Other install media', 'Other'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 4.5', 'CentOS 4.5'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 4.6', 'CentOS 4.6'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 4.7', 'CentOS 4.7'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.0', 'CentOS 5.0'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.1', 'CentOS 5.1'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.2', 'CentOS 5.2'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.3', 'CentOS 5.3'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.4', 'CentOS 5.4'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 1, 'CentOS 5.5', 'CentOS 5.5'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 4.5', 'Red Hat Enterprise Linux 4.5'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 4.6', 'Red Hat Enterprise Linux 4.6'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 4.7', 'Red Hat Enterprise Linux 4.7'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.0', 'Red Hat Enterprise Linux 5.0'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.1', 'Red Hat Enterprise Linux 5.1'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.2', 'Red Hat Enterprise Linux 5.2'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.3', 'Red Hat Enterprise Linux 5.3'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.4', 'Red Hat Enterprise Linux 5.4'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 5.5', 'Red Hat Enterprise Linux 5.5'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Red Hat Enterprise Linux 6', 'Red Hat Enterprise Linux 6'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 13', 'Fedora 13'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 12', 'Fedora 12'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 11', 'Fedora 11'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 10', 'Fedora 10'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 9', 'Fedora 9'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 5, 'Fedora 8', 'Fedora 8'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 10.04', 'Ubuntu 10.04'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 9.10', 'Ubuntu 9.10'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 9.04', 'Ubuntu 9.04'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 8.10', 'Ubuntu 8.10'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Ubuntu 8.04', 'Ubuntu 8.04'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Squeeze', 'Debian Squeeze'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Lenny', 'Debian Lenny'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 2, 'Debian Etch', 'Debian Etch'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows 7', 'Windows 7'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows Server 2003', 'Windows Server 2003'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows Server 2008', 'Windows Server 2008'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows 2000 SP4', 'Windows 2000 SP4'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows Vista', 'Windows Vista'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows XP SP2', 'Windows XP SP2'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 7, 'Windows XP SP3', 'Windows XP SP3'); +INSERT INTO `cloud`.`guest_os` (uuid, category_id, name, display_name) VALUES (UUID(), 8, 'Other install media', 'Other'); diff --git a/setup/db/templates.simulator.sql b/setup/db/templates.simulator.sql index 7e712f54177..437e8f5357e 100755 --- a/setup/db/templates.simulator.sql +++ b/setup/db/templates.simulator.sql @@ -16,7 +16,7 @@ -- under the License. -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (10, 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator'); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (11, 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (10, UUID(), 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (11, UUID(), 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator'); diff --git a/setup/db/templates.sql b/setup/db/templates.sql index 0c85be47a5f..3867d4fe9d2 100755 --- a/setup/db/templates.sql +++ b/setup/db/templates.sql @@ -15,207 +15,207 @@ -- specific language governing permissions and limitations -- under the License. -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (1, 'routing-1', 'SystemVM Template (XenServer)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2', 'f613f38c96bf039f2e5cbf92fa8ad4f8', 0, 'SystemVM Template (XenServer)', 'VHD', 133, 0, 1, 'XenServer'); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, removed, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) - VALUES (2, 'centos53-x86_64', 'CentOS 5.3(64-bit) no GUI (XenServer)', 1, now(), now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(64-bit) no GUI (XenServer)', 'VHD', 12, 1, 1, 'XenServer', 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (1, UUID(), 'routing-1', 'SystemVM Template (XenServer)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2', 'f613f38c96bf039f2e5cbf92fa8ad4f8', 0, 'SystemVM Template (XenServer)', 'VHD', 133, 0, 1, 'XenServer'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, removed, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) + VALUES (2, UUID(), 'centos53-x86_64', 'CentOS 5.3(64-bit) no GUI (XenServer)', 1, now(), now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(64-bit) no GUI (XenServer)', 'VHD', 12, 1, 1, 'XenServer', 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (3, 'routing-3', 'SystemVM Template (KVM)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (KVM)', 'QCOW2', 15, 0, 1, 'KVM'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (3, UUID(), 'routing-3', 'SystemVM Template (KVM)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (KVM)', 'QCOW2', 15, 0, 1, 'KVM'); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) - VALUES (4, 'centos55-x86_64', 'CentOS 5.5(64-bit) no GUI (KVM)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', 'ed0e788280ff2912ea40f7f91ca7a249', 'CentOS 5.5(64-bit) no GUI (KVM)', 0, 'QCOW2', 112, 1, 1, 'KVM', 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) + VALUES (4, UUID(), 'centos55-x86_64', 'CentOS 5.5(64-bit) no GUI (KVM)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', 'ed0e788280ff2912ea40f7f91ca7a249', 'CentOS 5.5(64-bit) no GUI (KVM)', 0, 'QCOW2', 112, 1, 1, 'KVM', 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) - VALUES (5, 'centos56-x86_64-xen', 'CentOS 5.6(64-bit) no GUI (XenServer)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/centos56-x86_64.vhd.bz2', '905cec879afd9c9d22ecc8036131a180', 0, 'CentOS 5.6(64-bit) no GUI (XenServer)', 'VHD', 12, 1, 1, 'XenServer', 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) + VALUES (5, UUID(), 'centos56-x86_64-xen', 'CentOS 5.6(64-bit) no GUI (XenServer)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/templates/builtin/centos56-x86_64.vhd.bz2', '905cec879afd9c9d22ecc8036131a180', 0, 'CentOS 5.6(64-bit) no GUI (XenServer)', 'VHD', 12, 1, 1, 'XenServer', 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) - VALUES (7, 'centos53-x64', 'CentOS 5.3(64-bit) no GUI (vSphere)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/CentOS5.3-x86_64.ova', 'f6f881b7f2292948d8494db837fe0f47', 0, 'CentOS 5.3(64-bit) no GUI (vSphere)', 'OVA', 12, 1, 1, 'VMware', 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) + VALUES (7, UUID(), 'centos53-x64', 'CentOS 5.3(64-bit) no GUI (vSphere)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/CentOS5.3-x86_64.ova', 'f6f881b7f2292948d8494db837fe0f47', 0, 'CentOS 5.3(64-bit) no GUI (vSphere)', 'OVA', 12, 1, 1, 'VMware', 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (8, 'routing-8', 'SystemVM Template (vSphere)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova', '7137e453f950079ea2ba6feaafd939e8', 0, 'SystemVM Template (vSphere)', 'OVA', 15, 0, 1, 'VMware'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (8, UUID(), 'routing-8', 'SystemVM Template (vSphere)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova', '7137e453f950079ea2ba6feaafd939e8', 0, 'SystemVM Template (vSphere)', 'OVA', 15, 0, 1, 'VMware'); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (9, 'routing-9', 'SystemVM Template (HyperV)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2', 'f613f38c96bf039f2e5cbf92fa8ad4f8', 0, 'SystemVM Template (HyperV)', 'VHD', 15, 0, 1, 'Hyperv'); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) + VALUES (9, UUID(), 'routing-9', 'SystemVM Template (HyperV)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2', 'f613f38c96bf039f2e5cbf92fa8ad4f8', 0, 'SystemVM Template (HyperV)', 'VHD', 15, 0, 1, 'Hyperv'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (3, 'Oracle'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (4, 'RedHat'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (5, 'SUSE'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (6, 'Windows'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (7, 'Other'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (8, 'Novel'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (9, 'Unix'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (10, 'Ubuntu'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (11, 'None'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (1, UUID(), 'CentOS'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (2, UUID(), 'Debian'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (3, UUID(), 'Oracle'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (4, UUID(), 'RedHat'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (5, UUID(), 'SUSE'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (6, UUID(), 'Windows'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (7, UUID(), 'Other'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (8, UUID(), 'Novel'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (9, UUID(), 'Unix'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (10, UUID(), 'Ubuntu'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (11, UUID(), 'None'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (1, 1, 'CentOS 4.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (2, 1, 'CentOS 4.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (3, 1, 'CentOS 4.7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (4, 1, 'CentOS 4.8 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (5, 1, 'CentOS 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (6, 1, 'CentOS 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (7, 1, 'CentOS 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (8, 1, 'CentOS 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (9, 1, 'CentOS 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (10, 1, 'CentOS 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (11, 1, 'CentOS 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (12, 1, 'CentOS 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (13, 1, 'CentOS 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (14, 1, 'CentOS 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (15, 2, 'Debian GNU/Linux 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (16, 3, 'Oracle Enterprise Linux 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (17, 3, 'Oracle Enterprise Linux 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (18, 3, 'Oracle Enterprise Linux 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (19, 3, 'Oracle Enterprise Linux 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (20, 3, 'Oracle Enterprise Linux 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (21, 3, 'Oracle Enterprise Linux 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (22, 3, 'Oracle Enterprise Linux 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (23, 3, 'Oracle Enterprise Linux 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (24, 3, 'Oracle Enterprise Linux 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (25, 3, 'Oracle Enterprise Linux 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (26, 4, 'Red Hat Enterprise Linux 4.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (27, 4, 'Red Hat Enterprise Linux 4.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (28, 4, 'Red Hat Enterprise Linux 4.7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (29, 4, 'Red Hat Enterprise Linux 4.8 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (30, 4, 'Red Hat Enterprise Linux 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (31, 4, 'Red Hat Enterprise Linux 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (32, 4, 'Red Hat Enterprise Linux 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (33, 4, 'Red Hat Enterprise Linux 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (34, 4, 'Red Hat Enterprise Linux 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (35, 4, 'Red Hat Enterprise Linux 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (36, 4, 'Red Hat Enterprise Linux 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (37, 4, 'Red Hat Enterprise Linux 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (38, 4, 'Red Hat Enterprise Linux 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (39, 4, 'Red Hat Enterprise Linux 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (40, 5, 'SUSE Linux Enterprise Server 9 SP4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (41, 5, 'SUSE Linux Enterprise Server 10 SP1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (42, 5, 'SUSE Linux Enterprise Server 10 SP1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (43, 5, 'SUSE Linux Enterprise Server 10 SP2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (44, 5, 'SUSE Linux Enterprise Server 10 SP2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (45, 5, 'SUSE Linux Enterprise Server 10 SP3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (46, 5, 'SUSE Linux Enterprise Server 11 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (47, 5, 'SUSE Linux Enterprise Server 11 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (48, 6, 'Windows 7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (49, 6, 'Windows 7 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (50, 6, 'Windows Server 2003 Enterprise Edition(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (51, 6, 'Windows Server 2003 Enterprise Edition(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (52, 6, 'Windows Server 2008 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (53, 6, 'Windows Server 2008 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (54, 6, 'Windows Server 2008 R2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (55, 6, 'Windows 2000 Server SP4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (56, 6, 'Windows Vista (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (57, 6, 'Windows XP SP2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (58, 6, 'Windows XP SP3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (59, 10, 'Other Ubuntu (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (60, 7, 'Other (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (61, 6, 'Windows 2000 Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (62, 6, 'Windows 98'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (63, 6, 'Windows 95'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (64, 6, 'Windows NT 4'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (65, 6, 'Windows 3.1'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (66, 4, 'Red Hat Enterprise Linux 3(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (67, 4, 'Red Hat Enterprise Linux 3(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (68, 7, 'Open Enterprise Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (69, 7, 'Asianux 3(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (70, 7, 'Asianux 3(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (72, 2, 'Debian GNU/Linux 5(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (73, 2, 'Debian GNU/Linux 4(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (74, 2, 'Debian GNU/Linux 4(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (75, 7, 'Other 2.6x Linux (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (76, 7, 'Other 2.6x Linux (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (77, 8, 'Novell Netware 6.x'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (78, 8, 'Novell Netware 5.1'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (79, 9, 'Sun Solaris 10(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (80, 9, 'Sun Solaris 10(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (81, 9, 'Sun Solaris 9(Experimental)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (82, 9, 'Sun Solaris 8(Experimental)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (83, 9, 'FreeBSD (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (84, 9, 'FreeBSD (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (85, 9, 'SCO OpenServer 5'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (86, 9, 'SCO UnixWare 7'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (87, 6, 'Windows Server 2003 DataCenter Edition(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (88, 6, 'Windows Server 2003 DataCenter Edition(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (89, 6, 'Windows Server 2003 Standard Edition(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (90, 6, 'Windows Server 2003 Standard Edition(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (91, 6, 'Windows Server 2003 Web Edition'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (92, 6, 'Microsoft Small Bussiness Server 2003'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (93, 6, 'Windows XP (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (94, 6, 'Windows XP (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (95, 6, 'Windows 2000 Advanced Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (96, 5, 'SUSE Linux Enterprise 8(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (97, 5, 'SUSE Linux Enterprise 8(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (98, 7, 'Other Linux (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (99, 7, 'Other Linux (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (100, 10, 'Other Ubuntu (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (101, 6, 'Windows Vista (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (102, 6, 'DOS'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (103, 7, 'Other (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (104, 7, 'OS/2'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (105, 6, 'Windows 2000 Professional'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (106, 4, 'Red Hat Enterprise Linux 4(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (107, 5, 'SUSE Linux Enterprise 9(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (108, 5, 'SUSE Linux Enterprise 9(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (109, 5, 'SUSE Linux Enterprise 10(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (110, 5, 'SUSE Linux Enterprise 10(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (111, 1, 'CentOS 5.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (112, 1, 'CentOS 5.5 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (113, 4, 'Red Hat Enterprise Linux 5.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (114, 4, 'Red Hat Enterprise Linux 5.5 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (115, 4, 'Fedora 13'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (116, 4, 'Fedora 12'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (117, 4, 'Fedora 11'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (118, 4, 'Fedora 10'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (119, 4, 'Fedora 9'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (120, 4, 'Fedora 8'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (121, 10, 'Ubuntu 10.04 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (122, 10, 'Ubuntu 9.10 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (123, 10, 'Ubuntu 9.04 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (124, 10, 'Ubuntu 8.10 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (125, 10, 'Ubuntu 8.04 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (126, 10, 'Ubuntu 10.04 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (127, 10, 'Ubuntu 9.10 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (128, 10, 'Ubuntu 9.04 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (129, 10, 'Ubuntu 8.10 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (130, 10, 'Ubuntu 8.04 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (131, 4, 'Red Hat Enterprise Linux 2'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (132, 2, 'Debian GNU/Linux 6(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (133, 2, 'Debian GNU/Linux 6(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (134, 3, 'Oracle Enterprise Linux 5.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (135, 3, 'Oracle Enterprise Linux 5.5 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (136, 4, 'Red Hat Enterprise Linux 6.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (137, 4, 'Red Hat Enterprise Linux 6.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (138, 7, 'None'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (139, 7, 'Other PV (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (140, 7, 'Other PV (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (141, 1, 'CentOS 5.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (142, 1, 'CentOS 5.6 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (143, 1, 'CentOS 6.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (144, 1, 'CentOS 6.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (145, 3, 'Oracle Enterprise Linux 5.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (146, 3, 'Oracle Enterprise Linux 5.6 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (147, 3, 'Oracle Enterprise Linux 6.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (148, 3, 'Oracle Enterprise Linux 6.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (149, 4, 'Red Hat Enterprise Linux 5.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (150, 4, 'Red Hat Enterprise Linux 5.6 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (151, 5, 'SUSE Linux Enterprise Server 10 SP3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (152, 5, 'SUSE Linux Enterprise Server 10 SP4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (153, 5, 'SUSE Linux Enterprise Server 10 SP4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (154, 5, 'SUSE Linux Enterprise Server 11 SP1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (155, 5, 'SUSE Linux Enterprise Server 11 SP1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (156, 10, 'Ubuntu 10.10 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (157, 10, 'Ubuntu 10.10 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (158, 9, 'Sun Solaris 11 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (159, 9, 'Sun Solaris 11 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (160, 6, 'Windows PV'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (161, 1, 'CentOS 5.7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (162, 1, 'CentOS 5.7 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (1, UUID(), 1, 'CentOS 4.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (2, UUID(), 1, 'CentOS 4.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (3, UUID(), 1, 'CentOS 4.7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (4, UUID(), 1, 'CentOS 4.8 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (5, UUID(), 1, 'CentOS 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (6, UUID(), 1, 'CentOS 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (7, UUID(), 1, 'CentOS 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (8, UUID(), 1, 'CentOS 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (9, UUID(), 1, 'CentOS 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (10, UUID(), 1, 'CentOS 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (11, UUID(), 1, 'CentOS 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (12, UUID(), 1, 'CentOS 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (13, UUID(), 1, 'CentOS 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (14, UUID(), 1, 'CentOS 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (15, UUID(), 2, 'Debian GNU/Linux 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (16, UUID(), 3, 'Oracle Enterprise Linux 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (17, UUID(), 3, 'Oracle Enterprise Linux 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (18, UUID(), 3, 'Oracle Enterprise Linux 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (19, UUID(), 3, 'Oracle Enterprise Linux 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (20, UUID(), 3, 'Oracle Enterprise Linux 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (21, UUID(), 3, 'Oracle Enterprise Linux 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (22, UUID(), 3, 'Oracle Enterprise Linux 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (23, UUID(), 3, 'Oracle Enterprise Linux 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (24, UUID(), 3, 'Oracle Enterprise Linux 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (25, UUID(), 3, 'Oracle Enterprise Linux 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (26, UUID(), 4, 'Red Hat Enterprise Linux 4.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (27, UUID(), 4, 'Red Hat Enterprise Linux 4.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (28, UUID(), 4, 'Red Hat Enterprise Linux 4.7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (29, UUID(), 4, 'Red Hat Enterprise Linux 4.8 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (30, UUID(), 4, 'Red Hat Enterprise Linux 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (31, UUID(), 4, 'Red Hat Enterprise Linux 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (32, UUID(), 4, 'Red Hat Enterprise Linux 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (33, UUID(), 4, 'Red Hat Enterprise Linux 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (34, UUID(), 4, 'Red Hat Enterprise Linux 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (35, UUID(), 4, 'Red Hat Enterprise Linux 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (36, UUID(), 4, 'Red Hat Enterprise Linux 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (37, UUID(), 4, 'Red Hat Enterprise Linux 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (38, UUID(), 4, 'Red Hat Enterprise Linux 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (39, UUID(), 4, 'Red Hat Enterprise Linux 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (40, UUID(), 5, 'SUSE Linux Enterprise Server 9 SP4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (41, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (42, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (43, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (44, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (45, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (46, UUID(), 5, 'SUSE Linux Enterprise Server 11 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (47, UUID(), 5, 'SUSE Linux Enterprise Server 11 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (48, UUID(), 6, 'Windows 7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (49, UUID(), 6, 'Windows 7 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (50, UUID(), 6, 'Windows Server 2003 Enterprise Edition(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (51, UUID(), 6, 'Windows Server 2003 Enterprise Edition(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (52, UUID(), 6, 'Windows Server 2008 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (53, UUID(), 6, 'Windows Server 2008 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (54, UUID(), 6, 'Windows Server 2008 R2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (55, UUID(), 6, 'Windows 2000 Server SP4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (56, UUID(), 6, 'Windows Vista (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (57, UUID(), 6, 'Windows XP SP2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (58, UUID(), 6, 'Windows XP SP3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (59, UUID(), 10, 'Other Ubuntu (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (60, UUID(), 7, 'Other (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (61, UUID(), 6, 'Windows 2000 Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (62, UUID(), 6, 'Windows 98'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (63, UUID(), 6, 'Windows 95'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (64, UUID(), 6, 'Windows NT 4'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (65, UUID(), 6, 'Windows 3.1'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (66, UUID(), 4, 'Red Hat Enterprise Linux 3(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (67, UUID(), 4, 'Red Hat Enterprise Linux 3(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (68, UUID(), 7, 'Open Enterprise Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (69, UUID(), 7, 'Asianux 3(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (70, UUID(), 7, 'Asianux 3(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (72, UUID(), 2, 'Debian GNU/Linux 5(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (73, UUID(), 2, 'Debian GNU/Linux 4(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (74, UUID(), 2, 'Debian GNU/Linux 4(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (75, UUID(), 7, 'Other 2.6x Linux (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (76, UUID(), 7, 'Other 2.6x Linux (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (77, UUID(), 8, 'Novell Netware 6.x'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (78, UUID(), 8, 'Novell Netware 5.1'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (79, UUID(), 9, 'Sun Solaris 10(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (80, UUID(), 9, 'Sun Solaris 10(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (81, UUID(), 9, 'Sun Solaris 9(Experimental)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (82, UUID(), 9, 'Sun Solaris 8(Experimental)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (83, UUID(), 9, 'FreeBSD (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (84, UUID(), 9, 'FreeBSD (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (85, UUID(), 9, 'SCO OpenServer 5'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (86, UUID(), 9, 'SCO UnixWare 7'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (87, UUID(), 6, 'Windows Server 2003 DataCenter Edition(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (88, UUID(), 6, 'Windows Server 2003 DataCenter Edition(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (89, UUID(), 6, 'Windows Server 2003 Standard Edition(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (90, UUID(), 6, 'Windows Server 2003 Standard Edition(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (91, UUID(), 6, 'Windows Server 2003 Web Edition'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (92, UUID(), 6, 'Microsoft Small Bussiness Server 2003'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (93, UUID(), 6, 'Windows XP (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (94, UUID(), 6, 'Windows XP (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (95, UUID(), 6, 'Windows 2000 Advanced Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (96, UUID(), 5, 'SUSE Linux Enterprise 8(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (97, UUID(), 5, 'SUSE Linux Enterprise 8(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (98, UUID(), 7, 'Other Linux (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (99, UUID(), 7, 'Other Linux (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (100, UUID(), 10, 'Other Ubuntu (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (101, UUID(), 6, 'Windows Vista (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (102, UUID(), 6, 'DOS'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (103, UUID(), 7, 'Other (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (104, UUID(), 7, 'OS/2'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (105, UUID(), 6, 'Windows 2000 Professional'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (106, UUID(), 4, 'Red Hat Enterprise Linux 4(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (107, UUID(), 5, 'SUSE Linux Enterprise 9(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (108, UUID(), 5, 'SUSE Linux Enterprise 9(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (109, UUID(), 5, 'SUSE Linux Enterprise 10(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (110, UUID(), 5, 'SUSE Linux Enterprise 10(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (111, UUID(), 1, 'CentOS 5.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (112, UUID(), 1, 'CentOS 5.5 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (113, UUID(), 4, 'Red Hat Enterprise Linux 5.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (114, UUID(), 4, 'Red Hat Enterprise Linux 5.5 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (115, UUID(), 4, 'Fedora 13'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (116, UUID(), 4, 'Fedora 12'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (117, UUID(), 4, 'Fedora 11'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (118, UUID(), 4, 'Fedora 10'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (119, UUID(), 4, 'Fedora 9'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (120, UUID(), 4, 'Fedora 8'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (121, UUID(), 10, 'Ubuntu 10.04 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (122, UUID(), 10, 'Ubuntu 9.10 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (123, UUID(), 10, 'Ubuntu 9.04 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (124, UUID(), 10, 'Ubuntu 8.10 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (125, UUID(), 10, 'Ubuntu 8.04 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (126, UUID(), 10, 'Ubuntu 10.04 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (127, UUID(), 10, 'Ubuntu 9.10 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (128, UUID(), 10, 'Ubuntu 9.04 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (129, UUID(), 10, 'Ubuntu 8.10 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (130, UUID(), 10, 'Ubuntu 8.04 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (131, UUID(), 4, 'Red Hat Enterprise Linux 2'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (132, UUID(), 2, 'Debian GNU/Linux 6(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (133, UUID(), 2, 'Debian GNU/Linux 6(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (134, UUID(), 3, 'Oracle Enterprise Linux 5.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (135, UUID(), 3, 'Oracle Enterprise Linux 5.5 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (136, UUID(), 4, 'Red Hat Enterprise Linux 6.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (137, UUID(), 4, 'Red Hat Enterprise Linux 6.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (138, UUID(), 7, 'None'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (139, UUID(), 7, 'Other PV (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (140, UUID(), 7, 'Other PV (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (141, UUID(), 1, 'CentOS 5.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (142, UUID(), 1, 'CentOS 5.6 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (143, UUID(), 1, 'CentOS 6.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (144, UUID(), 1, 'CentOS 6.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (145, UUID(), 3, 'Oracle Enterprise Linux 5.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (146, UUID(), 3, 'Oracle Enterprise Linux 5.6 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (147, UUID(), 3, 'Oracle Enterprise Linux 6.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (148, UUID(), 3, 'Oracle Enterprise Linux 6.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (149, UUID(), 4, 'Red Hat Enterprise Linux 5.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (150, UUID(), 4, 'Red Hat Enterprise Linux 5.6 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (151, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (152, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (153, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (154, UUID(), 5, 'SUSE Linux Enterprise Server 11 SP1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (155, UUID(), 5, 'SUSE Linux Enterprise Server 11 SP1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (156, UUID(), 10, 'Ubuntu 10.10 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (157, UUID(), 10, 'Ubuntu 10.10 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (158, UUID(), 9, 'Sun Solaris 11 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (159, UUID(), 9, 'Sun Solaris 11 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (160, UUID(), 6, 'Windows PV'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (161, UUID(), 1, 'CentOS 5.7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (162, UUID(), 1, 'CentOS 5.7 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (200, 1, 'Other CentOS (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (201, 1, 'Other CentOS (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (202, 5, 'Other SUSE Linux(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, display_name) VALUES (203, 5, 'Other SUSE Linux(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (200, UUID(), 1, 'Other CentOS (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (201, UUID(), 1, 'Other CentOS (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (202, UUID(), 5, 'Other SUSE Linux(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (203, UUID(), 5, 'Other SUSE Linux(64-bit)'); INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.5 (32-bit)', 1); INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'CentOS 4.6 (32-bit)', 2); diff --git a/setup/db/templates.vmware.sql b/setup/db/templates.vmware.sql index 02d72986a50..845a720d1c3 100644 --- a/setup/db/templates.vmware.sql +++ b/setup/db/templates.vmware.sql @@ -15,85 +15,85 @@ -- specific language governing permissions and limitations -- under the License. -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (2, 'blank', 'BlankVM', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/blankvm.tar.bz2', '3eff7ce3d25cf9433efde8b245c63fcb', 0, 'BlankVM', 'VMDK', 47, 1, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (3, 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'ntfs', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/winxpsp3.tar.bz2', '385e67d17a2cb3795bd0b0fb7f88dc5e', 0, 'WindowsXP-SP3', 'VMDK', 16, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (2, UUID(), 'blank', 'BlankVM', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/blankvm.tar.bz2', '3eff7ce3d25cf9433efde8b245c63fcb', 0, 'BlankVM', 'VMDK', 47, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (3, UUID(), 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'ntfs', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/winxpsp3.tar.bz2', '385e67d17a2cb3795bd0b0fb7f88dc5e', 0, 'WindowsXP-SP3', 'VMDK', 16, 1, 1); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'Windows'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Linux'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (3, 'Novell Netware'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (4, 'Solaris'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (5, 'Other'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (1, UUID(), 'Windows'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (2, UUID(), 'Linux'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (3, UUID(), 'Novell Netware'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (4, UUID(), 'Solaris'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (5, UUID(), 'Other'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (1, 1, 'Microsoft Windows 7(32-bit)', 'Microsoft Windows 7(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (2, 1, 'Microsoft Windows 7(64-bit)', 'Microsoft Windows 7(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (3, 1, 'Microsoft Windows Server 2008 R2(64-bit)', 'Microsoft Windows Server 2008 R2(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (4, 1, 'Microsoft Windows Server 2008(32-bit)', 'Microsoft Windows Server 2008(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (5, 1, 'Microsoft Windows Server 2008(64-bit)', 'Windows Windows Server 2008(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (6, 1, 'Microsoft Windows Server 2003, Enterprise Edition (32-bit)', 'Microsoft Windows Server 2003, Enterprise Edition (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (7, 1, 'Microsoft Windows Server 2003, Enterprise Edition (64-bit)', 'Microsoft Windows Server 2003, Enterprise Edition (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (8, 1, 'Microsoft Windows Server 2003, Datacenter Edition (32-bit)', 'Microsoft Windows Server 2003, Datacenter Edition (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (9, 1, 'Microsoft Windows Server 2003, Datacenter Edition (64-bit)', 'Microsoft Windows Server 2003, Datacenter Edition (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (10, 1, 'Microsoft Windows Server 2003, Standard Edition (32-bit)', 'Microsoft Windows Server 2003, Standard Edition (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (11, 1, 'Microsoft Windows Server 2003, Standard Edition (64-bit)', 'Microsoft Windows Server 2003, Standard Edition (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (12, 1, 'Microsoft Windows Server 2003, Web Edition', 'Microsoft Windows Server 2003, Web Edition'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (13, 1, 'Microsoft Small Bussiness Server 2003', 'Microsoft Small Bussiness Server 2003'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (14, 1, 'Microsoft Windows Vista (32-bit)', 'Microsoft Windows Vista (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (15, 1, 'Microsoft Windows Vista (64-bit)', 'Microsoft Windows Vista (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (16, 1, 'Microsoft Windows XP Professional (32-bit)', 'Microsoft Windows XP Professional (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (17, 1, 'Microsoft Windows XP Professional (64-bit)', 'Microsoft Windows XP Professional (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (18, 1, 'Microsoft Windows 2000 Advanced Server', 'Microsoft Windows 2000 Advanced Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (19, 1, 'Microsoft Windows 2000 Server', 'Microsoft Windows 2000 Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (20, 1, 'Microsoft Windows 2000 Professional', 'Microsoft Windows 2000 Professional'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (21, 1, 'Microsoft Windows 98', 'Microsoft Windows 98'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (22, 1, 'Microsoft Windows 95', 'Microsoft Windows 95'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (23, 1, 'Microsoft Windows NT 4', 'Microsoft Windows NT 4'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (24, 1, 'Microsoft Windows 3.1', 'Microsoft Windows 3.1'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (1, UUID(), 1, 'Microsoft Windows 7(32-bit)', 'Microsoft Windows 7(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (2, UUID(), 1, 'Microsoft Windows 7(64-bit)', 'Microsoft Windows 7(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (3, UUID(), 1, 'Microsoft Windows Server 2008 R2(64-bit)', 'Microsoft Windows Server 2008 R2(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (4, UUID(), 1, 'Microsoft Windows Server 2008(32-bit)', 'Microsoft Windows Server 2008(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (5, UUID(), 1, 'Microsoft Windows Server 2008(64-bit)', 'Windows Windows Server 2008(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (6, UUID(), 1, 'Microsoft Windows Server 2003, Enterprise Edition (32-bit)', 'Microsoft Windows Server 2003, Enterprise Edition (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (7, UUID(), 1, 'Microsoft Windows Server 2003, Enterprise Edition (64-bit)', 'Microsoft Windows Server 2003, Enterprise Edition (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (8, UUID(), 1, 'Microsoft Windows Server 2003, Datacenter Edition (32-bit)', 'Microsoft Windows Server 2003, Datacenter Edition (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (9, UUID(), 1, 'Microsoft Windows Server 2003, Datacenter Edition (64-bit)', 'Microsoft Windows Server 2003, Datacenter Edition (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (10, UUID(), 1, 'Microsoft Windows Server 2003, Standard Edition (32-bit)', 'Microsoft Windows Server 2003, Standard Edition (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (11, UUID(), 1, 'Microsoft Windows Server 2003, Standard Edition (64-bit)', 'Microsoft Windows Server 2003, Standard Edition (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (12, UUID(), 1, 'Microsoft Windows Server 2003, Web Edition', 'Microsoft Windows Server 2003, Web Edition'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (13, UUID(), 1, 'Microsoft Small Bussiness Server 2003', 'Microsoft Small Bussiness Server 2003'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (14, UUID(), 1, 'Microsoft Windows Vista (32-bit)', 'Microsoft Windows Vista (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (15, UUID(), 1, 'Microsoft Windows Vista (64-bit)', 'Microsoft Windows Vista (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (16, UUID(), 1, 'Microsoft Windows XP Professional (32-bit)', 'Microsoft Windows XP Professional (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (17, UUID(), 1, 'Microsoft Windows XP Professional (64-bit)', 'Microsoft Windows XP Professional (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (18, UUID(), 1, 'Microsoft Windows 2000 Advanced Server', 'Microsoft Windows 2000 Advanced Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (19, UUID(), 1, 'Microsoft Windows 2000 Server', 'Microsoft Windows 2000 Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (20, UUID(), 1, 'Microsoft Windows 2000 Professional', 'Microsoft Windows 2000 Professional'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (21, UUID(), 1, 'Microsoft Windows 98', 'Microsoft Windows 98'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (22, UUID(), 1, 'Microsoft Windows 95', 'Microsoft Windows 95'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (23, UUID(), 1, 'Microsoft Windows NT 4', 'Microsoft Windows NT 4'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (24, UUID(), 1, 'Microsoft Windows 3.1', 'Microsoft Windows 3.1'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (25, 2, 'Red Hat Enterprise Linux 5(32-bit)', 'Red Hat Enterprise Linux 5(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (26, 2, 'Red Hat Enterprise Linux 5(64-bit)', 'Red Hat Enterprise Linux 5(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (27, 2, 'Red Hat Enterprise Linux 4(32-bit)', 'Red Hat Enterprise Linux 4(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (28, 2, 'Red Hat Enterprise Linux 4(64-bit)', 'Red Hat Enterprise Linux 4(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (29, 2, 'Red Hat Enterprise Linux 3(32-bit)', 'Red Hat Enterprise Linux 3(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (30, 2, 'Red Hat Enterprise Linux 3(64-bit)', 'Red Hat Enterprise Linux 3(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (31, 2, 'Red Hat Enterprise Linux 2', 'Red Hat Enterprise Linux 2'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (32, 2, 'Suse Linux Enterprise 11(32-bit)', 'Suse Linux Enterprise 11(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (33, 2, 'Suse Linux Enterprise 11(64-bit)', 'Suse Linux Enterprise 11(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (34, 2, 'Suse Linux Enterprise 10(32-bit)', 'Suse Linux Enterprise 10(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (35, 2, 'Suse Linux Enterprise 10(64-bit)', 'Suse Linux Enterprise 10(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (36, 2, 'Suse Linux Enterprise 8/9(32-bit)', 'Suse Linux Enterprise 8/9(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (37, 2, 'Suse Linux Enterprise 8/9(64-bit)', 'Suse Linux Enterprise 8/9(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (38, 2, 'Open Enterprise Server', 'Open Enterprise Server'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (39, 2, 'Asianux 3(32-bit)', 'Asianux 3(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (40, 2, 'Asianux 3(64-bit)', 'Asianux 3(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (41, 2, 'Debian GNU/Linux 5(32-bit)', 'Debian GNU/Linux 5(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (42, 2, 'Debian GNU/Linux 5(64-bit)', 'Debian GNU/Linux 5(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (43, 2, 'Debian GNU/Linux 4(32-bit)', 'Debian GNU/Linux 4(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (44, 2, 'Debian GNU/Linux 4(64-bit)', 'Debian GNU/Linux 4(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (45, 2, 'Ubuntu Linux (32-bit)', 'Ubuntu Linux (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (46, 2, 'Ubuntu Linux (64-bit)', 'Ubuntu Linux (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (47, 2, 'Other 2.6x Linux (32-bit)', 'Other 2.6x Linux (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (48, 2, 'Other 2.6x Linux (64-bit)', 'Other 2.6x Linux (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (49, 2, 'Other Linux (32-bit)', 'Other Linux (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (50, 2, 'Other Linux (64-bit)', 'Other Linux (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (25, UUID(), 2, 'Red Hat Enterprise Linux 5(32-bit)', 'Red Hat Enterprise Linux 5(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (26, UUID(), 2, 'Red Hat Enterprise Linux 5(64-bit)', 'Red Hat Enterprise Linux 5(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (27, UUID(), 2, 'Red Hat Enterprise Linux 4(32-bit)', 'Red Hat Enterprise Linux 4(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (28, UUID(), 2, 'Red Hat Enterprise Linux 4(64-bit)', 'Red Hat Enterprise Linux 4(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (29, UUID(), 2, 'Red Hat Enterprise Linux 3(32-bit)', 'Red Hat Enterprise Linux 3(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (30, UUID(), 2, 'Red Hat Enterprise Linux 3(64-bit)', 'Red Hat Enterprise Linux 3(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (31, UUID(), 2, 'Red Hat Enterprise Linux 2', 'Red Hat Enterprise Linux 2'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (32, UUID(), 2, 'Suse Linux Enterprise 11(32-bit)', 'Suse Linux Enterprise 11(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (33, UUID(), 2, 'Suse Linux Enterprise 11(64-bit)', 'Suse Linux Enterprise 11(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (34, UUID(), 2, 'Suse Linux Enterprise 10(32-bit)', 'Suse Linux Enterprise 10(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (35, UUID(), 2, 'Suse Linux Enterprise 10(64-bit)', 'Suse Linux Enterprise 10(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (36, UUID(), 2, 'Suse Linux Enterprise 8/9(32-bit)', 'Suse Linux Enterprise 8/9(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (37, UUID(), 2, 'Suse Linux Enterprise 8/9(64-bit)', 'Suse Linux Enterprise 8/9(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (38, UUID(), 2, 'Open Enterprise Server', 'Open Enterprise Server'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (39, UUID(), 2, 'Asianux 3(32-bit)', 'Asianux 3(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (40, UUID(), 2, 'Asianux 3(64-bit)', 'Asianux 3(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (41, UUID(), 2, 'Debian GNU/Linux 5(32-bit)', 'Debian GNU/Linux 5(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (42, UUID(), 2, 'Debian GNU/Linux 5(64-bit)', 'Debian GNU/Linux 5(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (43, UUID(), 2, 'Debian GNU/Linux 4(32-bit)', 'Debian GNU/Linux 4(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (44, UUID(), 2, 'Debian GNU/Linux 4(64-bit)', 'Debian GNU/Linux 4(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (45, UUID(), 2, 'Ubuntu Linux (32-bit)', 'Ubuntu Linux (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (46, UUID(), 2, 'Ubuntu Linux (64-bit)', 'Ubuntu Linux (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (47, UUID(), 2, 'Other 2.6x Linux (32-bit)', 'Other 2.6x Linux (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (48, UUID(), 2, 'Other 2.6x Linux (64-bit)', 'Other 2.6x Linux (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (49, UUID(), 2, 'Other Linux (32-bit)', 'Other Linux (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (50, UUID(), 2, 'Other Linux (64-bit)', 'Other Linux (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (51, 3, 'Novell Netware 6.x', 'Novell Netware 6.x'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (52, 3, 'Novell Netware 5.1', 'Novell Netware 5.1'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (51, UUID(), 3, 'Novell Netware 6.x', 'Novell Netware 6.x'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (52, UUID(), 3, 'Novell Netware 5.1', 'Novell Netware 5.1'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (53, 4, 'Sun Solaris 10(32-bit)', 'Sun Solaris 10(32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (54, 4, 'Sun Solaris 10(64-bit)', 'Sun Solaris 10(64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (55, 4, 'Sun Solaris 9(Experimental)', 'Sun Solaris 9(Experimental)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (56, 4, 'Sun Solaris 8(Experimental)', 'Sun Solaris 8(Experimental)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (53, UUID(), 4, 'Sun Solaris 10(32-bit)', 'Sun Solaris 10(32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (54, UUID(), 4, 'Sun Solaris 10(64-bit)', 'Sun Solaris 10(64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (55, UUID(), 4, 'Sun Solaris 9(Experimental)', 'Sun Solaris 9(Experimental)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (56, UUID(), 4, 'Sun Solaris 8(Experimental)', 'Sun Solaris 8(Experimental)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (57, 5, 'FreeBSD (32-bit)', 'FreeBSD (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (58, 5, 'FreeBSD (64-bit)', 'FreeBSD (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (59, 5, 'OS/2', 'OS/2'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (60, 5, 'SCO OpenServer 5', 'SCO OpenServer 5'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (61, 5, 'SCO UnixWare 7', 'SCO UnixWare 7'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (62, 5, 'DOS', 'DOS'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (63, 5, 'Other (32-bit)', 'Other (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (64, 5, 'Other (64-bit)', 'Other (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (57, UUID(), 5, 'FreeBSD (32-bit)', 'FreeBSD (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (58, UUID(), 5, 'FreeBSD (64-bit)', 'FreeBSD (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (59, UUID(), 5, 'OS/2', 'OS/2'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (60, UUID(), 5, 'SCO OpenServer 5', 'SCO OpenServer 5'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (61, UUID(), 5, 'SCO UnixWare 7', 'SCO UnixWare 7'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (62, UUID(), 5, 'DOS', 'DOS'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (63, UUID(), 5, 'Other (32-bit)', 'Other (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (64, UUID(), 5, 'Other (64-bit)', 'Other (64-bit)'); -- temporarily added for vmware, will be moved when vmware support is fully in-place diff --git a/setup/db/templates.xenserver.sql b/setup/db/templates.xenserver.sql index c8b6d6d3718..a44d42bb19a 100644 --- a/setup/db/templates.xenserver.sql +++ b/setup/db/templates.xenserver.sql @@ -15,91 +15,91 @@ -- specific language governing permissions and limitations -- under the License. -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.2/systemvm.vhd.bz2', 'bcc7f290f4c27ab4d0fe95d1012829ea', 0, 'SystemVM Template', 'VHD', 15, 0, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (2, 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI(Xenserver)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 12, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (1, UUID(), 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/releases/2.2/systemvm.vhd.bz2', 'bcc7f290f4c27ab4d0fe95d1012829ea', 0, 'SystemVM Template', 'VHD', 15, 0, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (2, UUID(), 'centos53-x86_64', 'CentOS 5.3(x86_64) no GUI(Xenserver)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', 'b63d854a9560c013142567bbae8d98cf', 0, 'CentOS 5.3(x86_64) no GUI', 'VHD', 12, 1, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) - VALUES (3, 'routing', 'DomR Template(KVM)', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/a88232bf-6a18-38e7-aeee-c1702725079f.qcow2.bz2', 'e39c55e93ae96bd43bfd588ca6ee3269', 'DomR Template', 0, 'QCOW2', 21, 0, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) - VALUES (4, 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI(KVM)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 9, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) + VALUES (3, UUID(), 'routing', 'DomR Template(KVM)', 0, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/a88232bf-6a18-38e7-aeee-c1702725079f.qcow2.bz2', 'e39c55e93ae96bd43bfd588ca6ee3269', 'DomR Template', 0, 'QCOW2', 21, 0, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones) + VALUES (4, UUID(), 'centos55-x86_64', 'CentOS 5.5(x86_64) no GUI(KVM)', 1, now(), 'ext3', 0, 64, 1, 'http://download.cloud.com/templates/builtin/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', '1da20ae69b54f761f3f733dce97adcc0', 'CentOS 5.5(x86_64) no GUI', 0, 'QCOW2', 9, 1, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (5, 'blank', 'BlankVM', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/blankvm.tar.bz2', '3eff7ce3d25cf9433efde8b245c63fcb', 0, 'BlankVM', 'VMDK', 47, 1, 1); -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) - VALUES (6, 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'ntfs', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/winxpsp3.tar.bz2', '385e67d17a2cb3795bd0b0fb7f88dc5e', 0, 'WindowsXP-SP3', 'VMDK', 16, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (5, UUID(), 'blank', 'BlankVM', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/blankvm.tar.bz2', '3eff7ce3d25cf9433efde8b245c63fcb', 0, 'BlankVM', 'VMDK', 47, 1, 1); +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones) + VALUES (6, UUID(), 'winxpsp3', 'WindowsXP-SP3', 1, now(), 'ntfs', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/winxpsp3.tar.bz2', '385e67d17a2cb3795bd0b0fb7f88dc5e', 0, 'WindowsXP-SP3', 'VMDK', 16, 1, 1); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (3, 'Oracle'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (4, 'RedHat'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (5, 'SUSE'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (6, 'Windows'); -INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (7, 'Other'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (1, UUID(), 'CentOS'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (2, UUID(), 'Debian'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (3, UUID(), 'Oracle'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (4, UUID(), 'RedHat'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (5, UUID(), 'SUSE'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (6, UUID(), 'Windows'); +INSERT INTO `cloud`.`guest_os_category` (id, uuid, name) VALUES (7, UUID(), 'Other'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (1, 1, 'CentOS 4.5 (32-bit)', 'CentOS 4.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (2, 1, 'CentOS 4.6 (32-bit)', 'CentOS 4.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (3, 1, 'CentOS 4.7 (32-bit)', 'CentOS 4.7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (4, 1, 'CentOS 4.8 (32-bit)', 'CentOS 4.8 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (5, 1, 'CentOS 5.0 (32-bit)', 'CentOS 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (6, 1, 'CentOS 5.0 (64-bit)', 'CentOS 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (7, 1, 'CentOS 5.1 (32-bit)', 'CentOS 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (8, 1, 'CentOS 5.1 (64-bit)', 'CentOS 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (9, 1, 'CentOS 5.2 (32-bit)', 'CentOS 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (10, 1, 'CentOS 5.2 (64-bit)', 'CentOS 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (11, 1, 'CentOS 5.3 (32-bit)', 'CentOS 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (12, 1, 'CentOS 5.3 (64-bit)', 'CentOS 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (13, 1, 'CentOS 5.4 (32-bit)', 'CentOS 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (14, 1, 'CentOS 5.4 (64-bit)', 'CentOS 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (15, 2, 'Debian Lenny 5.0 (32-bit)', 'Debian Lenny 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (16, 3, 'Oracle Enterprise Linux 5.0 (32-bit)', 'Oracle Enterprise Linux 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (17, 3, 'Oracle Enterprise Linux 5.0 (64-bit)', 'Oracle Enterprise Linux 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (18, 3, 'Oracle Enterprise Linux 5.1 (32-bit)', 'Oracle Enterprise Linux 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (19, 3, 'Oracle Enterprise Linux 5.1 (64-bit)', 'Oracle Enterprise Linux 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (20, 3, 'Oracle Enterprise Linux 5.2 (32-bit)', 'Oracle Enterprise Linux 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (21, 3, 'Oracle Enterprise Linux 5.2 (64-bit)', 'Oracle Enterprise Linux 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (22, 3, 'Oracle Enterprise Linux 5.3 (32-bit)', 'Oracle Enterprise Linux 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (23, 3, 'Oracle Enterprise Linux 5.3 (64-bit)', 'Oracle Enterprise Linux 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (24, 3, 'Oracle Enterprise Linux 5.4 (32-bit)', 'Oracle Enterprise Linux 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (25, 3, 'Oracle Enterprise Linux 5.4 (64-bit)', 'Oracle Enterprise Linux 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (26, 4, 'Red Hat Enterprise Linux 4.5 (32-bit)', 'Red Hat Enterprise Linux 4.5 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (27, 4, 'Red Hat Enterprise Linux 4.6 (32-bit)', 'Red Hat Enterprise Linux 4.6 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (28, 4, 'Red Hat Enterprise Linux 4.7 (32-bit)', 'Red Hat Enterprise Linux 4.7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (29, 4, 'Red Hat Enterprise Linux 4.8 (32-bit)', 'Red Hat Enterprise Linux 4.8 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (30, 4, 'Red Hat Enterprise Linux 5.0 (32-bit)', 'Red Hat Enterprise Linux 5.0 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (31, 4, 'Red Hat Enterprise Linux 5.0 (64-bit)', 'Red Hat Enterprise Linux 5.0 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (32, 4, 'Red Hat Enterprise Linux 5.1 (32-bit)', 'Red Hat Enterprise Linux 5.1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (33, 4, 'Red Hat Enterprise Linux 5.1 (64-bit)', 'Red Hat Enterprise Linux 5.1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (34, 4, 'Red Hat Enterprise Linux 5.2 (32-bit)', 'Red Hat Enterprise Linux 5.2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (35, 4, 'Red Hat Enterprise Linux 5.2 (64-bit)', 'Red Hat Enterprise Linux 5.2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (36, 4, 'Red Hat Enterprise Linux 5.3 (32-bit)', 'Red Hat Enterprise Linux 5.3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (37, 4, 'Red Hat Enterprise Linux 5.3 (64-bit)', 'Red Hat Enterprise Linux 5.3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (38, 4, 'Red Hat Enterprise Linux 5.4 (32-bit)', 'Red Hat Enterprise Linux 5.4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (39, 4, 'Red Hat Enterprise Linux 5.4 (64-bit)', 'Red Hat Enterprise Linux 5.4 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (40, 5, 'SUSE Linux Enterprise Server 9 SP4 (32-bit)', 'SUSE Linux Enterprise Server 9 SP4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (41, 5, 'SUSE Linux Enterprise Server 10 SP1 (32-bit)', 'SUSE Linux Enterprise Server 10 SP1 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (42, 5, 'SUSE Linux Enterprise Server 10 SP1 (64-bit)', 'SUSE Linux Enterprise Server 10 SP1 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (43, 5, 'SUSE Linux Enterprise Server 10 SP2 (32-bit)', 'SUSE Linux Enterprise Server 10 SP2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (44, 5, 'SUSE Linux Enterprise Server 10 SP2 (64-bit)', 'SUSE Linux Enterprise Server 10 SP2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (45, 5, 'SUSE Linux Enterprise Server 10 SP3 (64-bit)', 'SUSE Linux Enterprise Server 10 SP3 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (46, 5, 'SUSE Linux Enterprise Server 11 (32-bit)', 'SUSE Linux Enterprise Server 11 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (47, 5, 'SUSE Linux Enterprise Server 11 (64-bit)', 'SUSE Linux Enterprise Server 11 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (48, 6, 'Windows 7 (32-bit)', 'Windows 7 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (49, 6, 'Windows 7 (64-bit)', 'Windows 7 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (50, 6, 'Windows Server 2003 (32-bit)', 'Windows Server 2003 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (51, 6, 'Windows Server 2003 (64-bit)', 'Windows Server 2003 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (52, 6, 'Windows Server 2008 (32-bit)', 'Windows Server 2008 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (53, 6, 'Windows Server 2008 (64-bit)', 'Windows Server 2008 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (54, 6, 'Windows Server 2008 R2 (64-bit)', 'Windows Server 2008 R2 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (55, 6, 'Windows 2000 SP4 (32-bit)', 'Windows 2000 SP4 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (56, 6, 'Windows Vista (32-bit)', 'Windows Vista (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (57, 6, 'Windows XP SP2 (32-bit)', 'Windows XP SP2 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (58, 6, 'Windows XP SP3 (32-bit)', 'Windows XP SP3 (32-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (59, 7, 'Other install media', 'Ubuntu'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (60, 7, 'Other install media', 'Other'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (61, 2, 'Ubuntu 10.04 (64-bit)', 'Ubuntu 10.04 (64-bit)'); -INSERT INTO `cloud`.`guest_os` (id, category_id, name, display_name) VALUES (62, 2, 'Ubuntu 10.04 (32-bit)', 'Ubuntu 10.04 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (1, UUID(), 1, 'CentOS 4.5 (32-bit)', 'CentOS 4.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (2, UUID(), 1, 'CentOS 4.6 (32-bit)', 'CentOS 4.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (3, UUID(), 1, 'CentOS 4.7 (32-bit)', 'CentOS 4.7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (4, UUID(), 1, 'CentOS 4.8 (32-bit)', 'CentOS 4.8 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (5, UUID(), 1, 'CentOS 5.0 (32-bit)', 'CentOS 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (6, UUID(), 1, 'CentOS 5.0 (64-bit)', 'CentOS 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (7, UUID(), 1, 'CentOS 5.1 (32-bit)', 'CentOS 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (8, UUID(), 1, 'CentOS 5.1 (64-bit)', 'CentOS 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (9, UUID(), 1, 'CentOS 5.2 (32-bit)', 'CentOS 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (10, UUID(), 1, 'CentOS 5.2 (64-bit)', 'CentOS 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (11, UUID(), 1, 'CentOS 5.3 (32-bit)', 'CentOS 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (12, UUID(), 1, 'CentOS 5.3 (64-bit)', 'CentOS 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (13, UUID(), 1, 'CentOS 5.4 (32-bit)', 'CentOS 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (14, UUID(), 1, 'CentOS 5.4 (64-bit)', 'CentOS 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (15, UUID(), 2, 'Debian Lenny 5.0 (32-bit)', 'Debian Lenny 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (16, UUID(), 3, 'Oracle Enterprise Linux 5.0 (32-bit)', 'Oracle Enterprise Linux 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (17, UUID(), 3, 'Oracle Enterprise Linux 5.0 (64-bit)', 'Oracle Enterprise Linux 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (18, UUID(), 3, 'Oracle Enterprise Linux 5.1 (32-bit)', 'Oracle Enterprise Linux 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (19, UUID(), 3, 'Oracle Enterprise Linux 5.1 (64-bit)', 'Oracle Enterprise Linux 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (20, UUID(), 3, 'Oracle Enterprise Linux 5.2 (32-bit)', 'Oracle Enterprise Linux 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (21, UUID(), 3, 'Oracle Enterprise Linux 5.2 (64-bit)', 'Oracle Enterprise Linux 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (22, UUID(), 3, 'Oracle Enterprise Linux 5.3 (32-bit)', 'Oracle Enterprise Linux 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (23, UUID(), 3, 'Oracle Enterprise Linux 5.3 (64-bit)', 'Oracle Enterprise Linux 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (24, UUID(), 3, 'Oracle Enterprise Linux 5.4 (32-bit)', 'Oracle Enterprise Linux 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (25, UUID(), 3, 'Oracle Enterprise Linux 5.4 (64-bit)', 'Oracle Enterprise Linux 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (26, UUID(), 4, 'Red Hat Enterprise Linux 4.5 (32-bit)', 'Red Hat Enterprise Linux 4.5 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (27, UUID(), 4, 'Red Hat Enterprise Linux 4.6 (32-bit)', 'Red Hat Enterprise Linux 4.6 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (28, UUID(), 4, 'Red Hat Enterprise Linux 4.7 (32-bit)', 'Red Hat Enterprise Linux 4.7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (29, UUID(), 4, 'Red Hat Enterprise Linux 4.8 (32-bit)', 'Red Hat Enterprise Linux 4.8 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (30, UUID(), 4, 'Red Hat Enterprise Linux 5.0 (32-bit)', 'Red Hat Enterprise Linux 5.0 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (31, UUID(), 4, 'Red Hat Enterprise Linux 5.0 (64-bit)', 'Red Hat Enterprise Linux 5.0 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (32, UUID(), 4, 'Red Hat Enterprise Linux 5.1 (32-bit)', 'Red Hat Enterprise Linux 5.1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (33, UUID(), 4, 'Red Hat Enterprise Linux 5.1 (64-bit)', 'Red Hat Enterprise Linux 5.1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (34, UUID(), 4, 'Red Hat Enterprise Linux 5.2 (32-bit)', 'Red Hat Enterprise Linux 5.2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (35, UUID(), 4, 'Red Hat Enterprise Linux 5.2 (64-bit)', 'Red Hat Enterprise Linux 5.2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (36, UUID(), 4, 'Red Hat Enterprise Linux 5.3 (32-bit)', 'Red Hat Enterprise Linux 5.3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (37, UUID(), 4, 'Red Hat Enterprise Linux 5.3 (64-bit)', 'Red Hat Enterprise Linux 5.3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (38, UUID(), 4, 'Red Hat Enterprise Linux 5.4 (32-bit)', 'Red Hat Enterprise Linux 5.4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (39, UUID(), 4, 'Red Hat Enterprise Linux 5.4 (64-bit)', 'Red Hat Enterprise Linux 5.4 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (40, UUID(), 5, 'SUSE Linux Enterprise Server 9 SP4 (32-bit)', 'SUSE Linux Enterprise Server 9 SP4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (41, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP1 (32-bit)', 'SUSE Linux Enterprise Server 10 SP1 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (42, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP1 (64-bit)', 'SUSE Linux Enterprise Server 10 SP1 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (43, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP2 (32-bit)', 'SUSE Linux Enterprise Server 10 SP2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (44, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP2 (64-bit)', 'SUSE Linux Enterprise Server 10 SP2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (45, UUID(), 5, 'SUSE Linux Enterprise Server 10 SP3 (64-bit)', 'SUSE Linux Enterprise Server 10 SP3 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (46, UUID(), 5, 'SUSE Linux Enterprise Server 11 (32-bit)', 'SUSE Linux Enterprise Server 11 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (47, UUID(), 5, 'SUSE Linux Enterprise Server 11 (64-bit)', 'SUSE Linux Enterprise Server 11 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (48, UUID(), 6, 'Windows 7 (32-bit)', 'Windows 7 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (49, UUID(), 6, 'Windows 7 (64-bit)', 'Windows 7 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (50, UUID(), 6, 'Windows Server 2003 (32-bit)', 'Windows Server 2003 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (51, UUID(), 6, 'Windows Server 2003 (64-bit)', 'Windows Server 2003 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (52, UUID(), 6, 'Windows Server 2008 (32-bit)', 'Windows Server 2008 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (53, UUID(), 6, 'Windows Server 2008 (64-bit)', 'Windows Server 2008 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (54, UUID(), 6, 'Windows Server 2008 R2 (64-bit)', 'Windows Server 2008 R2 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (55, UUID(), 6, 'Windows 2000 SP4 (32-bit)', 'Windows 2000 SP4 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (56, UUID(), 6, 'Windows Vista (32-bit)', 'Windows Vista (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (57, UUID(), 6, 'Windows XP SP2 (32-bit)', 'Windows XP SP2 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (58, UUID(), 6, 'Windows XP SP3 (32-bit)', 'Windows XP SP3 (32-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (59, UUID(), 7, 'Other install media', 'Ubuntu'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (60, UUID(), 7, 'Other install media', 'Other'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (61, UUID(), 2, 'Ubuntu 10.04 (64-bit)', 'Ubuntu 10.04 (64-bit)'); +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, name, display_name) VALUES (62, UUID(), 2, 'Ubuntu 10.04 (32-bit)', 'Ubuntu 10.04 (32-bit)'); -- temporarily added for vmware, will be moved when vmware support is fully in-place INSERT INTO `cloud`.`host_master`(`type`, `service_address`, `admin`, `password`) VALUES('VSphere', '192.168.90.238', 'Administrator', 'Suite219'); From db297a338f8a96350c99a4316953cf3631728cd3 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 18:36:31 -0800 Subject: [PATCH 06/19] utils: Reflection utilities to get cmd, annotation and fields Signed-off-by: Rohit Yadav --- utils/pom.xml | 5 ++ utils/src/com/cloud/utils/ReflectUtil.java | 63 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/utils/pom.xml b/utils/pom.xml index c91688812f0..87c078a7a61 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -146,6 +146,11 @@ ${cs.commons-io.version} provided + + org.reflections + reflections + ${cs.reflections.version} + install diff --git a/utils/src/com/cloud/utils/ReflectUtil.java b/utils/src/com/cloud/utils/ReflectUtil.java index f1d1409ee7d..09447059fe6 100755 --- a/utils/src/com/cloud/utils/ReflectUtil.java +++ b/utils/src/com/cloud/utils/ReflectUtil.java @@ -16,10 +16,14 @@ // under the License. package com.cloud.utils; +import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; import com.cloud.utils.exception.CloudRuntimeException; +import org.reflections.Reflections; public class ReflectUtil { public static Pair, Field> getAnyField(Class clazz, String fieldName) { @@ -50,4 +54,63 @@ public class ReflectUtil { return null; } + // Gets all classes with some annotation from a package + public static Set> getClassesWithAnnotation(Class annotation, + String[] packageNames) { + Reflections reflections; + Set> classes = new HashSet>(); + for(String packageName: packageNames) { + reflections = new Reflections(packageName); + classes.addAll(reflections.getTypesAnnotatedWith(annotation)); + } + return classes; + } + + // Checks against posted search classes if cmd is async + public static boolean isCmdClassAsync(Class cmdClass, + Class[] searchClasses) { + boolean isAsync = false; + Class superClass = cmdClass; + + while (superClass != null && superClass != Object.class) { + String superName = superClass.getName(); + for (Class baseClass: searchClasses) { + if (superName.equals(baseClass.getName())) { + isAsync = true; + break; + } + } + if (isAsync) + break; + superClass = superClass.getSuperclass(); + } + return isAsync; + } + + // Returns all fields across the base class for a cmd + public static Field[] getAllFieldsForClass(Class cmdClass, + Class[] searchClasses) { + Field[] fields = cmdClass.getDeclaredFields(); + Class superClass = cmdClass.getSuperclass(); + + while (superClass != null && superClass != Object.class) { + String superName = superClass.getName(); + for (Class baseClass: searchClasses) { + if(!baseClass.isAssignableFrom(superClass)) + continue; + if (!superName.equals(baseClass.getName())) { + Field[] superClassFields = superClass.getDeclaredFields(); + if (superClassFields != null) { + Field[] tmpFields = new Field[fields.length + superClassFields.length]; + System.arraycopy(fields, 0, tmpFields, 0, fields.length); + System.arraycopy(superClassFields, 0, tmpFields, fields.length, superClassFields.length); + fields = tmpFields; + } + } + } + superClass = superClass.getSuperclass(); + } + return fields; + } + } From 539d94b4a68b1a161ac2ea3cf633b50d9299013b Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 18:37:54 -0800 Subject: [PATCH 07/19] ApiXmlDocWriter: Reuse methods from ReflectUtil Signed-off-by: Rohit Yadav --- .../com/cloud/api/doc/ApiXmlDocWriter.java | 45 +++++++------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java index b493ec4b29c..84851c389ad 100644 --- a/server/src/com/cloud/api/doc/ApiXmlDocWriter.java +++ b/server/src/com/cloud/api/doc/ApiXmlDocWriter.java @@ -28,6 +28,7 @@ import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import com.cloud.utils.ReflectUtil; import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -79,13 +80,15 @@ public class ApiXmlDocWriter { } public static void main(String[] args) { - // Populate api name and cmd class mappings - Reflections reflections = new Reflections("org.apache.cloudstack.api"); - Set> cmdClasses = reflections.getTypesAnnotatedWith(APICommand.class); - reflections = new Reflections("com.cloud.api"); - cmdClasses.addAll(reflections.getTypesAnnotatedWith(APICommand.class)); + + Set> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, new String[]{"org.apache.cloudstack.api", "com.cloud.api"}); + for(Class cmdClass: cmdClasses) { String apiName = cmdClass.getAnnotation(APICommand.class).name(); + if (_apiNameCmdClassMap.containsKey(apiName)) { + System.out.println("Warning, API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName); + continue; + } _apiNameCmdClassMap.put(apiName, cmdClass); } @@ -340,33 +343,15 @@ public class ApiXmlDocWriter { if(!impl.since().isEmpty()){ apiCommand.setSinceVersion(impl.since()); } - - // Set request parameters - Field[] fields = clas.getDeclaredFields(); - // Get fields from superclass - Class superClass = clas.getSuperclass(); - boolean isAsync = false; - while (superClass != null && superClass != Object.class) { - String superName = superClass.getName(); - if (!superName.equals(BaseCmd.class.getName()) && !superName.equals(BaseAsyncCmd.class.getName()) && !superName.equals(BaseAsyncCreateCmd.class.getName())) { - Field[] superClassFields = superClass.getDeclaredFields(); - if (superClassFields != null) { - Field[] tmpFields = new Field[fields.length + superClassFields.length]; - System.arraycopy(fields, 0, tmpFields, 0, fields.length); - System.arraycopy(superClassFields, 0, tmpFields, fields.length, superClassFields.length); - fields = tmpFields; - } - } - superClass = superClass.getSuperclass(); - // Set Async information for the command - if (superName.equals(BaseAsyncCmd.class.getName()) || superName.equals(BaseAsyncCreateCmd.class.getName())) { - isAsync = true; - } - } - + boolean isAsync = ReflectUtil.isCmdClassAsync(clas, + new Class[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); + apiCommand.setAsync(isAsync); - + + Field[] fields = ReflectUtil.getAllFieldsForClass(clas, + new Class[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); + request = setRequestFields(fields); // Get response parameters From d76027194578ab7b12ec33aa8738abec1e9c8fa3 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 18:43:45 -0800 Subject: [PATCH 08/19] ApiDispatcher: Get rid of reflections, reuse utils' ReflectUtil Signed-off-by: Rohit Yadav --- server/pom.xml | 5 ----- server/src/com/cloud/api/ApiDispatcher.java | 16 +++------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/server/pom.xml b/server/pom.xml index 9e6bc68f8f6..64bd2a206da 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -80,11 +80,6 @@ tests test - - org.reflections - reflections - 0.9.8 - install diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 60d883677cd..fa9114e3ff7 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -31,6 +31,7 @@ import java.util.StringTokenizer; import java.util.regex.Matcher; import com.cloud.dao.EntityManager; +import com.cloud.utils.ReflectUtil; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.acl.Role; @@ -374,19 +375,8 @@ public class ApiDispatcher { } } - // Process all the fields of the cmd object using reflection to recursively process super class - Field[] fields = cmd.getClass().getDeclaredFields(); - Class superClass = cmd.getClass().getSuperclass(); - while (BaseCmd.class.isAssignableFrom(superClass)) { - Field[] superClassFields = superClass.getDeclaredFields(); - if (superClassFields != null) { - Field[] tmpFields = new Field[fields.length + superClassFields.length]; - System.arraycopy(fields, 0, tmpFields, 0, fields.length); - System.arraycopy(superClassFields, 0, tmpFields, fields.length, superClassFields.length); - fields = tmpFields; - } - superClass = superClass.getSuperclass(); - } + Field[] fields = ReflectUtil.getAllFieldsForClass(cmd.getClass(), + new Class[] {BaseCmd.class}); for (Field field : fields) { PlugService plugServiceAnnotation = field.getAnnotation(PlugService.class); From 0482734e2fc328e97a376d606338ab630d5759bc Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 18:44:20 -0800 Subject: [PATCH 09/19] maven: Use reflections 0.9.8 Reflections is compatbile to APL at the time of commit Signed-off-by: Rohit Yadav --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 59e3bac1912..1dcf36fe7ed 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,7 @@ 1.3.21.1 2.6 1.4 + 0.9.8 From 2c04dad529ff9b67f78d86316a9e1f6e93d503a4 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 18:48:18 -0800 Subject: [PATCH 10/19] ApiDiscovery: New plugin to help discover apis on mgmt server - Introduces api/discovery plugin that helps discover apis on the mgmt server - It's a pluggable service, therefore has it's own api-discovery_commands.properties where the discovery api, listApi can be blacklisted (by removing it), or it's role mask can be changed - By default its response has all the apis - Changes in other parts of the code to make it work, viz. components.xml, pom.xml, and in ApiServer where it is used as an adapter to get apiname, cmd mappings The ApiDiscoveryService interface is a contract that the implementing class will provide: 1. A means to get all the apis as a list of response, plugin is free to implement the response class, as long as it extends on the BaseResponse: ListResponse listApis(); 2. Provides a map of apiname as the key and cmd class as the value: Map> getApiNameCmdClassMapping(); Signed-off-by: Rohit Yadav --- .../apache/cloudstack/api/ApiConstants.java | 5 + .../discovery/ApiDiscoveryService.java | 29 ++++ client/pom.xml | 5 + .../api-discovery_commands.properties.in | 23 +++ client/tomcatconf/components.xml.in | 4 + plugins/api/discovery/pom.xml | 44 ++++++ .../command/user/discovery/ListApisCmd.java | 55 +++++++ .../api/response/ApiDiscoveryResponse.java | 75 +++++++++ .../api/response/ApiParameterResponse.java | 70 +++++++++ .../discovery/ApiDiscoveryServiceImpl.java | 144 ++++++++++++++++++ plugins/pom.xml | 1 + server/src/com/cloud/api/ApiServer.java | 18 +-- 12 files changed, 462 insertions(+), 11 deletions(-) create mode 100644 api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java create mode 100644 client/tomcatconf/api-discovery_commands.properties.in create mode 100644 plugins/api/discovery/pom.xml create mode 100644 plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java create mode 100644 plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java create mode 100644 plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java create mode 100644 plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index 6d8400ae6fd..b4ce24c2bc9 100644 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -91,6 +91,7 @@ public class ApiConstants { public static final String INTERVAL_TYPE = "intervaltype"; public static final String IP_ADDRESS = "ipaddress"; public static final String IP_ADDRESS_ID = "ipaddressid"; + public static final String IS_ASYNC = "isasync"; public static final String IP_AVAILABLE = "ipavailable"; public static final String IP_LIMIT = "iplimit"; public static final String IP_TOTAL = "iptotal"; @@ -106,6 +107,7 @@ public class ApiConstants { public static final String JOB_STATUS = "jobstatus"; public static final String LASTNAME = "lastname"; public static final String LEVEL = "level"; + public static final String LENGTH = "length"; public static final String LIMIT_CPU_USE = "limitcpuuse"; public static final String LOCK = "lock"; public static final String LUN = "lun"; @@ -126,6 +128,7 @@ public class ApiConstants { public static final String OP = "op"; public static final String OS_CATEGORY_ID = "oscategoryid"; public static final String OS_TYPE_ID = "ostypeid"; + public static final String PARAMS = "params"; public static final String PARENT_DOMAIN_ID = "parentdomainid"; public static final String PASSWORD = "password"; public static final String NEW_PASSWORD = "new_password"; @@ -159,6 +162,7 @@ public class ApiConstants { public static final String SCHEDULE = "schedule"; public static final String SCOPE = "scope"; public static final String SECRET_KEY = "usersecretkey"; + public static final String SINCE = "since"; public static final String KEY = "key"; public static final String SEARCH_BASE = "searchbase"; public static final String SECURITY_GROUP_IDS = "securitygroupids"; @@ -324,6 +328,7 @@ public class ApiConstants { public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported"; public static final String RESOURCE_STATE = "resourcestate"; public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired"; + public static final String REQUIRED = "required"; public static final String RESTART_REQUIRED = "restartrequired"; public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects"; public static final String CONSERVE_MODE = "conservemode"; diff --git a/api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java b/api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java new file mode 100644 index 00000000000..12206949db3 --- /dev/null +++ b/api/src/org/apache/cloudstack/discovery/ApiDiscoveryService.java @@ -0,0 +1,29 @@ +// 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 +// with 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 org.apache.cloudstack.discovery; + +import com.cloud.utils.component.Adapter; +import com.cloud.utils.component.PluggableService; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.response.ListResponse; + +import java.util.Map; + +public interface ApiDiscoveryService extends Adapter, PluggableService { + ListResponse listApis(); + Map> getApiNameCmdClassMapping(); +} diff --git a/client/pom.xml b/client/pom.xml index b703cbe966f..1bbae1f7d08 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -30,6 +30,11 @@ cloud-plugin-acl-static-role-based ${project.version} + + org.apache.cloudstack + cloud-plugin-api-discovery + ${project.version} + org.apache.cloudstack cloud-plugin-user-authenticator-ldap diff --git a/client/tomcatconf/api-discovery_commands.properties.in b/client/tomcatconf/api-discovery_commands.properties.in new file mode 100644 index 00000000000..49ddfde42d8 --- /dev/null +++ b/client/tomcatconf/api-discovery_commands.properties.in @@ -0,0 +1,23 @@ +# 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 +# with 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. + +# bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = +# RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER +# Please standardize naming conventions to camel-case (even for acronyms). + +# CloudStack API Discovery service command +listApis=15 diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in index a7378bd9f49..b9feed15a88 100755 --- a/client/tomcatconf/components.xml.in +++ b/client/tomcatconf/components.xml.in @@ -56,6 +56,9 @@ under the License. + + + @@ -177,6 +180,7 @@ under the License. + diff --git a/plugins/api/discovery/pom.xml b/plugins/api/discovery/pom.xml new file mode 100644 index 00000000000..a61b275addc --- /dev/null +++ b/plugins/api/discovery/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + cloud-plugin-api-discovery + Apache CloudStack Plugin - API Discovery + + org.apache.cloudstack + cloudstack-plugins + 4.1.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-api + ${project.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java new file mode 100644 index 00000000000..a7e60e340b2 --- /dev/null +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java @@ -0,0 +1,55 @@ +// 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 +// with 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 org.apache.cloudstack.api.command.user.discovery; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.PlugService; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.discovery.ApiDiscoveryService; +import org.apache.cloudstack.api.response.ApiDiscoveryResponse; + +import org.apache.log4j.Logger; + +@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all apis available to the user as per their account type", since = "4.1.0") +public class ListApisCmd extends BaseListCmd { + + public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName()); + private static final String s_name = "listapisresponse"; + + @PlugService + ApiDiscoveryService _apiDiscoveryService; + + @Override + public void execute() throws ServerApiException { + if (_apiDiscoveryService != null) { + ListResponse response = (ListResponse) _apiDiscoveryService.listApis(); + if (response == null) { + throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find and process any apis"); + } + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } + } + + @Override + public String getCommandName() { + return s_name; + } +} diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java new file mode 100644 index 00000000000..b6a4f124954 --- /dev/null +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java @@ -0,0 +1,75 @@ +// 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 +// with 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 org.apache.cloudstack.api.response; + +import com.cloud.user.Account; +import org.apache.cloudstack.api.ApiConstants; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + +import java.util.HashSet; +import java.util.Set; + +@SuppressWarnings("unused") +@EntityReference(value = Account.class) +public class ApiDiscoveryResponse extends BaseResponse { + @SerializedName(ApiConstants.NAME) @Param(description="the name of the api command") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of the api") + private String description; + + @SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in") + private String since; + + @SerializedName(ApiConstants.IS_ASYNC) @Param(description="true if api is asynchronous") + private Boolean isAsync; + + @SerializedName(ApiConstants.PARAMS) @Param(description="the list params the api accepts", responseObject = ApiParameterResponse.class) + private Set params; + + public ApiDiscoveryResponse(){ + params = new HashSet(); + isAsync = false; + } + + public void setName(String name) { + this.name = name; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setSince(String since) { + this.since = since; + } + + public void setAsync(Boolean isAsync) { + this.isAsync = isAsync; + } + + public void setParams(Set params) { + this.params = params; + } + + public void addParam(ApiParameterResponse param) { + this.params.add(param); + } +} \ No newline at end of file diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java new file mode 100644 index 00000000000..9a73bec3dee --- /dev/null +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java @@ -0,0 +1,70 @@ +// 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 +// with 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 org.apache.cloudstack.api.response; + +import org.apache.cloudstack.api.ApiConstants; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.BaseResponse; + +public class ApiParameterResponse extends BaseResponse { + @SerializedName(ApiConstants.NAME) @Param(description="the name of the api parameter") + private String name; + + @SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of the api parameter") + private String description; + + @SerializedName(ApiConstants.TYPE) @Param(description="parameter type") + private String type; + + @SerializedName(ApiConstants.LENGTH) @Param(description="length of the parameter") + private int length; + + @SerializedName(ApiConstants.REQUIRED) @Param(description="version of CloudStack the api was introduced in") + private Boolean required; + + @SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in") + private String since; + + public ApiParameterResponse(){ + } + + public void setName(String name) { + this.name = name; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setType(String type) { + this.type = type; + } + + public void setLength(int length) { + this.length = length; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public void setSince(String since) { + this.since = since; + } + + } \ No newline at end of file diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java new file mode 100644 index 00000000000..ca57df5d314 --- /dev/null +++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java @@ -0,0 +1,144 @@ +// 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 +// with 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 org.apache.cloudstack.discovery; + +import com.cloud.utils.ReflectUtil; +import com.cloud.utils.component.AdapterBase; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ApiDiscoveryResponse; +import org.apache.cloudstack.api.response.ApiParameterResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +@Local(value = ApiDiscoveryService.class) +public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscoveryService { + + private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class); + private Map> _apiNameCmdClassMap; + private ListResponse _discoveryResponse; + + protected ApiDiscoveryServiceImpl() { + super(); + } + + private void generateApiNameCmdClassMapping() { + _apiNameCmdClassMap = new HashMap>(); + Set> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, new String[]{"org.apache.cloudstack.api", "com.cloud.api"}); + + for(Class cmdClass: cmdClasses) { + String apiName = cmdClass.getAnnotation(APICommand.class).name(); + if (_apiNameCmdClassMap.containsKey(apiName)) { + s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName); + continue; + } + _apiNameCmdClassMap.put(apiName, cmdClass); + } + } + + private void precacheListApiResponse() { + + if(_apiNameCmdClassMap == null) + return; + + _discoveryResponse = new ListResponse(); + + List apiDiscoveryResponses = new ArrayList(); + + for(String key: _apiNameCmdClassMap.keySet()) { + Class cmdClass = _apiNameCmdClassMap.get(key); + APICommand apiCmdAnnotation = cmdClass.getAnnotation(APICommand.class); + if (apiCmdAnnotation == null) + apiCmdAnnotation = cmdClass.getSuperclass().getAnnotation(APICommand.class); + if (apiCmdAnnotation == null + || !apiCmdAnnotation.includeInApiDoc() + || apiCmdAnnotation.name().isEmpty()) + continue; + + ApiDiscoveryResponse response = new ApiDiscoveryResponse(); + response.setName(apiCmdAnnotation.name()); + response.setDescription(apiCmdAnnotation.description()); + response.setSince(apiCmdAnnotation.since()); + + Field[] fields = ReflectUtil.getAllFieldsForClass(cmdClass, + new Class[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); + + boolean isAsync = ReflectUtil.isCmdClassAsync(cmdClass, + new Class[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); + + response.setAsync(isAsync); + + for(Field field: fields) { + Parameter parameterAnnotation = field.getAnnotation(Parameter.class); + if (parameterAnnotation != null + && parameterAnnotation.expose() + && parameterAnnotation.includeInApiDoc()) { + + ApiParameterResponse paramResponse = new ApiParameterResponse(); + paramResponse.setName(parameterAnnotation.name()); + paramResponse.setDescription(parameterAnnotation.description()); + paramResponse.setType(parameterAnnotation.type().toString()); + paramResponse.setLength(parameterAnnotation.length()); + paramResponse.setRequired(parameterAnnotation.required()); + paramResponse.setSince(parameterAnnotation.since()); + response.addParam(paramResponse); + } + } + response.setObjectName("apis"); + apiDiscoveryResponses.add(response); + } + _discoveryResponse.setResponses(apiDiscoveryResponses); + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + super.configure(name, params); + + generateApiNameCmdClassMapping(); + precacheListApiResponse(); + + return true; + } + + public Map> getApiNameCmdClassMapping() { + return _apiNameCmdClassMap; + } + + @Override + public ListResponse listApis() { + return _discoveryResponse; + } + + @Override + public String[] getPropertiesFiles() { + return new String[]{"api-discovery_commands.properties"}; + } +} \ No newline at end of file diff --git a/plugins/pom.xml b/plugins/pom.xml index f0589a1caaf..a42ae2967b1 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -32,6 +32,7 @@ test + api/discovery acl/static-role-based deployment-planners/user-concentrated-pod deployment-planners/user-dispersing diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index e2dc9ce2bbf..8d304e0c9b3 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -50,6 +50,7 @@ import javax.crypto.spec.SecretKeySpec; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import com.cloud.utils.ReflectUtil; import org.apache.cloudstack.acl.APIAccessChecker; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.*; @@ -59,6 +60,7 @@ import org.apache.cloudstack.api.command.user.event.ListEventsCmd; import org.apache.cloudstack.api.command.user.vm.ListVMsCmd; import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd; import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd; +import org.apache.cloudstack.discovery.ApiDiscoveryService; import org.apache.commons.codec.binary.Base64; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.ConnectionClosedException; @@ -145,8 +147,11 @@ public class ApiServer implements HttpRequestHandler { @Inject private AccountManager _accountMgr = null; @Inject private DomainManager _domainMgr = null; @Inject private AsyncJobManager _asyncMgr = null; + @Inject(adapter = APIAccessChecker.class) protected Adapters _apiAccessCheckers; + @Inject(adapter = ApiDiscoveryService.class) + protected Adapters _apiDiscoveryServices; private Account _systemAccount = null; private User _systemUser = null; @@ -201,17 +206,8 @@ public class ApiServer implements HttpRequestHandler { } } - // Populate api name and cmd class mappings - Reflections reflections = new Reflections("org.apache.cloudstack.api"); - Set> cmdClasses = reflections.getTypesAnnotatedWith(APICommand.class); - reflections = new Reflections("com.cloud.api"); - cmdClasses.addAll(reflections.getTypesAnnotatedWith(APICommand.class)); - for(Class cmdClass: cmdClasses) { - String apiName = cmdClass.getAnnotation(APICommand.class).name(); - if (_apiNameCmdClassMap.containsKey(apiName)) { - s_logger.error("API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName); - } - _apiNameCmdClassMap.put(apiName, cmdClass); + for (ApiDiscoveryService discoveryService: _apiDiscoveryServices) { + _apiNameCmdClassMap.putAll(discoveryService.getApiNameCmdClassMapping()); } encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key())); From b59638e5aeea29b4bb92f20ee73f6d722fa0e7fc Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 19:59:47 -0800 Subject: [PATCH 11/19] apidoc: Fix apidoc building to generate for new plugin as well Signed-off-by: Rohit Yadav --- tools/apidoc/gen_toc.py | 3 ++- tools/apidoc/pom.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py index abff8d15980..7739aea633f 100644 --- a/tools/apidoc/gen_toc.py +++ b/tools/apidoc/gen_toc.py @@ -128,7 +128,8 @@ known_categories = { 'NiciraNvpDevice': 'Nicira NVP', 'AutoScale': 'AutoScale', 'Counter': 'AutoScale', - 'Condition': 'AutoScale' + 'Condition': 'AutoScale', + 'Api': 'API Discovery', } diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml index b75ee826372..e0b02bc5dc6 100644 --- a/tools/apidoc/pom.xml +++ b/tools/apidoc/pom.xml @@ -57,7 +57,7 @@ ${client.config.jars} ./target -f - ${client.config.conf}/commands.properties,${client.config.conf}/commands-ext.properties,${client.config.conf}/virtualrouter_commands.properties,${client.config.conf}/nicira-nvp_commands.properties + ${client.config.conf}/commands.properties,${client.config.conf}/commands-ext.properties,${client.config.conf}/virtualrouter_commands.properties,${client.config.conf}/nicira-nvp_commands.properties,${client.config.conf}/api-discovery_commands.properties From d613c59dcbbca884fd8b31f5a1d58bb3f6d0e67c Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 8 Jan 2013 20:00:13 -0800 Subject: [PATCH 12/19] plugins: Fix apidiscovery's annotation field values and example plugin's name Signed-off-by: Rohit Yadav --- .../cloudstack/api/command/user/discovery/ListApisCmd.java | 2 +- .../apache/cloudstack/api/response/ApiDiscoveryResponse.java | 2 +- .../apache/cloudstack/api/response/ApiParameterResponse.java | 4 ++-- plugins/network-elements/dns-notifier/pom.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java index a7e60e340b2..dcbaec1d160 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java @@ -27,7 +27,7 @@ import org.apache.cloudstack.api.response.ApiDiscoveryResponse; import org.apache.log4j.Logger; -@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all apis available to the user as per their account type", since = "4.1.0") +@APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by Api Discovery plugin", since = "4.1.0") public class ListApisCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName()); diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java index b6a4f124954..dd1298bfec5 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java @@ -72,4 +72,4 @@ public class ApiDiscoveryResponse extends BaseResponse { public void addParam(ApiParameterResponse param) { this.params.add(param); } -} \ No newline at end of file +} diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java index 9a73bec3dee..9138288e102 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiParameterResponse.java @@ -34,7 +34,7 @@ public class ApiParameterResponse extends BaseResponse { @SerializedName(ApiConstants.LENGTH) @Param(description="length of the parameter") private int length; - @SerializedName(ApiConstants.REQUIRED) @Param(description="version of CloudStack the api was introduced in") + @SerializedName(ApiConstants.REQUIRED) @Param(description="true if this parameter is required for the api request") private Boolean required; @SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in") @@ -67,4 +67,4 @@ public class ApiParameterResponse extends BaseResponse { this.since = since; } - } \ No newline at end of file + } diff --git a/plugins/network-elements/dns-notifier/pom.xml b/plugins/network-elements/dns-notifier/pom.xml index 0b4c981af98..8c6b485b83c 100644 --- a/plugins/network-elements/dns-notifier/pom.xml +++ b/plugins/network-elements/dns-notifier/pom.xml @@ -28,7 +28,7 @@ org.apache.cloudstack cloud-plugin-example-dns-notifier 4.1.0-SNAPSHOT - CloudStack Dns Notifier Example + Apache CloudStack Plugin - Dns Notifier Example This is sample source code on how to write a plugin for CloudStack install From 4f98d879f69bdddca74e56a21c06df9b033d049a Mon Sep 17 00:00:00 2001 From: Noa Resare Date: Tue, 8 Jan 2013 20:25:58 -0800 Subject: [PATCH 13/19] maven: remove explicit submodule versions from module pom.xml Signed-off-by: Rohit Yadav --- plugins/hypervisors/simulator/pom.xml | 3 +-- plugins/network-elements/dns-notifier/pom.xml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/hypervisors/simulator/pom.xml b/plugins/hypervisors/simulator/pom.xml index 15b37900590..a1ab9c08639 100644 --- a/plugins/hypervisors/simulator/pom.xml +++ b/plugins/hypervisors/simulator/pom.xml @@ -27,7 +27,6 @@ org.apache.cloudstack cloud-plugin-hypervisor-simulator - 4.1.0-SNAPSHOT Apache CloudStack Plugin - Hypervisor Simulator Simulator Hypervisor for Cloudstack @@ -42,4 +41,4 @@ ${project.version} - \ No newline at end of file + diff --git a/plugins/network-elements/dns-notifier/pom.xml b/plugins/network-elements/dns-notifier/pom.xml index 0b4c981af98..be68e99b9b2 100644 --- a/plugins/network-elements/dns-notifier/pom.xml +++ b/plugins/network-elements/dns-notifier/pom.xml @@ -27,7 +27,6 @@ org.apache.cloudstack cloud-plugin-example-dns-notifier - 4.1.0-SNAPSHOT CloudStack Dns Notifier Example This is sample source code on how to write a plugin for CloudStack From b18c03a006ae308f2f8c8843a0d517b61d17105a Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 9 Jan 2013 15:11:05 +0530 Subject: [PATCH 14/19] simulator: formatting changes Signed-off-by: Prasanna Santhanam --- .../agent/manager/SimulatorManagerImpl.java | 65 ++++++++----------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java index 4f70ee5bae7..2bed2efec6a 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java @@ -16,27 +16,12 @@ // under the License. package com.cloud.agent.manager; -import java.util.HashMap; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - import com.cloud.agent.api.*; -import com.cloud.agent.api.storage.*; -import org.apache.log4j.Logger; - import com.cloud.agent.api.check.CheckSshCommand; import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand; import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand; -import com.cloud.agent.api.routing.DhcpEntryCommand; -import com.cloud.agent.api.routing.IpAssocCommand; -import com.cloud.agent.api.routing.LoadBalancerConfigCommand; -import com.cloud.agent.api.routing.SavePasswordCommand; -import com.cloud.agent.api.routing.SetFirewallRulesCommand; -import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; -import com.cloud.agent.api.routing.SetStaticNatRulesCommand; -import com.cloud.agent.api.routing.VmDataCommand; +import com.cloud.agent.api.routing.*; +import com.cloud.agent.api.storage.*; import com.cloud.simulator.MockConfigurationVO; import com.cloud.simulator.MockHost; import com.cloud.simulator.MockVMVO; @@ -49,6 +34,12 @@ import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine.State; +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import java.util.HashMap; +import java.util.Map; @Local(value = { SimulatorManager.class }) public class SimulatorManagerImpl implements SimulatorManager { @@ -112,14 +103,12 @@ public class SimulatorManagerImpl implements SimulatorManager { @Override public Answer simulate(Command cmd, String hostGuid) { Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - // txn.transitToUserManagedConnection(_concierge.conn()); - try { MockHost host = _mockHost.findByGuid(hostGuid); String cmdName = cmd.toString(); int index = cmdName.lastIndexOf("."); if (index != -1) { - cmdName = cmdName.substring(index + 1); + cmdName = cmdName.substring(index + 1); } MockConfigurationVO config = _mockConfigDao.findByNameBottomUP(host.getDataCenterId(), host.getPodId(), host.getClusterId(), host.getId(), cmdName); @@ -129,24 +118,24 @@ public class SimulatorManagerImpl implements SimulatorManager { if (config != null) { Map configParameters = config.getParameters(); for (Map.Entry entry : configParameters.entrySet()) { - if (entry.getKey().equalsIgnoreCase("enabled")) { - info.setEnabled(Boolean.parseBoolean(entry.getValue())); - } else if (entry.getKey().equalsIgnoreCase("timeout")) { - try { - info.setTimeout(Integer.valueOf(entry.getValue())); - } catch (NumberFormatException e) { - s_logger.debug("invalid timeout parameter: " + e.toString()); - } - } else if (entry.getKey().equalsIgnoreCase("wait")) { - try { - int wait = Integer.valueOf(entry.getValue()); - Thread.sleep(wait * 1000); - } catch (NumberFormatException e) { - s_logger.debug("invalid timeout parameter: " + e.toString()); - } catch (InterruptedException e) { - s_logger.debug("thread is interrupted: " + e.toString()); - } - } + if (entry.getKey().equalsIgnoreCase("enabled")) { + info.setEnabled(Boolean.parseBoolean(entry.getValue())); + } else if (entry.getKey().equalsIgnoreCase("timeout")) { + try { + info.setTimeout(Integer.valueOf(entry.getValue())); + } catch (NumberFormatException e) { + s_logger.debug("invalid timeout parameter: " + e.toString()); + } + } else if (entry.getKey().equalsIgnoreCase("wait")) { + try { + int wait = Integer.valueOf(entry.getValue()); + Thread.sleep(wait); + } catch (NumberFormatException e) { + s_logger.debug("invalid timeout parameter: " + e.toString()); + } catch (InterruptedException e) { + s_logger.debug("thread is interrupted: " + e.toString()); + } + } } } From ef89793c4e0265af0c4cc53feddc63544253b1d6 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 9 Jan 2013 13:11:21 +0100 Subject: [PATCH 15/19] init: Explicitly set the HOME variable to the homedir of the user cloud We have to explicitly set the HOME variable to the homedir from the user "cloud" This is because various scripts run by the management server read the HOME variable and fail when this init script is run manually. For example the injectkeys.sh script reads the HOME variable --- client/distro/ubuntu/SYSCONFDIR/init.d/cloud-management.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/distro/ubuntu/SYSCONFDIR/init.d/cloud-management.in b/client/distro/ubuntu/SYSCONFDIR/init.d/cloud-management.in index 5ed86c2ceb5..4afa707a9e9 100755 --- a/client/distro/ubuntu/SYSCONFDIR/init.d/cloud-management.in +++ b/client/distro/ubuntu/SYSCONFDIR/init.d/cloud-management.in @@ -38,6 +38,11 @@ CATALINA_HOME=@MSENVIRON@ DEFAULT=@MSCONF@/tomcat6.conf JVM_TMP=/tmp/$NAME-temp +# We have to explicitly set the HOME variable to the homedir from the user "cloud" +# This is because various scripts run by the management server read the HOME variable +# and fail when this init script is run manually. +HOME=$(echo ~cloud) + if [ `id -u` -ne 0 ]; then echo "You need root privileges to run this script" exit 1 From 765504c070919cd8e6ee53e23985a37c9a7ecdf6 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 9 Jan 2013 04:15:19 -0800 Subject: [PATCH 16/19] ApiServer: Fix apidiscovery fail case, fix comment Signed-off-by: Rohit Yadav --- server/src/com/cloud/api/ApiServer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index 8d304e0c9b3..56cef123e2c 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -168,9 +168,7 @@ public class ApiServer implements HttpRequestHandler { public static void initApiServer(String[] apiConfig) { if (s_instance == null) { - //Injecting will create ApiServer object with all its - //vars injected as well, no need to do the following: - //s_instance = new ApiServer(); + //Injection will create ApiServer and all its fields which have @Inject s_instance = ComponentLocator.inject(ApiServer.class); s_instance.init(apiConfig); } @@ -178,7 +176,6 @@ public class ApiServer implements HttpRequestHandler { public static ApiServer getInstance() { // Assumption: CloudStartupServlet would initialize ApiServer - // initApiServer(null); if (s_instance == null) { s_logger.fatal("ApiServer instance failed to initialize"); } @@ -210,6 +207,11 @@ public class ApiServer implements HttpRequestHandler { _apiNameCmdClassMap.putAll(discoveryService.getApiNameCmdClassMapping()); } + if (_apiNameCmdClassMap.size() == 0) { + s_logger.fatal("ApiServer failed to generate apiname, cmd class mappings." + + "Please check and enable at least one ApiDiscovery adapter."); + } + encodeApiResponse = Boolean.valueOf(configDao.getValue(Config.EncodeApiResponse.key())); String jsonType = configDao.getValue(Config.JavaScriptDefaultContentType.key()); if (jsonType != null) { From fc92f04c6b3dcde4ae1177309b762ea8bea702c1 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 9 Jan 2013 04:17:30 -0800 Subject: [PATCH 17/19] ApiDispatcher: Remove unused methods which were for acl processing Signed-off-by: Rohit Yadav --- server/src/com/cloud/api/ApiDispatcher.java | 33 ++++----------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index fa9114e3ff7..75e361720fe 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -149,31 +149,9 @@ public class ApiDispatcher { } } - private void checkACLOnCommand(BaseCmd cmd) { - // TODO Auto-generated method stub - //need to write an commandACLChecker adapter framework to check ACL on commands - default one will use the static roles by referring to commands.properties. - //one can write another commandACLChecker to check access via custom roles. - } - - private List determineRole(Account caller) { - // TODO Auto-generated method stub - List effectiveRoles = new ArrayList(); - return effectiveRoles; - - } - private void doAccessChecks(BaseCmd cmd, List entitiesToAccess) { - //owner - Account caller = UserContext.current().getCaller(); - Account owner = _accountMgr.getActiveAccountById(cmd.getEntityOwnerId()); - - // REMOVE ME: - // List callerRoles = determineRole(caller); - // List ownerRoles = determineRole(owner); - // check permission to call this command for the caller - // this needs checking of static roles of the caller - // Role based acl is done in ApiServer before api gets to ApiDispatcher - // checkACLOnCommand(cmd); + Account caller = UserContext.current().getCaller(); + Account owner = _accountMgr.getActiveAccountById(cmd.getEntityOwnerId()); if(cmd instanceof BaseAsyncCreateCmd) { //check that caller can access the owner account. @@ -188,13 +166,13 @@ public class ApiDispatcher { _accountMgr.checkAccess(caller, null, true, (ControlledEntity) entity); } else if (entity instanceof InfrastructureEntity) { - //do something here:D + //FIXME: Move this code in adapter, remove code from Account manager } } } - } + } - public void dispatch(BaseCmd cmd, Map params) { + public void dispatch(BaseCmd cmd, Map params) { try { processParameters(cmd, params); UserContext ctx = UserContext.current(); @@ -524,7 +502,6 @@ public class ApiDispatcher { } Long internalId = null; // If annotation's empty, the cmd existed before 3.x try conversion to long - // FIXME: Fails if someone adds since field for any pre 3.x apis boolean isPre3x = annotation.since().isEmpty(); // Match against Java's UUID regex to check if input is uuid string boolean isUuid = uuid.matches("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"); From 0b0752f047c112cfd2de7ba3347887f593890368 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 9 Jan 2013 04:47:53 -0800 Subject: [PATCH 18/19] CLOUDSTACK-932: Fix incorrect param that caused casting error while processing api Reported-by: Kishan Kavala Signed-off-by: Rohit Yadav --- server/src/com/cloud/api/ApiDispatcher.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 75e361720fe..7bc3271523b 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -430,10 +430,9 @@ public class ApiDispatcher { switch (listType) { case LONG: case UUID: - List listParam = new ArrayList(); - listParam = (List) field.get(cmd); + List listParam = (List) field.get(cmd); for (Long entityId : listParam) { - Object entityObj = s_instance._entityMgr.findById(entity, (Long) field.get(cmd)); + Object entityObj = s_instance._entityMgr.findById(entity, entityId); entitiesToAccess.add(entityObj); } break; From 2eee2cd999889d105395621eb1f22103ca6f51c5 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 9 Jan 2013 04:56:32 -0800 Subject: [PATCH 19/19] plugins: Fix getPropertiesFiles() for pluggable service plugins, CiscoNexusVSMEElement Signed-off-by: Rohit Yadav --- .../apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java | 4 ++-- .../src/com/cloud/network/element/CiscoNexusVSMElement.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java index ca57df5d314..5363e559a5f 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java @@ -139,6 +139,6 @@ public class ApiDiscoveryServiceImpl extends AdapterBase implements ApiDiscovery @Override public String[] getPropertiesFiles() { - return new String[]{"api-discovery_commands.properties"}; + return new String[] { "api-discovery_commands.properties" }; } -} \ No newline at end of file +} diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java index b9567dc8475..911078eac50 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java @@ -237,7 +237,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme } @Override - public String getPropertiesFile() { - return "cisconexusvsm_commands.properties"; + public String[] getPropertiesFiles() { + return new String[] { "cisconexusvsm_commands.properties" }; } }