2 commits - java/code java/spacewalk-java.spec rel-eng/packages schema/spacewalk

StephenHerr sherr at fedoraproject.org
Fri Jun 29 20:43:16 UTC 2012


 java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.hbm.xml                                     |    1 
 java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.java                                        |   16 
 java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/ProvisionVirtualizationWizardAction.java                 |   33 +
 java/code/src/com/redhat/rhn/frontend/dto/kickstart/KickstartDto.java                                                        |   34 -
 java/code/src/com/redhat/rhn/frontend/events/TraceBackEvent.java                                                             |    6 
 java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml                                                  |    8 
 java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml                                                   |   21 
 java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java                                                       |  176 ++++--
 java/code/src/com/redhat/rhn/manager/action/ActionManager.java                                                               |  257 +++++-----
 java/code/src/com/redhat/rhn/manager/kickstart/ProvisionVirtualInstanceCommand.java                                          |   51 +
 java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java                                      |   37 +
 java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf                                            |    1 
 java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/virt-options.jspf                                         |    9 
 java/code/webapp/WEB-INF/pages/systems/details/virtualization/provision/first.jsp                                            |    3 
 java/code/webapp/WEB-INF/struts-config.xml                                                                                   |    1 
 java/spacewalk-java.spec                                                                                                     |    5 
 rel-eng/packages/spacewalk-java                                                                                              |    2 
 schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/109-rhnactionkickstartguest_mac_address_column_add.sql |    1 
 18 files changed, 432 insertions(+), 230 deletions(-)

New commits:
commit b4deea03d9894d61add021bf5024c1f7ef537290
Author: Stephen Herr <sherr at redhat.com>
Date:   Fri Jun 29 16:43:02 2012 -0400

    Automatic commit of package [spacewalk-java] release [1.8.104-1].

diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 17be059..5d0f0b5 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -23,7 +23,7 @@ Name: spacewalk-java
 Summary: Spacewalk Java site packages
 Group: Applications/Internet
 License: GPLv2
-Version: 1.8.103
+Version: 1.8.104
 Release: 1%{?dist}
 URL:       https://fedorahosted.org/spacewalk
 Source0:   https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz 
@@ -616,6 +616,9 @@ fi
 %{jardir}/postgresql-jdbc.jar
 
 %changelog
+* Fri Jun 29 2012 Stephen Herr <sherr at redhat.com> 1.8.104-1
+- 836656 - Allow user to set MAC Address when provisioning a virtual guest
+
 * Thu Jun 28 2012 Tomas Lestach <tlestach at redhat.com> 1.8.103-1
 - 795565 - add API doc for channel.software.listErrata update_date attribute
 - 795565 - remove "date" from the channel.software.listErrata API doc
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index b9a25b6..50707cf 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.8.103-1 java/
+1.8.104-1 java/


commit 8a0662ebdac23e411c8ba138fb0df489084eef92
Author: Stephen Herr <sherr at redhat.com>
Date:   Fri Jun 29 16:28:11 2012 -0400

    836656 - Allow user to set MAC Address when provisioning a virtual guest

diff --git a/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.hbm.xml b/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.hbm.xml
index ea37010..38232ed 100644
--- a/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.hbm.xml
@@ -19,6 +19,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
         <property name="guestName" type="string" column="guest_name"/>
         <property name="diskPath" type="string" column="disk_path"/>
         <property name="virtBridge" type="string" column="virt_bridge"/>
+        <property name="macAddress" type="string" column="mac_address"/>
 	    <property name="memMb" type="long" column="mem_kb"/>
         <property name="vcpus" type="long" column="vcpus"/>
         <property name="diskGb" type="long" column="disk_gb"/>
