java/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml | 11
java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml | 18 -
java/code/src/com/redhat/rhn/domain/server/ServerFactory.java | 46 ---
java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml | 41 +--
java/code/src/com/redhat/rhn/frontend/events/SsmInstallPackagesAction.java | 41 +--
java/code/src/com/redhat/rhn/frontend/events/SsmRemovePackagesAction.java | 36 +--
java/code/src/com/redhat/rhn/frontend/events/SsmUpgradePackagesAction.java | 21 -
java/code/src/com/redhat/rhn/manager/action/ActionManager.java | 117 ++++------
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5 | 1
12 files changed, 130 insertions(+), 205 deletions(-)
New commits:
commit 888a0e3f95e3ee3f904def4d71b33d745a42d20e
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Sep 30 11:31:33 2009 -0400
Revert "525549 - fixing issue where SSM package operations would run out of memory"
This reverts commit e312aadf24c0eba765fb16838ae1fdc908d91b9c.
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml
index 1fbb305..32e63d1 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml
@@ -294,15 +294,4 @@ SELECT 1
</query>
</mode>
-<write-mode name="insert_server_actions">
- <query params="parent_id, status_id, tries">
-INSERT INTO rhnServerAction (server_id, action_id, status, REMAINING_TRIES)
- select s.id as server_id, :parent_id as action_id,
- :status_id as status, :tries as REMAINING_TRIES
- from rhnServer s
- where s.id in (%s)
- </query>
-</write-mode>
-
-
</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
index 7ce8f0b..9f691e1 100644
--- a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
@@ -39,7 +39,6 @@ import org.hibernate.Session;
import java.sql.Types;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -763,27 +762,4 @@ public class ServerFactory extends HibernateFactory {
"ServerSnapshot.findTags", params);
return snaps;
}
-
- /**
- * Filter out a list of systemIds with ones that are solaris systems
- * @param systemIds list of system ids
- * @return list of system ids that are solaris systems
- */
- public static List<Long> listSolarisSystems(Collection<Long> systemIds) {
- return ServerFactory.getSession().getNamedQuery("Server.listSolarisSystems").
- setParameterList("sids", systemIds).list();
- }
-
- /**
- * Filter out a list of systemIds with ones that are linux systems
- * (i.e. not solaris systems)
- * @param systemIds list of system ids
- * @return list of system ids that are linux systems
- */
- public static List<Long> listLinuxSystems(Collection<Long> systemIds) {
- return ServerFactory.getSession().getNamedQuery("Server.listRedHatSystems").
- setParameterList("sids", systemIds).list();
-
- }
-
}
diff --git a/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml b/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
index d1ea620..0dbadcd 100644
--- a/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
@@ -89,36 +89,36 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
</set>
<many-to-one name="org" class="com.redhat.rhn.domain.org.OrgImpl"
- column="org_id" lazy="proxy"/>
+ column="org_id"/>
<many-to-one name="creator" class="com.redhat.rhn.domain.user.legacy.LegacyRhnUserImpl"
- column="creator_id" lazy="proxy"/>
+ column="creator_id"/>
<many-to-one name="serverArch"
class="com.redhat.rhn.domain.server.ServerArch"
- column="server_arch_id" lazy="proxy"/>
+ column="server_arch_id"/>
<many-to-one name="provisionState"
class="com.redhat.rhn.domain.common.ProvisionState"
- column="provision_state_id" cascade="save-update" lazy="proxy"/>
+ column="provision_state_id" cascade="save-update"/>
<one-to-one name="serverInfo"
- class="com.redhat.rhn.domain.server.ServerInfo" cascade="all" lazy="proxy"/>
+ class="com.redhat.rhn.domain.server.ServerInfo" cascade="all"/>
<one-to-one name="cpu" class="com.redhat.rhn.domain.server.CPU"
- property-ref="server" cascade="all" lazy="proxy"/>
+ property-ref="server" cascade="all"/>
<one-to-one name="lock" class="com.redhat.rhn.domain.server.ServerLock"
- cascade="all" lazy="proxy"/>
+ cascade="all"/>
<one-to-one name="serverUuid" class="com.redhat.rhn.domain.server.ServerUuid"
- cascade="all" lazy="proxy"/>
+ cascade="all"/>
<one-to-one name="proxyInfo" class="com.redhat.rhn.domain.server.ProxyInfo"
- cascade="all" lazy="proxy"/>
+ cascade="all"/>
<one-to-one name="pushClient" class="com.redhat.rhn.domain.server.PushClient"
- property-ref="server" lazy="proxy" />
+ property-ref="server" />
<!--
we want to access the ram object via the field directly.
@@ -127,16 +127,16 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
create a RAM object on a server.
-->
<one-to-one name="ram" class="com.redhat.rhn.domain.server.Ram"
- property-ref="server" cascade="all" access="field" lazy="proxy"/>
+ property-ref="server" cascade="all" access="field"/>
<one-to-one name="dmi" class="com.redhat.rhn.domain.server.Dmi"
- property-ref="server" cascade="all" lazy="proxy"/>
+ property-ref="server" cascade="all"/>
<one-to-one name="location" class="com.redhat.rhn.domain.server.Location"
- property-ref="server" cascade="all" lazy="proxy" />
+ property-ref="server" cascade="all"/>
<one-to-one name="virtualInstance"
class="com.redhat.rhn.domain.server.VirtualInstance"
property-ref="guestSystem"
- cascade="save-update" lazy="proxy"/>
+ cascade="save-update"/>
<set name="history" cascade="all" lazy="true" inverse="true">
<key column="server_id"/>
@@ -179,19 +179,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<query name="Server.findByIdsAndOrgId">
<![CDATA[from com.redhat.rhn.domain.server.Server as s where ORG_ID = :orgId and s.id in (:serverIds)]]>
</query>
-
- <query name="Server.listRedHatSystems">
- <![CDATA[ select s.id
- from com.redhat.rhn.domain.server.Server as s
- where s.id in (:sids) and s.serverArch.archType.label != 'sysv-solaris']]>
- </query>
-
- <query name="Server.listSolarisSystems">
- <![CDATA[ select s.id
- from com.redhat.rhn.domain.server.Server as s
- where s.id in (:sids) and s.serverArch.archType.label = 'sysv-solaris']]>
- </query>
-
<sql-query name="Server.findVirtPlatformHostsByOrg">
<![CDATA[select s.id as id, s.name as name, count(vi.id) as count
diff --git a/java/code/src/com/redhat/rhn/frontend/events/SsmInstallPackagesAction.java b/java/code/src/com/redhat/rhn/frontend/events/SsmInstallPackagesAction.java
index 09441fc..77c4024 100644
--- a/java/code/src/com/redhat/rhn/frontend/events/SsmInstallPackagesAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/events/SsmInstallPackagesAction.java
@@ -14,27 +14,28 @@
*/
package com.redhat.rhn.frontend.events;
-import com.redhat.rhn.common.localization.LocalizationService;
-import com.redhat.rhn.common.messaging.EventMessage;
-import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.domain.user.UserFactory;
-import com.redhat.rhn.frontend.action.SetLabels;
-import com.redhat.rhn.frontend.dto.EssentialServerDto;
-import com.redhat.rhn.frontend.dto.PackageListItem;
-import com.redhat.rhn.manager.action.ActionManager;
-import com.redhat.rhn.manager.rhnset.RhnSetDecl;
-import com.redhat.rhn.manager.ssm.SsmOperationManager;
-import com.redhat.rhn.manager.system.SystemManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.Set;
+import java.util.List;
import java.util.ArrayList;
+import java.util.Map;
import java.util.Date;
import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import com.redhat.rhn.common.messaging.EventMessage;
+import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.manager.ssm.SsmOperationManager;
+import com.redhat.rhn.manager.action.ActionManager;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+import com.redhat.rhn.manager.system.SystemManager;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.server.ServerFactory;
+import com.redhat.rhn.frontend.dto.PackageListItem;
+import com.redhat.rhn.frontend.dto.EssentialServerDto;
+import com.redhat.rhn.frontend.action.SetLabels;
/**
* Schedules package installations on systems in the SSM.
@@ -91,13 +92,17 @@ public class SsmInstallPackagesAction extends AbstractDatabaseAction {
PackageListItem.toKeyMaps(packageListItems);
// Create one action for all servers to which the packages are installed
+ List<Server> actionServers = new ArrayList<Server>(servers.size());
List<Long> serverIds = new LinkedList<Long>();
for (EssentialServerDto dto : servers) {
serverIds.add(dto.getId());
}
-
+ log.debug("Looking up server objects.");
+ actionServers.addAll(ServerFactory.lookupByIdsAndUser(serverIds, user));
log.debug("Scheduling actions.");
- ActionManager.schedulePackageInstall(user, serverIds,
+
+
+ ActionManager.schedulePackageInstall(user, actionServers,
packageListData, earliest);
log.debug("Done scheduling package installations.");
diff --git a/java/code/src/com/redhat/rhn/frontend/events/SsmRemovePackagesAction.java b/java/code/src/com/redhat/rhn/frontend/events/SsmRemovePackagesAction.java
index ee3fafa..55ee1dc 100644
--- a/java/code/src/com/redhat/rhn/frontend/events/SsmRemovePackagesAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/events/SsmRemovePackagesAction.java
@@ -14,25 +14,26 @@
*/
package com.redhat.rhn.frontend.events;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.log4j.Logger;
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.messaging.EventMessage;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.server.ServerFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.domain.user.UserFactory;
import com.redhat.rhn.frontend.dto.PackageListItem;
import com.redhat.rhn.manager.action.ActionManager;
-import com.redhat.rhn.manager.rhnset.RhnSetDecl;
import com.redhat.rhn.manager.ssm.SsmOperationManager;
-
-import org.apache.log4j.Logger;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
/**
* Handles removing packages from servers in the SSM.
@@ -90,8 +91,8 @@ public class SsmRemovePackagesAction extends AbstractDatabaseAction {
// total of all packages selected
Set<PackageListItem> allPackages = new HashSet<PackageListItem>();
-
- Set<Long> allServerIds = new HashSet<Long>();
+ // Looking up all the server objects in Hibernate was *brutally* slow here:
+ List<Long> allServerIds = new LinkedList<Long>();
// Iterate the data, which is essentially each unique package/server combination
// to remove. Note that this is only for servers that we have marked as having the
@@ -117,17 +118,16 @@ public class SsmRemovePackagesAction extends AbstractDatabaseAction {
}
}
+ List<Server> allServers = new ArrayList<Server>(result.size());
+ allServers.addAll(ServerFactory.lookupByIdsAndUser(allServerIds, user));
log.debug("Converting data to maps.");
- List<PackageListItem> allPackagesList =
- new ArrayList<PackageListItem>(allPackages);
+ List<PackageListItem> allPackagesList = new ArrayList<PackageListItem>(allPackages);
List<Map<String, Long>> packageListData =
PackageListItem.toKeyMaps(allPackagesList);
log.debug("Scheduling package removals.");
- ActionManager.schedulePackageRemoval(user, allServerIds,
- packageListData, earliest);
-
+ ActionManager.schedulePackageRemoval(user, allServers, packageListData, earliest);
log.debug("Done.");
}
diff --git a/java/code/src/com/redhat/rhn/frontend/events/SsmUpgradePackagesAction.java b/java/code/src/com/redhat/rhn/frontend/events/SsmUpgradePackagesAction.java
index af22b5b..5647b81 100644
--- a/java/code/src/com/redhat/rhn/frontend/events/SsmUpgradePackagesAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/events/SsmUpgradePackagesAction.java
@@ -14,22 +14,22 @@
*/
package com.redhat.rhn.frontend.events;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.log4j.Logger;
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.messaging.EventMessage;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.server.ServerFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.domain.user.UserFactory;
import com.redhat.rhn.manager.action.ActionManager;
-import com.redhat.rhn.manager.rhnset.RhnSetDecl;
import com.redhat.rhn.manager.ssm.SsmOperationManager;
-
-import org.apache.log4j.Logger;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
/**
* Handles removing packages from servers in the SSM.
@@ -103,7 +103,8 @@ public class SsmUpgradePackagesAction extends AbstractDatabaseAction {
serverIds.add(serverId);
}
- ActionManager.schedulePackageUpgrades(user, serverIds, packageListItems, earliest);
+ List<Server> serverList = ServerFactory.lookupByIdsAndUser(serverIds, user);
+ ActionManager.schedulePackageUpgrades(user, serverList, packageListItems, earliest);
if (log.isDebugEnabled()) {
log.debug("Time to schedule all actions: " +
diff --git a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
index ee8268f..b98c1a2 100644
--- a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
+++ b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
@@ -54,7 +54,6 @@ import com.redhat.rhn.domain.rhnpackage.PatchSet;
import com.redhat.rhn.domain.rhnset.RhnSet;
import com.redhat.rhn.domain.rhnset.RhnSetElement;
import com.redhat.rhn.domain.server.Server;
-import com.redhat.rhn.domain.server.ServerFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.dto.PackageMetadata;
import com.redhat.rhn.frontend.listview.PageControl;
@@ -1104,32 +1103,41 @@ public class ActionManager extends BaseManager {
* Schedules one or more package removal actions on one or more servers.
*
* @param scheduler user scheduling the action.
- * @param serverIds servers from which to remove the packages
+ * @param servers servers from which to remove the packages
* @param pkgs list of packages to be removed.
* @param earliestAction date of earliest action to be executed
*/
public static void schedulePackageRemoval(User scheduler,
- Collection<Long> serverIds, List<Map<String, Long>> pkgs, Date earliestAction) {
+ List<Server> servers, List<Map<String, Long>> pkgs, Date earliestAction) {
// Different handling for package removal on solaris v. rhel, so split out
// the servers first in case the list is mixed.
- Set<Long> rhelServers = new HashSet<Long>();
- rhelServers.addAll(ServerFactory.listLinuxSystems(serverIds));
- Set<Long> solarisServers = new HashSet<Long>();
- solarisServers.addAll(ServerFactory.listSolarisSystems(serverIds));
+ List<Server> rhelServers = new ArrayList<Server>();
+ List<Server> solarisServers = new ArrayList<Server>();
+
+ for (Server server : servers) {
+ if (server.isSolaris()) {
+ solarisServers.add(server);
+ }
+ else {
+ rhelServers.add(server);
+ }
+ }
// Since the solaris v. rhel distinction results in a different action type,
// we'll end up with 2 actions created if the server list is mixed
if (!rhelServers.isEmpty()) {
+ Server[] s = rhelServers.toArray(new Server[rhelServers.size()]);
schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_PACKAGES_REMOVE,
- earliestAction, rhelServers);
+ earliestAction, s);
}
if (!solarisServers.isEmpty()) {
+ Server[] s = solarisServers.toArray(new Server[solarisServers.size()]);
schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_SOLARISPKGS_REMOVE,
- earliestAction, solarisServers);
+ earliestAction, s);
}
- }
+ }
/**
* Schedules one or more package upgrade actions for the given server.
@@ -1149,13 +1157,13 @@ public class ActionManager extends BaseManager {
* Schedules one or more package upgrade actions for the given servers.
* Note: package upgrade = package install
* @param scheduler User scheduling the action.
- * @param sids list of server ids on which the action affects.
+ * @param srvr list of servers on which the action affects.
* @param pkgs The set of packages to be removed.
* @param earliestAction Date of earliest action to be executed
*/
public static void schedulePackageUpgrades(User scheduler,
- List<Long> sids, List<Map<String, Long>> pkgs, Date earliestAction) {
- schedulePackageInstall(scheduler, sids, pkgs, earliestAction);
+ List<Server> srvr, List<Map<String, Long>> pkgs, Date earliestAction) {
+ schedulePackageInstall(scheduler, srvr, pkgs, earliestAction);
}
/**
@@ -1195,30 +1203,39 @@ public class ActionManager extends BaseManager {
/**
* Schedules one or more package installation actions on one or more servers.
* @param scheduler user scheduling the action.
- * @param serverIds server ids for which the packages should be installed
+ * @param servers servers for which the packages should be installed
* @param pkgs set of packages to be removed.
* @param earliestAction date of earliest action to be executed
*/
public static void schedulePackageInstall(User scheduler,
- Collection<Long> serverIds, List pkgs, Date earliestAction) {
+ List<Server> servers, List pkgs, Date earliestAction) {
// Different handling for package installs on solaris v. rhel, so split out
// the servers first in case the list is mixed.
- Set<Long> rhelServers = new HashSet<Long>();
- rhelServers.addAll(ServerFactory.listLinuxSystems(serverIds));
- Set<Long> solarisServers = new HashSet<Long>();
- solarisServers.addAll(ServerFactory.listSolarisSystems(serverIds));
+ List<Server> rhelServers = new ArrayList<Server>();
+ List<Server> solarisServers = new ArrayList<Server>();
+
+ for (Server server : servers) {
+ if (server.isSolaris()) {
+ solarisServers.add(server);
+ }
+ else {
+ rhelServers.add(server);
+ }
+ }
// Since the solaris v. rhel distinction results in a different action type,
// we'll end up with 2 actions created if the server list is mixed
if (!rhelServers.isEmpty()) {
+ Server[] s = rhelServers.toArray(new Server[rhelServers.size()]);
schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_PACKAGES_UPDATE,
- earliestAction, rhelServers);
+ earliestAction, s);
}
if (!solarisServers.isEmpty()) {
+ Server[] s = solarisServers.toArray(new Server[solarisServers.size()]);
schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_SOLARISPKGS_INSTALL,
- earliestAction, solarisServers);
+ earliestAction, s);
}
}
@@ -1268,7 +1285,8 @@ public class ActionManager extends BaseManager {
public static PackageAction schedulePackageVerify(User scheduler,
Server srvr, List<Map<String, Long>> pkgs, Date earliest) {
return (PackageAction) schedulePackageAction(scheduler, pkgs,
- ActionFactory.TYPE_PACKAGES_VERIFY, earliest, srvr);
+ ActionFactory.TYPE_PACKAGES_VERIFY, earliest, srvr
+ );
}
/**
* Schedules one or more package installation actions for the given server.
@@ -1316,28 +1334,19 @@ public class ActionManager extends BaseManager {
}
private static Action scheduleAction(User scheduler, ActionType type, String name,
- Date earliestAction, Set<Long> serverIds) {
+ Date earliestAction, Server... servers) {
Action action = createScheduledAction(scheduler, type, name, earliestAction);
- ActionFactory.save(action);
- action = (Action) ActionFactory.reload(action);
-
-
- Map params = new HashMap();
- params.put("status_id", ActionFactory.STATUS_QUEUED.getId());
- params.put("tries", REMAINING_TRIES);
- params.put("parent_id", action.getId());
- //params.put("sid", sid);
-
- WriteMode m = ModeFactory.getWriteMode("Action_queries",
- "insert_server_actions");
- List<Long> sidList = new ArrayList<Long>();
- sidList.addAll(serverIds);
- m.executeUpdate(params, sidList);
-
+ for (Server server : servers) {
+ ServerAction sa = new ServerAction();
+ sa.setStatus(ActionFactory.STATUS_QUEUED);
+ sa.setRemainingTries(REMAINING_TRIES);
+ sa.setServer(server);
- //action.addServerAction(sa);
+ action.addServerAction(sa);
+ sa.setParentAction(action);
+ }
return action;
}
@@ -1603,34 +1612,10 @@ public class ActionManager extends BaseManager {
* @return The action that has been scheduled.
*/
public static Action schedulePackageAction(User scheduler,
- List pkgs,
- ActionType type,
- Date earliestAction,
- Server...servers) {
- Set<Long> serverIds = new HashSet<Long>();
- for (Server s : servers) {
- serverIds.add(s.getId());
- }
- return schedulePackageAction(scheduler, pkgs, type, earliestAction, serverIds);
- }
-
- /**
- * Schedules a package action of the given type for the given server with the
- * packages given as a list.
- * @param scheduler The user scheduling the action.
- * @param pkgs A list of maps containing keys 'name_id', 'evr_id' and
- * optional 'arch_id' with Long values.
- * @param type The type of the package action. One of the static types found in
- * ActionFactory
- * @param earliestAction The earliest time that this action could happen.
- * @param serverIds The server ids that this action is for.
- * @return The action that has been scheduled.
- */
- public static Action schedulePackageAction(User scheduler,
List pkgs,
ActionType type,
Date earliestAction,
- Set<Long> serverIds) {
+ Server... servers) {
String name = "";
if (type.equals(ActionFactory.TYPE_PACKAGES_REMOVE) ||
@@ -1648,7 +1633,7 @@ public class ActionManager extends BaseManager {
name = "Package Synchronization";
}
- Action action = scheduleAction(scheduler, type, name, earliestAction, serverIds);
+ Action action = scheduleAction(scheduler, type, name, earliestAction, servers);
ActionFactory.save(action);
if (pkgs != null) {
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2 b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2
new file mode 120000
index 0000000..f612f22
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2
@@ -0,0 +1 @@
+satellite-5.1-spacewalk-0.2
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3 b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3
new file mode 120000
index 0000000..b48bb8a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3
@@ -0,0 +1 @@
+spacewalk-0.2-spacewalk-0.3
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4 b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4
new file mode 120000
index 0000000..64b32f3
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4
@@ -0,0 +1 @@
+spacewalk-0.3-spacewalk-0.4
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5 b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5
new file mode 120000
index 0000000..a9f7adb
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5
@@ -0,0 +1 @@
+spacewalk-0.4-spacewalk-0.5
\ No newline at end of file
commit d7856b103c43690d2d1ee197dc40f2d54f07f682
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Sep 30 11:31:21 2009 -0400
Revert "adding workaround for hibernate oddity/bug"
This reverts commit 7e51e6b06314e5a01e1c028f6d1221017ff27297.
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
index 06787c9..7ce8f0b 100644
--- a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
@@ -40,7 +40,6 @@ import org.hibernate.Session;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -771,10 +770,6 @@ public class ServerFactory extends HibernateFactory {
* @return list of system ids that are solaris systems
*/
public static List<Long> listSolarisSystems(Collection<Long> systemIds) {
- //Hibernate can't handle empty lists for in clauses, silly hibernate
- if (systemIds.isEmpty()) {
- return Collections.EMPTY_LIST;
- }
return ServerFactory.getSession().getNamedQuery("Server.listSolarisSystems").
setParameterList("sids", systemIds).list();
}
@@ -786,10 +781,6 @@ public class ServerFactory extends HibernateFactory {
* @return list of system ids that are linux systems
*/
public static List<Long> listLinuxSystems(Collection<Long> systemIds) {
- //Hibernate can't handle empty lists for in clauses, silly hibernate
- if (systemIds.isEmpty()) {
- return Collections.EMPTY_LIST;
- }
return ServerFactory.getSession().getNamedQuery("Server.listRedHatSystems").
setParameterList("sids", systemIds).list();
commit f60520ffe2dc81022763087ec691752447bf1b05
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Sep 30 11:30:47 2009 -0400
Reverting commit not indended for VADER
This reverts commit 090c5f3ad8a4c6270b0047ed86dff35758b56263.
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
index f85288f..39d7ecf 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
@@ -23,27 +23,27 @@
( SELECT 1 from dual where exists
- (select /*+ ORDERED */ 1 FROM rhnServerGroupMembers SGM,
- rhnServerNeededErrataCache SNPC,
- rhnErrata E
+ (select 1 FROM rhnErrata E,
+ rhnServerNeededPackageCache SNPC,
+ rhnServerGroupMembers SGM
WHERE E.advisory_type = 'Security Advisory'
and snpc.errata_id = e.id
and snpc.server_id = sgm.server_id
and sgm.server_group_id = G.id)) AS SECURITY_ERRATA,
(SELECT 1 from dual where exists
- (select /*+ ORDERED */ 1 FROM rhnServerGroupMembers SGM,
- rhnServerNeededErrataCache SNPC,
- rhnErrata E
+ (select 1 FROM rhnErrata E,
+ rhnServerNeededPackageCache SNPC,
+ rhnServerGroupMembers SGM
WHERE E.advisory_type = 'Bug Fix Advisory'
and snpc.errata_id = e.id
and snpc.server_id = sgm.server_id
and sgm.server_group_id = G.id)) AS BUG_ERRATA,
(SELECT 1 from dual where exists
- (select /*+ ORDERED */ 1 FROM rhnServerGroupMembers SGM,
- rhnServerNeededErrataCache SNPC,
- rhnErrata E
+ (select 1 FROM rhnErrata E,
+ rhnServerNeededPackageCache SNPC,
+ rhnServerGroupMembers SGM
WHERE E.advisory_type = 'Product Enhancement Advisory'
and snpc.errata_id = e.id
and snpc.server_id = sgm.server_id
commit 53a06a83263a7aeb8b1b1adabafaae918cdb845c
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Sep 30 11:30:14 2009 -0400
Revert commit not intended for VADER
This reverts commit 7c9d5dd3a5c3d975f406215b4af7c5bcbddbf9d8.
diff --git a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
index ebc36a8..06787c9 100644
--- a/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/server/ServerFactory.java
@@ -771,31 +771,12 @@ public class ServerFactory extends HibernateFactory {
* @return list of system ids that are solaris systems
*/
public static List<Long> listSolarisSystems(Collection<Long> systemIds) {
- return listGenericSystems(systemIds, "Server.listSolarisSystems");
- }
-
-
-
- private static List<Long> listGenericSystems(Collection<Long> systemIds, String query) {
//Hibernate can't handle empty lists for in clauses, silly hibernate
if (systemIds.isEmpty()) {
return Collections.EMPTY_LIST;
}
- ArrayList<Long> tmpList = new ArrayList<Long>();
- List<Long> toRet = new ArrayList<Long>();
- tmpList.addAll(systemIds);
-
- for (int i = 0; i < systemIds.size();) {
- int initial = i;
- int fin = i + 500 < systemIds.size() ? i + 500 : systemIds.size();
- List<Long> sublist = tmpList.subList(i, fin);
- toRet.addAll(ServerFactory.getSession().getNamedQuery(query).
- setParameterList("sids", sublist).list());
- i = fin+1;
- }
-
- return toRet;
-
+ return ServerFactory.getSession().getNamedQuery("Server.listSolarisSystems").
+ setParameterList("sids", systemIds).list();
}
/**
@@ -805,7 +786,13 @@ public class ServerFactory extends HibernateFactory {
* @return list of system ids that are linux systems
*/
public static List<Long> listLinuxSystems(Collection<Long> systemIds) {
- return listGenericSystems(systemIds, "Server.listRedHatSystems");
+ //Hibernate can't handle empty lists for in clauses, silly hibernate
+ if (systemIds.isEmpty()) {
+ return Collections.EMPTY_LIST;
+ }
+ return ServerFactory.getSession().getNamedQuery("Server.listRedHatSystems").
+ setParameterList("sids", systemIds).list();
+
}
}