diff --git a/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.java b/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.java
index cc424bf..e89e205 100644
--- a/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.java
+++ b/java/code/src/com/redhat/rhn/domain/action/kickstart/KickstartGuestActionDetails.java
@@ -28,9 +28,23 @@ public class KickstartGuestActionDetails extends BaseKickstartActionDetails {
     private Long diskGb;
     private String virtBridge;
     private String diskPath;
+    private String macAddress;
 
+    /**
+     * Returns the mac address
+     * @return the mac address
+     */
+    public String getMacAddress() {
+        return this.macAddress;
+    }
 
-
+    /**
+     * Sets the mac address
+     * @param macAddressIn the mac address to set
+     */
+    public void setMacAddress(String macAddressIn) {
+        this.macAddress = macAddressIn;
+    }
 
     /**
      * Returns the kickstart session ID.
diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/ProvisionVirtualizationWizardAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/ProvisionVirtualizationWizardAction.java
index bf06e28..0e0cd9d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/ProvisionVirtualizationWizardAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/ProvisionVirtualizationWizardAction.java
@@ -57,6 +57,7 @@ public class ProvisionVirtualizationWizardAction extends ScheduleKickstartWizard
     public static final String VIRTUAL_BRIDGE = "virtBridge";
     public static final String VIRTUAL_FILE_PATH = "diskPath";
     public static final String LOCAL_STORAGE_GB = "localStorageGigabytes";
+    public static final String MAC_ADDRESS = "macAddress";
     public static final String PROFILE = "cobbler_profile";
 
     public static final String GUEST_NAME = "guestName";
@@ -86,6 +87,10 @@ public class ProvisionVirtualizationWizardAction extends ScheduleKickstartWizard
             form.set(LOCAL_STORAGE_GB, "");
         }
 
+        if (StringUtils.isEmpty(form.getString(MAC_ADDRESS))) {
+            form.set(MAC_ADDRESS, "");
+        }
+
         // Check if the server already has rhnVirtHost package installed.
         InstalledPackage rhnVirtHost = PackageFactory.lookupByNameAndServer(
                 ChannelManager.RHN_VIRT_HOST_PACKAGE_NAME, system);
@@ -216,6 +221,18 @@ public class ProvisionVirtualizationWizardAction extends ScheduleKickstartWizard
         else {
             cmd.setVirtBridge(this.getCobblerProfile(ctx).getVirtBridge());
         }
+        if (!StringUtils.isEmpty(form.getString(MAC_ADDRESS))) {
+            String macAddress = form.getString(MAC_ADDRESS);
+            macAddress = macAddress.replace(":", "");
+            macAddress = macAddress.toLowerCase();
+            macAddress = macAddress.substring(0, 2) + ":" +
+                    macAddress.substring(2, 4) + ":" +
+                    macAddress.substring(4, 6) + ":" +
+                    macAddress.substring(6, 8) + ":" +
+                    macAddress.substring(8, 10) + ":" +
+                    macAddress.substring(10);
+            cmd.setMacAddress(macAddress);
+        }
         cmd.setFilePath(form.getString(VIRTUAL_FILE_PATH));
         storeProxyInfo(form, ctx, cmd);
         // Store the new KickstartSession to the DB.
@@ -293,6 +310,22 @@ public class ProvisionVirtualizationWizardAction extends ScheduleKickstartWizard
             }
         }
 
+        if (!StringUtils.isEmpty(form.getString(MAC_ADDRESS))) {
+            try {
+                String macAddress = form.getString(MAC_ADDRESS);
+                macAddress = macAddress.replace(":", "");
+                if (macAddress.length() != 12 ||
+                        !macAddress.matches("^[0-9a-fA-F]+$")) {
+                    throw new NumberFormatException();
+                }
+            }
+            catch (NumberFormatException e) {
+                errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage(
+                        "frontend.actions.systems.virt.invalidmacaddressvalue"));
+                form.set(MAC_ADDRESS, "");
+            }
+        }
+
         return errors;
     }
 
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/kickstart/KickstartDto.java b/java/code/src/com/redhat/rhn/frontend/dto/kickstart/KickstartDto.java
index 58db7b3..0a175b7 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/kickstart/KickstartDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/kickstart/KickstartDto.java
@@ -39,6 +39,7 @@ public class KickstartDto extends BaseDto {
     private int virtSpace;
     private int virtCpus;
     private String virtBridge;
+    private String macAddress;
 
 
     /**
@@ -58,6 +59,7 @@ public class KickstartDto extends BaseDto {
     /**
      * @return the id
      */
+    @Override
     public Long getId() {
         return id;
     }
@@ -65,9 +67,9 @@ public class KickstartDto extends BaseDto {
     /**
      * @param idIn The id to set.
      */
-     public void setId(Long idIn) {
-         this.id = idIn;
-     }
+    public void setId(Long idIn) {
+        this.id = idIn;
+    }
 
     /**
      * @return the orgId
@@ -79,9 +81,9 @@ public class KickstartDto extends BaseDto {
     /**
      * @param orgIdIn The id to set.
      */
-     public void setOrgId(Long orgIdIn) {
-         this.orgId = orgIdIn;
-     }
+    public void setOrgId(Long orgIdIn) {
+        this.orgId = orgIdIn;
+    }
 
     /**
      * @return the kickstart tree id
@@ -93,9 +95,9 @@ public class KickstartDto extends BaseDto {
     /**
      * @param kstreeIdIn The kstree id to set.
      */
-     public void setKstreeId(Long kstreeIdIn) {
-         this.kstreeId = kstreeIdIn;
-     }
+    public void setKstreeId(Long kstreeIdIn) {
+        this.kstreeId = kstreeIdIn;
+    }
 
     /**
      * @return Returns the label.
@@ -257,4 +259,18 @@ public class KickstartDto extends BaseDto {
     public void setVirtBridge(String virtBridgeIn) {
         this.virtBridge = virtBridgeIn;
     }
+
+    /**
+     * @return Returns the mac address
+     */
+    public String getMacAddress() {
+        return macAddress;
+    }
+
+    /**
+     * @param macAddressIn the macAddress to set
+     */
+    public void setMacAddress(String macAddressIn) {
+        this.macAddress = macAddressIn;
+    }
 }
diff --git a/java/code/src/com/redhat/rhn/frontend/events/TraceBackEvent.java b/java/code/src/com/redhat/rhn/frontend/events/TraceBackEvent.java
index 6017d14..0603cfa 100644
--- a/java/code/src/com/redhat/rhn/frontend/events/TraceBackEvent.java
+++ b/java/code/src/com/redhat/rhn/frontend/events/TraceBackEvent.java
@@ -41,6 +41,7 @@ public class TraceBackEvent extends BaseEvent implements EventMessage {
      *                  request values
      * @return Text of email.
      */
+    @Override
     public String toText() {
         StringWriter sw = new StringWriter();
         PrintWriter out = new PrintWriter(sw);
@@ -71,7 +72,8 @@ public class TraceBackEvent extends BaseEvent implements EventMessage {
             out.println(":");
             out.println(request.toString());
 
-            if (request.getMethod().equals("POST")) {
+            if (request.getMethod() != null &&
+                    request.getMethod().equals("POST")) {
                 out.print(ls.getMessage("form variables", getUserLocale()));
                 out.println(":");
                 Enumeration ne = request.getParameterNames();
@@ -129,7 +131,7 @@ public class TraceBackEvent extends BaseEvent implements EventMessage {
      * @return hashmark string
      */
     public String getHashMarks() {
-      return TraceBackEvent.HASHES;
+        return TraceBackEvent.HASHES;
     }
 
     /**
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 4cb60c5..6110fe1 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7821,6 +7821,14 @@ Follow this url to see the full list of inactive systems:
           <source>Only natural numbers are accepted as storage values.</source>
       </trans-unit>
 
+       <trans-unit id="frontend.actions.systems.virt.invalidmacaddressvalue">
+          <source>MAC Addresses must be of the form XX:XX:XX:XX:XX:XX where all X's are hexedecimal values.</source>
+      </trans-unit>
+
+       <trans-unit id="frontend.actions.systems.virt.duplicatemacaddressvalue">
+          <source>MAC Addresses must be unique. This MAC Address has already been recorded. Please choose a different MAC Address.</source>
+      </trans-unit>
+
        <trans-unit id="frontend.actions.channels.manager.add.viewChannels">
           <source>View Associated Channels</source>
       </trans-unit>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 8c8a3a7..b404edc 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -8934,6 +8934,20 @@ Please note that some manual configuration of these scripts may still be require
     </trans-unit>
 
 
+    <trans-unit id="kickstartdetails.jsp.mac_address">
+        <source>MAC Address</source>
+        <context-group name="ctx">
+            <context context-type="sourcefile">/rhn/kickstart</context>
+        </context-group>
+    </trans-unit>
+
+    <trans-unit id="kickstartdetails.jsp.mac_address.tip">
+        <source>&lt;strong&gt;Tip:&lt;/strong&gt; Leaving this field blank will cause your VM to use a random MAC address. You cannot set a default MAC address in a kickstart profile.</source>
+        <context-group name="ctx">
+            <context context-type="sourcefile">/rhn/kickstart</context>
+        </context-group>
+    </trans-unit>
+
     <trans-unit id="kickstartdetails.jsp.virt_disk_path">
         <source>Virtual Storage Path</source>
         <context-group name="ctx">
@@ -16138,6 +16152,13 @@ the &lt;a href=&quot;/rhn/kickstart/ActivationKeysList.do?ksid={0}&quot;&gt;Acti
         </context-group>
     </trans-unit>
 
+    <trans-unit id="kickstart.channel.macAddress.jsp">
+        <source>Mac Address</source>
+        <context-group name="ctx">
+            <context context-type="sourcefile">/rhn/systems/details/virtualization/ProvisionVirtualizationWizard.do</context>
+        </context-group>
+    </trans-unit>
+
 
     <trans-unit id="kickstart.distro.cobbler-only.tooltip">
         <source> Profiles that are not @@PRODUCT_NAME@@-managed are not guaranteed to register systems to @@PRODUCT_NAME@@ after kickstart. You may wish to review these kickstarts (click on the profile name to do so) to confirm whether or not your system will reappear in the @@PRODUCT_NAME@@ system list after kickstart.</source>
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
index 2f7257a..796d8c0 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
@@ -177,7 +177,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype string
      */
     public String obtainReactivationKey(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -202,7 +202,7 @@ public class SystemHandler extends BaseHandler {
 
         String note = "Reactivation key for " + server.getName() + ".";
         ActivationKey key = ActivationKeyManager.getInstance().
-        createNewReActivationKey(loggedInUser, server, note);
+                createNewReActivationKey(loggedInUser, server, note);
 
         key.setUsageLimit(new Long(1));
 
@@ -225,7 +225,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype string
      */
     public String obtainReactivationKey(String clientCert)
-    throws FaultException, MethodInvalidParamException {
+            throws FaultException, MethodInvalidParamException {
         StringReader rdr = new StringReader(clientCert);
         Server server = null;
 
@@ -275,7 +275,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int upgradeEntitlement(String sessionKey, Integer sid, String entitlementLevel)
-    throws FaultException {
+            throws FaultException {
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -291,7 +291,7 @@ public class SystemHandler extends BaseHandler {
         }
 
         long availableSlots = ServerGroupFactory
-        .lookupEntitled(entitlement, loggedInUser.getOrg()).getAvailableSlots();
+                .lookupEntitled(entitlement, loggedInUser.getOrg()).getAvailableSlots();
         if (availableSlots < 1) {
             throw new NotEnoughEntitlementsException();
         }
@@ -332,7 +332,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int setChildChannels(String sessionKey, Integer sid, List channelIdsOrLabels)
-    throws FaultException {
+            throws FaultException {
 
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
@@ -409,16 +409,18 @@ public class SystemHandler extends BaseHandler {
      */
     @Deprecated
     public int setBaseChannel(String sessionKey, Integer sid, Integer cid)
-    throws FaultException {
+            throws FaultException {
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
         UpdateBaseChannelCommand cmd =
-            new UpdateBaseChannelCommand(loggedInUser, server, new Long(cid.longValue()));
+                new UpdateBaseChannelCommand(
+                        loggedInUser, server, new Long(cid.longValue()));
         ValidatorError ve = cmd.store();
         if (ve != null) {
             throw new InvalidChannelException(
-                LocalizationService.getInstance().getMessage(ve.getKey(), ve.getValues()));
+                    LocalizationService.getInstance()
+                    .getMessage(ve.getKey(), ve.getValues()));
         }
         return 1;
     }
@@ -444,7 +446,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int setBaseChannel(String sessionKey, Integer sid, String channelLabel)
-    throws FaultException {
+            throws FaultException {
 
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
@@ -472,8 +474,8 @@ public class SystemHandler extends BaseHandler {
         }
         ValidatorError ve = cmd.store();
         if (ve != null) {
-            throw new InvalidChannelException(
-                LocalizationService.getInstance().getMessage(ve.getKey(), ve.getValues()));
+            throw new InvalidChannelException(LocalizationService.getInstance()
+                    .getMessage(ve.getKey(), ve.getValues()));
         }
         return 1;
     }
@@ -539,7 +541,7 @@ public class SystemHandler extends BaseHandler {
      *
      */
     public Object[] listSubscribableBaseChannels(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
 
         //Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
@@ -548,10 +550,10 @@ public class SystemHandler extends BaseHandler {
         List returnList = new ArrayList();
 
         List<EssentialChannelDto> list =
-            ChannelManager.listBaseChannelsForSystem(loggedInUser, server);
+                ChannelManager.listBaseChannelsForSystem(loggedInUser, server);
         for (EssentialChannelDto ch : list) {
             Boolean currentBase = (baseChannel != null) &&
-            baseChannel.getId().equals(ch.getId());
+                    baseChannel.getId().equals(ch.getId());
             returnList.add(createChannelMap(ch, currentBase));
         }
 
@@ -639,7 +641,7 @@ public class SystemHandler extends BaseHandler {
      */
     @Deprecated
     public Object[] listChildChannels(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
 
         return listSubscribableChildChannels(sessionKey, sid);
     }
@@ -670,7 +672,7 @@ public class SystemHandler extends BaseHandler {
      *      #array_end()
      */
     public Object[] listSubscribableChildChannels(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -741,7 +743,7 @@ public class SystemHandler extends BaseHandler {
      */
     public Object[] listOlderInstalledPackages(String sessionKey, Integer sid,
             String name, String version, String release, String epoch)
-    throws FaultException {
+                    throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -806,7 +808,7 @@ public class SystemHandler extends BaseHandler {
      */
     public Object[] listNewerInstalledPackages(String sessionKey, Integer sid,
             String name, String version, String release, String epoch)
-    throws FaultException {
+                    throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -999,7 +1001,7 @@ public class SystemHandler extends BaseHandler {
      *      #struct_end()
      */
     public Object[] listLatestUpgradablePackages(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1031,7 +1033,7 @@ public class SystemHandler extends BaseHandler {
      *      #struct_end()
      */
     public Object[] listLatestInstallablePackages(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1089,8 +1091,8 @@ public class SystemHandler extends BaseHandler {
             if (pkgEvr != null) {
                 // find the latest package available to each system
                 Package pkg = PackageManager.guestimatePackageBySystem(sid.longValue(),
-                              (Long) pkgEvr.get("name_id"), (Long) pkgEvr.get("evr_id"),
-                                         null, loggedInUser.getOrg());
+                        (Long) pkgEvr.get("name_id"), (Long) pkgEvr.get("evr_id"),
+                        null, loggedInUser.getOrg());
 
                 // build the hash to return
                 if (pkg != null) {
@@ -1230,14 +1232,14 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public Integer deleteGuestProfiles(String sessionKey, Integer hostId,
-        List<String> guestNames) {
+            List<String> guestNames) {
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, hostId);
 
         if (server != null && !server.isVirtualHost()) {
             throw new FaultException(1005, "notAHostSystem",
-                "The system ID specified (" + hostId +
-                ") does not represent a host system");
+                    "The system ID specified (" + hostId +
+                    ") does not represent a host system");
         }
 
         List<String> availableGuests = new ArrayList();
@@ -1259,7 +1261,7 @@ public class SystemHandler extends BaseHandler {
 
             if (vi.isRegisteredGuest()) {
                 throw new SystemsNotDeletedException("Unable to delete guest profile " +
-                    vi.getName() + ": the guest is registered.");
+                        vi.getName() + ": the guest is registered.");
             }
             server.removeGuest(vi);
         }
@@ -1283,7 +1285,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int deleteSystems(String sessionKey, List<Integer> systemIds)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
 
@@ -1308,13 +1310,13 @@ public class SystemHandler extends BaseHandler {
 
         // Fire the request off asynchronously
         SsmDeleteServersEvent event =
-            new SsmDeleteServersEvent(loggedInUser, deletion);
+                new SsmDeleteServersEvent(loggedInUser, deletion);
         MessageQueue.publish(event);
 
         // If we skipped any systems, create an error message and throw a FaultException
         if (skippedSids.size() > 0) {
             StringBuilder msg = new StringBuilder(
-            "The following systems were NOT deleted: ");
+                    "The following systems were NOT deleted: ");
             for (Integer sid :  skippedSids) {
                 msg.append("\n" + sid);
             }
@@ -1426,7 +1428,7 @@ public class SystemHandler extends BaseHandler {
      *      #array_end()
      */
     public List getNetworkDevices(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1603,7 +1605,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int setCustomValues(String sessionKey, Integer sid, Map values)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1634,7 +1636,7 @@ public class SystemHandler extends BaseHandler {
             // We need to throw an exception. Append each undefined key to the
             // exception message.
             StringBuffer msg = new StringBuffer("One or more of the following " +
-            "custom info fields was not defined: ");
+                    "custom info fields was not defined: ");
 
             for (Iterator itr = skippedKeys.iterator(); itr.hasNext();) {
                 String label = (String) itr.next();
@@ -1706,7 +1708,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int deleteCustomValues(String sessionKey, Integer sid, List<String> keys)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1738,7 +1740,7 @@ public class SystemHandler extends BaseHandler {
             // We need to throw an exception. Append each undefined key to the
             // exception message.
             StringBuffer msg = new StringBuffer("One or more of the following " +
-            "custom info fields was not defined: ");
+                    "custom info fields was not defined: ");
 
             for (String label : skippedKeys) {
                 msg.append("\n" + label);
@@ -1764,7 +1766,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int setProfileName(String sessionKey, Integer sid, String name)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -1807,7 +1809,7 @@ public class SystemHandler extends BaseHandler {
      * @xmlrpc.returntype #return_int_success()
      */
     public int addNote(String sessionKey, Integer sid, String subject, String body)
-    throws FaultException {
+            throws FaultException {
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
         Server server = lookupServer(loggedInUser, sid);
@@ -2149,7 +2151,7 @@ public class SystemHandler extends BaseHandler {
      * @return Returns 1 if successful, exception otherwise
      *
      * @xmlrpc.doc Provision a guest on the host specified.  Defaults to:
-     * memory=512MB, vcpu=1, storage=3GB.
+     * memory=512MB, vcpu=1, storage=3GB, mac_address=random.
      * @xmlrpc.param #param("string", "sessionKey")
      * @xmlrpc.param #param_desc("int", "serverId", "ID of host to provision guest on.")
      * @xmlrpc.param #param("string", "guestName")
@@ -2159,7 +2161,7 @@ public class SystemHandler extends BaseHandler {
     public int provisionVirtualGuest(String sessionKey, Integer sid, String guestName,
             String profileName) {
         return provisionVirtualGuest(sessionKey, sid, guestName, profileName,
-                new Integer(512), new Integer(1), new Integer(3));
+                new Integer(512), new Integer(1), new Integer(3), "");
     }
 
     /**
@@ -2180,7 +2182,7 @@ public class SystemHandler extends BaseHandler {
      * on error
      */
     public int provisionSystem(String sessionKey, Integer serverId, String profileName)
-    throws FaultException {
+            throws FaultException {
         log.debug("provisionSystem called.");
         User loggedInUser = getLoggedInUser(sessionKey);
 
@@ -2188,12 +2190,12 @@ public class SystemHandler extends BaseHandler {
         Server server = lookupServer(loggedInUser, serverId);
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement");
+                    "System does not have provisioning entitlement");
         }
 
         KickstartData ksdata = KickstartFactory.
-        lookupKickstartDataByLabelAndOrgId(profileName,
-                loggedInUser.getOrg().getId());
+                lookupKickstartDataByLabelAndOrgId(profileName,
+                        loggedInUser.getOrg().getId());
         if (ksdata == null) {
             throw new FaultException(-3, "kickstartProfileNotFound",
                     "No Kickstart Profile found with label: " + profileName);
@@ -2234,7 +2236,7 @@ public class SystemHandler extends BaseHandler {
      */
     public int provisionSystem(String sessionKey, Integer serverId,
             String profileName, Date earliestDate)
-    throws FaultException {
+                    throws FaultException {
         log.debug("provisionSystem called.");
         User loggedInUser = getLoggedInUser(sessionKey);
 
@@ -2242,12 +2244,12 @@ public class SystemHandler extends BaseHandler {
         Server server = lookupServer(loggedInUser, serverId);
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement");
+                    "System does not have provisioning entitlement");
         }
 
         KickstartData ksdata = KickstartFactory.
-        lookupKickstartDataByLabelAndOrgId(profileName,
-                loggedInUser.getOrg().getId());
+                lookupKickstartDataByLabelAndOrgId(profileName,
+                        loggedInUser.getOrg().getId());
         if (ksdata == null) {
             throw new FaultException(-3, "kickstartProfileNotFound",
                     "No Kickstart Profile found with label: " + profileName);
@@ -2283,7 +2285,7 @@ public class SystemHandler extends BaseHandler {
      *
      * @xmlrpc.doc Provision a guest on the host specified.  This schedules the guest
      * for creation and will begin the provisioning process when the host checks in
-     * or if OSAD is enabled will begin immediately.
+     * or if OSAD is enabled will begin immediately. Defaults to mac_address=random.
      *
      * @xmlrpc.param #param("string", "sessionKey")
      * @xmlrpc.param #param_desc("int", "serverId", "ID of host to provision guest on.")
@@ -2297,12 +2299,49 @@ public class SystemHandler extends BaseHandler {
      */
     public int provisionVirtualGuest(String sessionKey, Integer sid, String guestName,
             String profileName, Integer memoryMb, Integer vcpus, Integer storageGb) {
+        return provisionVirtualGuest(sessionKey, sid, guestName, profileName,
+                memoryMb, vcpus, storageGb, "");
+    }
+
+    /**
+     * Provision a guest on the server specified.
+     *
+     * @param sessionKey of user making call
+     * @param sid of server to provision guest on
+     * @param guestName to assign to guest
+     * @param profileName of Kickstart Profile to use.
+     * @param memoryMb to allocate to the guest (maxMemory)
+     * @param vcpus to assign
+     * @param storageGb to assign to disk
+     * @param macAddress to assign
+     * @return Returns 1 if successful, exception otherwise
+     *
+     * @xmlrpc.doc Provision a guest on the host specified.  This schedules the guest
+     * for creation and will begin the provisioning process when the host checks in
+     * or if OSAD is enabled will begin immediately.
+     *
+     * @xmlrpc.param #param("string", "sessionKey")
+     * @xmlrpc.param #param_desc("int", "serverId", "ID of host to provision guest on.")
+     * @xmlrpc.param #param("string", "guestName")
+     * @xmlrpc.param #param_desc("string", "profileName", "Kickstart Profile to use.")
+     * @xmlrpc.param #param_desc("int", "memoryMb", "Memory to allocate to the guest")
+     * @xmlrpc.param #param_desc("int", "vcpus", "Number of virtual CPUs to allocate to
+     *                                          the guest.")
+     * @xmlrpc.param #param_desc("int", "storageGb", "Size of the guests disk image.")
+     * @xmlrpc.param #param_desc("string", "macAddress", "macAddress to give the guest's
+     *                                          virtual networking hardware.")
+     * @xmlrpc.returntype #return_int_success()
+     */
+    public int provisionVirtualGuest(String sessionKey, Integer sid,
+            String guestName, String profileName, Integer memoryMb,
+            Integer vcpus, Integer storageGb, String macAddress) {
         log.debug("provisionVirtualGuest called.");
         User loggedInUser = getLoggedInUser(sessionKey);
         // Lookup the server so we can validate it exists and throw error if not.
         lookupServer(loggedInUser, sid);
         KickstartData ksdata = KickstartFactory.
-        lookupKickstartDataByLabelAndOrgId(profileName, loggedInUser.getOrg().getId());
+                lookupKickstartDataByLabelAndOrgId(profileName, loggedInUser
+                        .getOrg().getId());
 
         if (ksdata == null) {
             throw new FaultException(-3, "kickstartProfileNotFound",
@@ -2317,6 +2356,8 @@ public class SystemHandler extends BaseHandler {
         cmd.setMemoryAllocation(new Long(memoryMb));
         cmd.setVirtualCpus(new Long(vcpus.toString()));
         cmd.setLocalStorageSize(new Long(storageGb));
+        // setting an empty string generates a random mac address
+        cmd.setMacAddress(macAddress);
         // setting an empty string generates a default virt path
         cmd.setFilePath("");
         // Store the new KickstartSession to the DB.
@@ -2535,7 +2576,7 @@ public class SystemHandler extends BaseHandler {
                 return server.getRunningKernel();
             }
             return LocalizationService.getInstance().getMessage(
-            "server.runningkernel.unknown");
+                    "server.runningkernel.unknown");
         }
         catch (LookupException e) {
             throw new NoSuchSystemException(e);
@@ -2701,7 +2742,7 @@ public class SystemHandler extends BaseHandler {
         }
 
         ErrataManager.applyErrataHelper(getLoggedInUser(sessionKey),
-                                        longServerIds, errataIds, earliestOccurrence);
+                longServerIds, errataIds, earliestOccurrence);
         return 1;
     }
 
@@ -3761,7 +3802,7 @@ public class SystemHandler extends BaseHandler {
         User loggedInUser = getLoggedInUser(sessionKey);
 
         DataResult profiles = ProfileManager.listProfileOverviews(
-                                             loggedInUser.getOrg().getId());
+                loggedInUser.getOrg().getId());
 
         return profiles.toArray();
     }
@@ -3783,7 +3824,7 @@ public class SystemHandler extends BaseHandler {
 
         // make sure the user can access this profile
         Profile profile = ProfileManager.lookupByIdAndOrg(profileId.longValue(),
-                                                          loggedInUser.getOrg());
+                loggedInUser.getOrg());
 
         return ProfileManager.deleteProfile(profile);
     }
@@ -4381,7 +4422,7 @@ public class SystemHandler extends BaseHandler {
      *      #array_end()
      */
     public Object[] getConnectionPath(String sessionKey, Integer sid)
-    throws FaultException {
+            throws FaultException {
 
         // Get the logged in user and server
         User loggedInUser = getLoggedInUser(sessionKey);
@@ -4486,7 +4527,7 @@ public class SystemHandler extends BaseHandler {
      * is not being included.
      */
     public int setupStaticNetwork(String clientcert, Map<String, Object> data,
-        Map<String, Object> data6) {
+            Map<String, Object> data6) {
         SystemRecord rec = getSystemRecordFromClientCert(clientcert);
         if (rec == null) {
             throw new NoSuchSystemException();
@@ -4514,7 +4555,8 @@ public class SystemHandler extends BaseHandler {
         String ksDistro = (String) meta.get(KickstartFormatter.KS_DISTRO);
 
         String command = KickstartFormatter.makeStaticNetworkCommand(device, hostName,
-            nameservers.get(0), ip4, nm4, gw4, ip6, nm6, gw6, preferIpv6Gateway, ksDistro);
+                nameservers.get(0), ip4, nm4, gw4, ip6, nm6, gw6,
+                preferIpv6Gateway, ksDistro);
 
         rec.setHostName(hostName);
         rec.setGateway((preferIpv6Gateway) ? gw6 : gw4);
@@ -4557,7 +4599,7 @@ public class SystemHandler extends BaseHandler {
 
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement");
+                    "System does not have provisioning entitlement");
         }
 
         KickstartData ksData = lookupKsData(ksLabel, loggedInUser.getOrg());
@@ -4612,7 +4654,7 @@ public class SystemHandler extends BaseHandler {
 
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement");
+                    "System does not have provisioning entitlement");
         }
 
         SystemRecord rec = SystemRecord.lookupById(
@@ -4675,7 +4717,7 @@ public class SystemHandler extends BaseHandler {
 
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement");
+                    "System does not have provisioning entitlement");
         }
 
         SystemRecord rec = SystemRecord.lookupById(
@@ -4724,7 +4766,7 @@ public class SystemHandler extends BaseHandler {
     public List listDuplicatesByIp(String sessionKey) {
         User loggedInUser = getLoggedInUser(sessionKey);
         List<DuplicateSystemGrouping> list =
-            SystemManager.listDuplicatesByIP(loggedInUser, 0L);
+                SystemManager.listDuplicatesByIP(loggedInUser, 0L);
         return transformDuplicate(list, "ip");
     }
 
@@ -4749,7 +4791,7 @@ public class SystemHandler extends BaseHandler {
     public List listDuplicatesByMac(String sessionKey) {
         User loggedInUser = getLoggedInUser(sessionKey);
         List<DuplicateSystemGrouping> list =
-            SystemManager.listDuplicatesByMac(loggedInUser, 0L);
+                SystemManager.listDuplicatesByMac(loggedInUser, 0L);
         return transformDuplicate(list, "mac");
     }
 
@@ -4774,7 +4816,7 @@ public class SystemHandler extends BaseHandler {
     public List listDuplicatesByHostname(String sessionKey) {
         User loggedInUser = getLoggedInUser(sessionKey);
         List<DuplicateSystemGrouping> list =
-            SystemManager.listDuplicatesByHostname(loggedInUser, 0L);
+                SystemManager.listDuplicatesByHostname(loggedInUser, 0L);
         return transformDuplicate(list, "hostname");
     }
 
@@ -4813,7 +4855,7 @@ public class SystemHandler extends BaseHandler {
     public List listEligibleFlexGuests(String sessionKey) {
         User user = getLoggedInUser(sessionKey);
         return VirtualizationEntitlementsManager.
-                    getInstance().listEligibleFlexGuests(user);
+                getInstance().listEligibleFlexGuests(user);
     }
 
     /**
@@ -4833,10 +4875,10 @@ public class SystemHandler extends BaseHandler {
      *                  that were converted to use flex entitlement.
      */
     public int convertToFlexEntitlement(String sessionKey,
-                List serverIds, String channelFamilyLabel) {
+            List serverIds, String channelFamilyLabel) {
         User user = getLoggedInUser(sessionKey);
         ChannelFamily cf = ChannelFamilyFactory.lookupByLabel(
-                                    channelFamilyLabel, user.getOrg());
+                channelFamilyLabel, user.getOrg());
         if (cf == null) {
             throw new InvalidEntitlementException();
         }
@@ -4846,7 +4888,7 @@ public class SystemHandler extends BaseHandler {
             longServerIds.add(new Long((Integer) it.next()));
         }
         return VirtualizationEntitlementsManager.getInstance().
-                            convertToFlex(longServerIds, cf.getId(), user).size();
+                convertToFlex(longServerIds, cf.getId(), user).size();
     }
 
     /**
@@ -4952,7 +4994,7 @@ public class SystemHandler extends BaseHandler {
         Server server = lookupServer(loggedInUser, serverId);
         if (!(server.hasEntitlement(EntitlementManager.PROVISIONING))) {
             throw new FaultException(-2, "provisionError",
-            "System does not have provisioning entitlement: " + server.getId());
+                    "System does not have provisioning entitlement: " + server.getId());
         }
         List<ServerSnapshot> snps = ServerFactory.listSnapshots(loggedInUser.getOrg(),
                 server, null, null);
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 5fbab36..ede85c5 100644
--- a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
+++ b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
@@ -159,7 +159,7 @@ public class ActionManager extends BaseManager {
         if (returnedAction == null) {
             LocalizationService ls = LocalizationService.getInstance();
             LookupException e =
-                new LookupException("Could not find action with id: " + aid);
+                    new LookupException("Could not find action with id: " + aid);
             e.setLocalizedTitle(ls.getMessage("lookup.jsp.title.action"));
             e.setLocalizedReason1(ls.getMessage("lookup.jsp.reason1.action"));
             e.setLocalizedReason2(ls.getMessage("lookup.jsp.reason2.action"));
@@ -183,8 +183,8 @@ public class ActionManager extends BaseManager {
      * @return the Action found or null if none exists
      */
     public static Action lookupLastCompletedAction(User user,
-                                            ActionType type,
-                                            Server server) {
+            ActionType type,
+            Server server) {
         // TODO: check on user visibility ??
 
         return ActionFactory.lookupLastCompletedAction(user, type, server);
@@ -199,7 +199,7 @@ public class ActionManager extends BaseManager {
      */
     public static void archiveActions(User user, String label) {
         WriteMode m = ModeFactory.getWriteMode("Action_queries",
-                                               "archive_actions");
+                "archive_actions");
         Map params = new HashMap();
         params.put("user_id", user.getId());
         params.put("org_id", user.getOrg().getId());
@@ -291,7 +291,7 @@ public class ActionManager extends BaseManager {
      */
     public static Action createErrataAction(User user, Errata errata) {
         ErrataAction a = (ErrataAction)ActionFactory
-                             .createAction(ActionFactory.TYPE_ERRATA);
+                .createAction(ActionFactory.TYPE_ERRATA);
         if (user != null) {
             a.setSchedulerUser(user);
             a.setOrg(user.getOrg());
@@ -323,8 +323,8 @@ public class ActionManager extends BaseManager {
         //the given channel is the sandbox for the given server.
 
         ConfigUploadAction a =
-            (ConfigUploadAction)ActionFactory.createAction(
-                    ActionFactory.TYPE_CONFIGFILES_UPLOAD, earliest);
+                (ConfigUploadAction)ActionFactory.createAction(
+                        ActionFactory.TYPE_CONFIGFILES_UPLOAD, earliest);
         a.setOrg(user.getOrg());
         a.setSchedulerUser(user);
         a.setName(a.getActionType().getName());
@@ -366,8 +366,8 @@ public class ActionManager extends BaseManager {
      * @return The created diff action
      */
     public static Action createConfigDiffAction(User user,
-                                                Collection<Long> revisions,
-                                                Collection<Long> serverIds) {
+            Collection<Long> revisions,
+            Collection<Long> serverIds) {
         //diff actions are non-destructive, so there is no point to schedule them for any
         //later than now.
         return createConfigAction(user, revisions, serverIds,
@@ -402,21 +402,21 @@ public class ActionManager extends BaseManager {
         for (Long sid : serverConfigMap.keySet()) {
             if (ActionFactory.TYPE_CONFIGFILES_DEPLOY.equals(type) &&
                     !SystemManager.clientCapable(sid,
-                                 SystemManager.CAP_CONFIGFILES_DEPLOY)) {
-                 throw new MissingCapabilityException(SystemManager.CAP_CONFIGFILES_DEPLOY,
-                         ServerFactory.lookupById(sid));
+                            SystemManager.CAP_CONFIGFILES_DEPLOY)) {
+                throw new MissingCapabilityException(SystemManager.CAP_CONFIGFILES_DEPLOY,
+                        ServerFactory.lookupById(sid));
             }
             ActionFactory.addServerToAction(sid, a);
             //now that we made a server action, we must make config revision actions
             //which depend on the server as well.
             for (Long revId : serverConfigMap.get(sid)) {
-                  WriteMode m = ModeFactory.getWriteMode("Action_queries",
-                          "add_config_rev_to_action");
-                  Map params = new HashMap();
-                  params.put("sid", sid);
-                  params.put("aid", a.getId());
-                  params.put("crid", revId);
-                  m.executeUpdate(params);
+                WriteMode m = ModeFactory.getWriteMode("Action_queries",
+                        "add_config_rev_to_action");
+                Map params = new HashMap();
+                params.put("sid", sid);
+                params.put("aid", a.getId());
+                params.put("crid", revId);
+                m.executeUpdate(params);
             }
         }
         if (a.getServerActions().size() < 1) {
@@ -444,9 +444,9 @@ public class ActionManager extends BaseManager {
      * @return The created config action
      */
     public static Action createConfigActionForServers(User user,
-                                                Collection<Long> revisions,
-                                                Collection<Server> servers,
-                                                ActionType type, Date earliest) {
+            Collection<Long> revisions,
+            Collection<Server> servers,
+            ActionType type, Date earliest) {
         //create the action
         ConfigAction a = (ConfigAction)ActionFactory.createAction(type, earliest);
 
@@ -460,8 +460,8 @@ public class ActionManager extends BaseManager {
         a.setSchedulerUser(user);
         for (Server server : servers) {
             if (ActionFactory.TYPE_CONFIGFILES_DEPLOY.equals(type) &&
-                       !SystemManager.clientCapable(server.getId(),
-                                    SystemManager.CAP_CONFIGFILES_DEPLOY)) {
+                    !SystemManager.clientCapable(server.getId(),
+                            SystemManager.CAP_CONFIGFILES_DEPLOY)) {
                 throw new MissingCapabilityException(
                         SystemManager.CAP_CONFIGFILES_DEPLOY, server);
             }
@@ -472,7 +472,7 @@ public class ActionManager extends BaseManager {
             for (Long revId : revisions) {
                 try {
                     ConfigRevision rev = ConfigurationManager.getInstance()
-                        .lookupConfigRevision(user, revId);
+                            .lookupConfigRevision(user, revId);
                     ActionFactory.addConfigRevisionToAction(rev, server, a);
                 }
                 catch (LookupException e) {
@@ -522,8 +522,8 @@ public class ActionManager extends BaseManager {
         sa.setServer(server);
 
         SolarisPackagePatchRemoveAction patchAction =
-            (SolarisPackagePatchRemoveAction) ActionFactory.createAction(
-                ActionFactory.TYPE_SOLARISPKGS_PATCHREMOVE);
+                (SolarisPackagePatchRemoveAction) ActionFactory.createAction(
+                        ActionFactory.TYPE_SOLARISPKGS_PATCHREMOVE);
         patchAction.setOrg(user.getOrg());
         patchAction.setName("Patch Removal");
         patchAction.setSchedulerUser(user);
@@ -563,8 +563,8 @@ public class ActionManager extends BaseManager {
         sa.setServer(server);
 
         SolarisPackagePatchInstallAction patchAction =
-            (SolarisPackagePatchInstallAction) ActionFactory.createAction(
-                ActionFactory.TYPE_SOLARISPKGS_PATCHINSTALL);
+                (SolarisPackagePatchInstallAction) ActionFactory.createAction(
+                        ActionFactory.TYPE_SOLARISPKGS_PATCHINSTALL);
         patchAction.setOrg(user.getOrg());
         patchAction.setName("Patch Install");
         patchAction.setSchedulerUser(user);
@@ -576,7 +576,7 @@ public class ActionManager extends BaseManager {
         for (Iterator itr = set.getElements().iterator(); itr.hasNext();) {
             RhnSetElement rse = (RhnSetElement) itr.next();
             WriteMode m = ModeFactory.getWriteMode("Action_queries",
-                "schedule_action_no_arch");
+                    "schedule_action_no_arch");
             Map params = new HashMap();
             params.put("action_id", patchAction.getId());
             params.put("name_id", rse.getElement());
@@ -596,14 +596,14 @@ public class ActionManager extends BaseManager {
      *
      */
     public static Action createPatchSetInstallAction(User user,
-                                                     Server server,
-                                                     PatchSet patchSet) {
+            Server server,
+            PatchSet patchSet) {
 
         SolarisPackagePatchClusterInstallAction patchSetAction
-            = (SolarisPackagePatchClusterInstallAction)
-              createBaseAction(user,
-                               server,
-                               ActionFactory.TYPE_SOLARISPKGS_PATCHCLUSTERINSTALL);
+        = (SolarisPackagePatchClusterInstallAction)
+        createBaseAction(user,
+                server,
+                ActionFactory.TYPE_SOLARISPKGS_PATCHCLUSTERINSTALL);
 
         patchSetAction.setName("Patch Cluster Install");
 
@@ -666,10 +666,10 @@ public class ActionManager extends BaseManager {
      * @return The Action we have created
      *
      */
-     public static Action createBaseAction(User user, Server server, ActionType type) {
+    public static Action createBaseAction(User user, Server server, ActionType type) {
 
         Action action =
-            ActionFactory.createAction(type);
+                ActionFactory.createAction(type);
 
         action.setSchedulerUser(user);
         action.setOrg(user.getOrg());
@@ -683,7 +683,7 @@ public class ActionManager extends BaseManager {
         action.addServerAction(sa);
 
         return action;
-     }
+    }
 
     /**
      * Stores the action in the database through hibernate
@@ -728,9 +728,9 @@ public class ActionManager extends BaseManager {
      * @return A list containing the pending actions for the user
      */
     public static DataResult recentlyScheduledActions(User user, PageControl pc,
-                                                        long age) {
+            long age) {
         SelectMode m = ModeFactory.getMode("Action_queries",
-                                           "recently_scheduled_action_list");
+                "recently_scheduled_action_list");
         Map params = new HashMap();
         params.put("user_id", user.getId());
         params.put("org_id", user.getOrg().getId());
@@ -810,7 +810,7 @@ public class ActionManager extends BaseManager {
         return getActions(user, pc, "archived_action_list");
     }
 
-     /**
+    /**
      * Helper method that does the work of getting a specific
      * DataResult for scheduled actions.
      * @param user The user in question
@@ -856,7 +856,7 @@ public class ActionManager extends BaseManager {
      */
     public static DataResult getPackageList(Long aid, PageControl pc) {
         SelectMode m = ModeFactory.getMode("Package_queries",
-                           "packages_associated_with_action");
+                "packages_associated_with_action");
         Map params = new HashMap();
         params.put("aid", aid);
         if (pc != null) {
@@ -874,7 +874,7 @@ public class ActionManager extends BaseManager {
      */
     public static DataResult getErrataList(Long aid) {
         SelectMode m = ModeFactory.getMode("Errata_queries",
-                           "errata_associated_with_action");
+                "errata_associated_with_action");
 
         Map params = new HashMap();
         params.put("aid", aid);
@@ -941,9 +941,9 @@ public class ActionManager extends BaseManager {
      * @return Returns list containing the completed systems.
      */
     private static DataResult getActionSystems(User user,
-                                              Action action,
-                                              PageControl pc,
-                                              String mode) {
+            Action action,
+            PageControl pc,
+            String mode) {
 
         SelectMode m = ModeFactory.getMode("System_queries", mode);
         Map params = new HashMap();
@@ -966,8 +966,8 @@ public class ActionManager extends BaseManager {
      * @return Returns list containing the completed systems.
      */
     public static DataResult completedSystems(User user,
-                                              Action action,
-                                              PageControl pc) {
+            Action action,
+            PageControl pc) {
 
         return getActionSystems(user, action, pc, "systems_completed_action");
     }
@@ -981,8 +981,8 @@ public class ActionManager extends BaseManager {
      * @return Returns list containing the completed systems.
      */
     public static DataResult inProgressSystems(User user,
-                                              Action action,
-                                              PageControl pc) {
+            Action action,
+            PageControl pc) {
 
         return getActionSystems(user, action, pc, "systems_in_progress_action");
     }
@@ -996,8 +996,8 @@ public class ActionManager extends BaseManager {
      * @return Returns list containing the completed systems.
      */
     public static DataResult failedSystems(User user,
-                                              Action action,
-                                              PageControl pc) {
+            Action action,
+            PageControl pc) {
 
         return getActionSystems(user, action, pc, "systems_failed_action");
     }
@@ -1022,7 +1022,7 @@ public class ActionManager extends BaseManager {
     public static PackageAction schedulePackageRefresh(User scheduler, Server server,
             Date earliest) {
         PackageAction pa = (PackageAction) schedulePackageAction(scheduler,
-            (List) null, ActionFactory.TYPE_PACKAGES_REFRESH_LIST, earliest, server);
+                (List) null, ActionFactory.TYPE_PACKAGES_REFRESH_LIST, earliest, server);
         storeAction(pa);
         return pa;
     }
@@ -1052,7 +1052,7 @@ public class ActionManager extends BaseManager {
             // We need to schedule a hardware refresh to pull
             // in the packages.runTransaction capability
             Action hwrefresh =
-                scheduleHardwareRefreshAction(scheduler, server, earliest);
+                    scheduleHardwareRefreshAction(scheduler, server, earliest);
             ActionFactory.save(hwrefresh);
             action.setPrerequisite(hwrefresh);
         }
@@ -1144,7 +1144,7 @@ public class ActionManager extends BaseManager {
 
         // this is SOOOO WRONG, we need to get rid of DataSource
         m = ModeFactory.getWriteMode("Action_queries",
-            "insert_action_package_delta");
+                "insert_action_package_delta");
         Map params = new HashMap();
         params.put("action_id", action.getId());
         params.put("delta_id", pd.getId());
@@ -1177,10 +1177,10 @@ public class ActionManager extends BaseManager {
             Server srvr, RhnSet pkgs, Date earliestAction) {
         if (!srvr.isSolaris()) {
             return (PackageAction) schedulePackageAction(scheduler, srvr, pkgs,
-                ActionFactory.TYPE_PACKAGES_REMOVE, earliestAction);
+                    ActionFactory.TYPE_PACKAGES_REMOVE, earliestAction);
         }
         return (PackageAction) schedulePackageAction(scheduler, srvr, pkgs,
-            ActionFactory.TYPE_SOLARISPKGS_REMOVE, earliestAction);
+                ActionFactory.TYPE_SOLARISPKGS_REMOVE, earliestAction);
     }
 
 
@@ -1196,10 +1196,10 @@ public class ActionManager extends BaseManager {
             Server srvr, List<Map<String, Long>> pkgs, Date earliestAction) {
         if (!srvr.isSolaris()) {
             return (PackageAction) schedulePackageAction(scheduler, pkgs,
-                ActionFactory.TYPE_PACKAGES_REMOVE, earliestAction, srvr);
+                    ActionFactory.TYPE_PACKAGES_REMOVE, earliestAction, srvr);
         }
         return (PackageAction) schedulePackageAction(scheduler, pkgs,
-            ActionFactory.TYPE_SOLARISPKGS_REMOVE, earliestAction, srvr);
+                ActionFactory.TYPE_SOLARISPKGS_REMOVE, earliestAction, srvr);
     }
 
     /**
@@ -1224,12 +1224,12 @@ public class ActionManager extends BaseManager {
         // we'll end up with 2 actions created if the server list is mixed
         if (!rhelServers.isEmpty()) {
             schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_PACKAGES_REMOVE,
-                earliestAction, rhelServers);
+                    earliestAction, rhelServers);
         }
 
         if (!solarisServers.isEmpty()) {
             schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_SOLARISPKGS_REMOVE,
-                earliestAction, solarisServers);
+                    earliestAction, solarisServers);
         }
     }
 
@@ -1278,10 +1278,10 @@ public class ActionManager extends BaseManager {
             Server srvr, List pkgs, Date earliestAction) {
         if (!srvr.isSolaris()) {
             return (PackageAction) schedulePackageAction(scheduler, pkgs,
-                ActionFactory.TYPE_PACKAGES_UPDATE, earliestAction, srvr);
+                    ActionFactory.TYPE_PACKAGES_UPDATE, earliestAction, srvr);
         }
         return (PackageAction) schedulePackageAction(scheduler, pkgs,
-            ActionFactory.TYPE_SOLARISPKGS_INSTALL, earliestAction, srvr);
+                ActionFactory.TYPE_SOLARISPKGS_INSTALL, earliestAction, srvr);
     }
 
     /**
@@ -1305,12 +1305,12 @@ public class ActionManager extends BaseManager {
         // we'll end up with 2 actions created if the server list is mixed
         if (!rhelServers.isEmpty()) {
             schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_PACKAGES_UPDATE,
-                earliestAction, rhelServers);
+                    earliestAction, rhelServers);
         }
 
         if (!solarisServers.isEmpty()) {
             schedulePackageAction(scheduler, pkgs, ActionFactory.TYPE_SOLARISPKGS_INSTALL,
-                earliestAction, solarisServers);
+                    earliestAction, solarisServers);
         }
 
     }
@@ -1340,7 +1340,7 @@ 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 a script action for the given servers
@@ -1365,7 +1365,7 @@ public class ActionManager extends BaseManager {
             }
 
             if (!SystemManager.hasEntitlement(srvr.getId(),
-                        EntitlementManager.PROVISIONING)) {
+                    EntitlementManager.PROVISIONING)) {
                 throw new MissingEntitlementException(
                         EntitlementManager.PROVISIONING.getHumanReadableLabel());
             }
@@ -1397,7 +1397,7 @@ public class ActionManager extends BaseManager {
     }
 
     private static Action scheduleAction(User scheduler, ActionType type, String name,
-                                         Date earliestAction, Set<Long> serverIds) {
+            Date earliestAction, Set<Long> serverIds) {
         /**
          * We have to relookup the type here, because most likely a static final variable
          *  was passed in.  If we use this and the .reload() gets called below
@@ -1425,7 +1425,7 @@ public class ActionManager extends BaseManager {
         m.executeUpdate(params,  sidList);
 
 
-            //action.addServerAction(sa);
+        //action.addServerAction(sa);
 
         return action;
     }
@@ -1447,7 +1447,7 @@ public class ActionManager extends BaseManager {
     }
 
     private static Action createScheduledAction(User scheduler, ActionType type,
-                                                String name, Date earliestAction) {
+            String name, Date earliestAction) {
         Action pa = ActionFactory.createAction(type);
         pa.setName(name);
         pa.setOrg(scheduler.getOrg());
@@ -1478,7 +1478,7 @@ public class ActionManager extends BaseManager {
         }
 
         return scheduleKickstartAction(ksdata.getPreserveFileLists(), scheduler, srvr,
-                                        earliestAction, appendString, kickstartHost);
+                earliestAction, appendString, kickstartHost);
 
     }
 
@@ -1534,11 +1534,11 @@ public class ActionManager extends BaseManager {
             ) {
 
         KickstartGuestAction ksAction = (KickstartGuestAction)
-            scheduleAction(pcmd.getUser(),
-                           pcmd.getHostServer(),
-                           ActionFactory.TYPE_KICKSTART_INITIATE_GUEST,
-                           ActionFactory.TYPE_KICKSTART_INITIATE_GUEST.getName(),
-                           pcmd.getScheduleDate());
+                scheduleAction(pcmd.getUser(),
+                        pcmd.getHostServer(),
+                        ActionFactory.TYPE_KICKSTART_INITIATE_GUEST,
+                        ActionFactory.TYPE_KICKSTART_INITIATE_GUEST.getName(),
+                        pcmd.getScheduleDate());
         KickstartGuestActionDetails kad = new KickstartGuestActionDetails();
         kad.setAppendString(pcmd.getExtraOptions());
         kad.setParentAction(ksAction);
@@ -1548,10 +1548,11 @@ public class ActionManager extends BaseManager {
         kad.setDiskPath(pcmd.getFilePath());
         kad.setVcpus(new Long(pcmd.getVirtualCpus()));
         kad.setGuestName(pcmd.getGuestName());
+        kad.setMacAddress(pcmd.getMacAddress());
         kad.setKickstartSessionId(ksSessionId);
 
         Profile cProfile = Profile.lookupById(CobblerXMLRPCHelper.getConnection(
-           pcmd.getUser()), pcmd.getKsdata().getCobblerId());
+                pcmd.getUser()), pcmd.getKsdata().getCobblerId());
         if (pcmd.getVirtBridge() == null) {
             kad.setVirtBridge(cProfile.getVirtBridge());
         }
@@ -1670,7 +1671,7 @@ public class ActionManager extends BaseManager {
      */
     public static void removeSystemFromAction(Server serverIn, Action actionIn) {
         CallableMode m = ModeFactory.getCallableMode("System_queries",
-            "remove_from_action");
+                "remove_from_action");
         Map inParams = new HashMap();
         inParams.put("server_id", serverIn.getId());
         inParams.put("action_id", actionIn.getId());
@@ -1711,10 +1712,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) {
+            List pkgs,
+            ActionType type,
+            Date earliestAction,
+            Server...servers) {
         Set<Long> serverIds = new HashSet<Long>();
         for (Server s : servers) {
             serverIds.add(s.getId());
@@ -1735,23 +1736,23 @@ public class ActionManager extends BaseManager {
      * @return The action that has been scheduled.
      */
     public static Action schedulePackageAction(User scheduler,
-                                               List pkgs,
-                                               ActionType type,
-                                               Date earliestAction,
-                                               Set<Long> serverIds) {
+            List pkgs,
+            ActionType type,
+            Date earliestAction,
+            Set<Long> serverIds) {
 
         String name = "";
         if (type.equals(ActionFactory.TYPE_PACKAGES_REMOVE) ||
-            type.equals(ActionFactory.TYPE_SOLARISPKGS_REMOVE)) {
+                type.equals(ActionFactory.TYPE_SOLARISPKGS_REMOVE)) {
             name = "Package Removal";
         }
         else if (type.equals(ActionFactory.TYPE_PACKAGES_UPDATE) ||
-                 type.equals(ActionFactory.TYPE_SOLARISPKGS_INSTALL)) {
+                type.equals(ActionFactory.TYPE_SOLARISPKGS_INSTALL)) {
             name = "Package Install";
         }
         else if (type.equals(ActionFactory.TYPE_PACKAGES_VERIFY)) {
-           name = "Package Verify";
-       }
+            name = "Package Verify";
+        }
         else if (type.equals(ActionFactory.TYPE_PACKAGES_REFRESH_LIST)) {
             name = "Package List Refresh";
         }
@@ -1763,38 +1764,38 @@ public class ActionManager extends BaseManager {
         ActionFactory.save(action);
 
         if (pkgs != null) {
-          // for each item in the set create a package action detail
-          // I'm using datasource to insert the records instead of
-          // hibernate. It seems terribly inefficient to lookup a
-          // packagename and packageevr object to insert the ids into the
-          // correct table if I already have the ids.
-          for (Iterator itr = pkgs.iterator(); itr.hasNext();) {
-              Map rse = (Map) itr.next();
-              Map params = new HashMap();
-              Long nameId = (Long) rse.get("name_id");
-              Long evrId = (Long) rse.get("evr_id");
-              Long archId = (Long) rse.get("arch_id");
-              if (nameId == null || evrId == null) {
-                  throw new IllegalArgumentException("name_id or " +
-                        "evr_id are not in the Map passed into " +
-                        "this method.  Please populate the Map " +
-                        "with the name_id and evr_id items");
-              }
-              params.put("action_id", action.getId());
-              params.put("name_id", nameId);
-              params.put("evr_id", evrId);
-
-              WriteMode m = null;
-              if (archId == null) {
-                  m = ModeFactory.getWriteMode("Action_queries",
-                          "schedule_action_no_arch");
-              }
-              else {
-                  params.put("arch_id", archId);
-                  m = ModeFactory.getWriteMode("Action_queries", "schedule_action");
-              }
-              m.executeUpdate(params);
-          }
+            // for each item in the set create a package action detail
+            // I'm using datasource to insert the records instead of
+            // hibernate. It seems terribly inefficient to lookup a
+            // packagename and packageevr object to insert the ids into the
+            // correct table if I already have the ids.
+            for (Iterator itr = pkgs.iterator(); itr.hasNext();) {
+                Map rse = (Map) itr.next();
+                Map params = new HashMap();
+                Long nameId = (Long) rse.get("name_id");
+                Long evrId = (Long) rse.get("evr_id");
+                Long archId = (Long) rse.get("arch_id");
+                if (nameId == null || evrId == null) {
+                    throw new IllegalArgumentException("name_id or " +
+                            "evr_id are not in the Map passed into " +
+                            "this method.  Please populate the Map " +
+                            "with the name_id and evr_id items");
+                }
+                params.put("action_id", action.getId());
+                params.put("name_id", nameId);
+                params.put("evr_id", evrId);
+
+                WriteMode m = null;
+                if (archId == null) {
+                    m = ModeFactory.getWriteMode("Action_queries",
+                            "schedule_action_no_arch");
+                }
+                else {
+                    params.put("arch_id", archId);
+                    m = ModeFactory.getWriteMode("Action_queries", "schedule_action");
+                }
+                m.executeUpdate(params);
+            }
         }
 
         return action;
@@ -1824,7 +1825,7 @@ public class ActionManager extends BaseManager {
             packages.add(row);
         }
         return schedulePackageAction(scheduler, packages, type, earliestAction, srvr
-        );
+                );
     }
 
     /**
@@ -1853,7 +1854,7 @@ public class ActionManager extends BaseManager {
      * @return scheduled Scap Action
      */
     public static ScapAction scheduleXccdfEval(User scheduler, Set<Long> serverIds,
-        String path, String parameters, Date earliestAction) {
+            String path, String parameters, Date earliestAction) {
         if (serverIds.isEmpty()) {
             return null;
         }
@@ -1872,9 +1873,9 @@ public class ActionManager extends BaseManager {
 
         ScapActionDetails scapDetails = new ScapActionDetails(path, parameters);
         ScapAction action = (ScapAction) scheduleAction(scheduler,
-            ActionFactory.TYPE_SCAP_XCCDF_EVAL,
-            ActionFactory.TYPE_SCAP_XCCDF_EVAL.getName(),
-            earliestAction, serverIds);
+                ActionFactory.TYPE_SCAP_XCCDF_EVAL,
+                ActionFactory.TYPE_SCAP_XCCDF_EVAL.getName(),
+                earliestAction, serverIds);
         action.setScapActionDetails(scapDetails);
         ActionFactory.save(action);
         return action;
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/ProvisionVirtualInstanceCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/ProvisionVirtualInstanceCommand.java
index f7d7b36..323ad54 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/ProvisionVirtualInstanceCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/ProvisionVirtualInstanceCommand.java
@@ -59,6 +59,7 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
     private Long localStorage;
     private String filePath;
     private String virtBridge;
+    private String macAddress;
 
 
     /**
@@ -88,8 +89,8 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
         // We'll pass in the host server here, since the host server is the
         // only one that exists.
         this(selectedServer, KickstartFactory.
-                        lookupKickstartDataByIdAndOrg(userIn.getOrg(), ksid),
-                        userIn, scheduleDateIn, kickstartServerNameIn);
+                lookupKickstartDataByIdAndOrg(userIn.getOrg(), ksid),
+                userIn, scheduleDateIn, kickstartServerNameIn);
     }
 
     /**
@@ -104,7 +105,7 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      *                              this machine
      */
     public ProvisionVirtualInstanceCommand(Long selectedServer,
-                                KickstartData ksData,
+            KickstartData ksData,
             User userIn, Date scheduleDateIn, String kickstartServerNameIn) {
 
         // We'll pass in the host server here, since the host server is the
@@ -127,15 +128,16 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      * @return the created cobbler only profile aware kickstartScheduleCommand
      */
     public static ProvisionVirtualInstanceCommand createCobblerScheduleCommand(
-                                            Long selectedServer,
-                                            String label,
-                                            User userIn,
-                                            Date scheduleDateIn,
-                                            String kickstartServerNameIn) {
+            Long selectedServer,
+            String label,
+            User userIn,
+            Date scheduleDateIn,
+            String kickstartServerNameIn) {
 
         ProvisionVirtualInstanceCommand cmd = new
-                                        ProvisionVirtualInstanceCommand(selectedServer,
-                     (KickstartData)null,  userIn, scheduleDateIn, kickstartServerNameIn);
+                ProvisionVirtualInstanceCommand(selectedServer,
+ (KickstartData) null, userIn, scheduleDateIn,
+                kickstartServerNameIn);
         cmd.cobblerProfileLabel = label;
         cmd.cobblerOnly =  true;
         return cmd;
@@ -147,15 +149,17 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      * @return Returns the rebootAction (if any) - null for virtual
      * provisioning, since we don't want to reboot the host!
      */
+    @Override
     public Action scheduleRebootAction(Action prereqAction) {
         log.debug("** Skipping rebootAction - provisioning a virtual instance.");
 
         return null;
     }
 
+    @Override
     protected SelectMode getMode() {
         return ModeFactory.getMode("General_queries",
-                                   "virtual_kickstarts_channels_for_org");
+                "virtual_kickstarts_channels_for_org");
     }
 
 
@@ -178,6 +182,7 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      *
      * @return Returns the KickstartGuestAction
      */
+    @Override
     public Action scheduleKickstartAction(Action prereqAction) {
 
         KickstartSession ksSession = getKickstartSession();
@@ -199,11 +204,28 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      *
      * @return Returns a ValidatorError if something goes wrong.  ie, never
      */
+    @Override
     protected ValidatorError validateUp2dateVersion() {
         return null;
     }
 
     /**
+     * Returns the mac address
+     * @return the mac address
+     */
+    public String getMacAddress() {
+        return this.macAddress;
+    }
+
+    /**
+     * Sets the mac address
+     * @param macAddressIn The mac address to set.
+     */
+    public void setMacAddress(String macAddressIn) {
+        this.macAddress = macAddressIn;
+    }
+
+    /**
      * @return Returns the guestName
      */
     public String getGuestName() {
@@ -271,6 +293,7 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      *
      * {@inheritDoc}
      */
+    @Override
     public DataResult<? extends KickstartDto> getKickstartProfiles() {
         DataResult<? extends KickstartDto> result =  super.getKickstartProfiles();
         for (Iterator<? extends KickstartDto> itr = result.iterator(); itr.hasNext();) {
@@ -335,10 +358,10 @@ public class ProvisionVirtualInstanceCommand extends KickstartScheduleCommand {
      * @return the virt path.
      */
     public static String makeDefaultVirtPath(String name,
-                                KickstartVirtualizationType type) {
+            KickstartVirtualizationType type) {
         File virtPathDir =  ConfigDefaults.get().getVirtPath(
-                            KickstartVirtualizationType.xenPV().equals(type) ||
-                                KickstartVirtualizationType.xenFV().equals(type));
+                KickstartVirtualizationType.xenPV().equals(type) ||
+                KickstartVirtualizationType.xenFV().equals(type));
         File virtPath = new File(virtPathDir, name.replace(' ', '-'));
         return virtPath.getAbsolutePath();
     }
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
index 2e8e01b..26a81ab 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerVirtualSystemCommand.java
@@ -24,6 +24,7 @@ import com.redhat.rhn.domain.user.User;
 import org.apache.log4j.Logger;
 import org.cobbler.Network;
 import org.cobbler.SystemRecord;
+import org.cobbler.XmlRpcException;
 
 import java.util.Collections;
 import java.util.LinkedList;
@@ -70,7 +71,7 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
      */
     public CobblerVirtualSystemCommand(User userIn, Server serverIn,
             KickstartData ksDataIn, String mediaPathIn,
-                            String activationKeysIn, String guestNameIn) {
+            String activationKeysIn, String guestNameIn) {
         super(userIn, serverIn, ksDataIn, mediaPathIn, activationKeysIn);
         guestName = guestNameIn;
     }
@@ -97,7 +98,15 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
     @Override
     protected void processNetworkInterfaces(SystemRecord rec, Server serverIn) {
         log.debug("processNetworkInterfaces called.");
-        String newMac = (String) invokeXMLRPC("get_random_mac", Collections.EMPTY_LIST);
+
+        KickstartGuestAction action = (KickstartGuestAction) getScheduledAction();
+        KickstartGuestActionDetails details = action
+                .getKickstartGuestActionDetails();
+        String newMac = details.getMacAddress();
+        if (newMac == null || newMac.equals("")) {
+            newMac = (String) invokeXMLRPC("get_random_mac",
+                    Collections.EMPTY_LIST);
+        }
         Network net = new Network(getCobblerConnection(), "eth0");
         net.setMacAddress(newMac);
         List<Network> nics = new LinkedList<Network>();
@@ -106,6 +115,7 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
     }
 
 
+    @Override
     protected SystemRecord lookupExisting() {
         log.debug("lookupExisting called.");
 
@@ -140,14 +150,29 @@ public class CobblerVirtualSystemCommand extends CobblerSystemCreateCommand {
      */
     @Override
     public ValidatorError store() {
-        ValidatorError error = super.store();
+        ValidatorError error = null;
+        try {
+            error = super.store();
+        }
+        catch (XmlRpcException e) {
+            if (e.getCause() != null &&
+                    e.getCause().getMessage() != null &&
+                    e.getCause().getMessage()
+                    .contains("MAC address duplicated")) {
+                error = new ValidatorError(
+                        "frontend.actions.systems.virt.duplicatemacaddressvalue");
+            }
+            else {
+                throw e;
+            }
+        }
         if (error == null) {
             KickstartGuestAction action = (KickstartGuestAction) getScheduledAction();
             KickstartGuestActionDetails details = action.getKickstartGuestActionDetails();
             setupVirtAttributes(details.getMemMb().intValue(),
-                            details.getDiskGb().intValue(),
-                            details.getVcpus().intValue(),
-                            details.getDiskPath());
+                    details.getDiskGb().intValue(),
+                    details.getVcpus().intValue(),
+                    details.getDiskPath());
         }
         return error;
     }
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
index ffc962d..a38f61f 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf
@@ -30,6 +30,7 @@
 	        <input type="hidden" name="virtualCpus" value="${form.virtualCpus}" />
 	        <input type="hidden" name="localStorageGigabytes" value="${form.localStorageGigabytes}" />
 	        <input type="hidden" name="diskPath" value="${form.diskPath}" />
+            <input type="hidden" name="macAddress" value="${form.macAddress}" />
         </c:if>
 		<%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/proxy-options.jspf" %>
 
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/virt-options.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/virt-options.jspf
index dc8df8e..0aa6231 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/virt-options.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/virt-options.jspf
@@ -49,4 +49,13 @@
             <br/><br/>
         </td>
       </tr>
+      <tr>
+        <th><bean:message key="kickstartdetails.jsp.mac_address"/>:</th>
+        <td>
+            <html:text  property="macAddress" maxlength="17" size="17" styleId="macAddressId"/>
+            <br/>
+            <bean:message key="kickstartdetails.jsp.mac_address.tip"/>
+            <br/><br/>
+        </td>
+      </tr>
     </table>
diff --git a/java/code/webapp/WEB-INF/pages/systems/details/virtualization/provision/first.jsp b/java/code/webapp/WEB-INF/pages/systems/details/virtualization/provision/first.jsp
index f821cf2..0494510 100644
--- a/java/code/webapp/WEB-INF/pages/systems/details/virtualization/provision/first.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/details/virtualization/provision/first.jsp
@@ -43,7 +43,8 @@ function setStep(stepName) {
          	<rl:column headerkey="kickstart.channel.virtCpu.jsp" bound="true" attr="virtCpus"/>
          	<rl:column headerkey="kickstart.channel.virtDisk.jsp" bound="true" attr="virtSpace"/>         	
          	<rl:column headerkey="kickstart.channel.virtMemory.jsp" bound="true" attr="virtMemory"/>
-         	<rl:column headerkey="kickstart.channel.virtBridge.jsp" bound="true" attr="virtBridge" styleclass="last-column"/>
+         	<rl:column headerkey="kickstart.channel.virtBridge.jsp" bound="true" attr="virtBridge"/>
+            <rl:column headerkey="kickstart.channel.macAddress.jsp" bound="true" attr="macAddress" styleclass="last-column"/>
     </rl:list>
 	
 	<h2><bean:message key="virtualization.provision.first.jsp.header2" /></h2>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index bab6c1d..bbc4b34 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -844,6 +844,7 @@
 		    <form-property name="memoryAllocation" type="java.lang.String" />
 		    <form-property name="virtualCpus" type="java.lang.String" />
 		    <form-property name="virtBridge" type="java.lang.String" />
+            <form-property name="macAddress" type="java.lang.String" />
 		    <form-property name="diskPath" type="java.lang.String" />
 		    <form-property name="storageType" type="java.lang.String" />
 		    <form-property name="localStorageGigabytes" type="java.lang.String" />
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/109-rhnactionkickstartguest_mac_address_column_add.sql b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/109-rhnactionkickstartguest_mac_address_column_add.sql
new file mode 100644
index 0000000..995df7d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/109-rhnactionkickstartguest_mac_address_column_add.sql
@@ -0,0 +1 @@
+alter table rhnactionkickstartguest add mac_address varchar(17);




More information about the spacewalk-commits mailing list