You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/12/06 20:14:32 UTC

[11/14] git commit: api_refactor: move systevm apis to admin pkg

api_refactor: move systevm apis to admin pkg

Signed-off-by: Rohit Yadav <bh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/163fe7b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/163fe7b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/163fe7b8

Branch: refs/heads/api_refactoring
Commit: 163fe7b8c317f479462bcf903cc6ac2c2283ac8f
Parents: 1b1d91d
Author: Rohit Yadav <bh...@apache.org>
Authored: Thu Dec 6 10:28:37 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Thu Dec 6 10:28:37 2012 -0800

----------------------------------------------------------------------
 .../com/cloud/api/commands/DestroySystemVmCmd.java |  106 -----------
 .../com/cloud/api/commands/ListSystemVMsCmd.java   |  138 ---------------
 .../com/cloud/api/commands/MigrateSystemVMCmd.java |  134 --------------
 .../com/cloud/api/commands/RebootSystemVmCmd.java  |  112 ------------
 .../com/cloud/api/commands/StartSystemVMCmd.java   |  116 ------------
 .../com/cloud/api/commands/StopSystemVmCmd.java    |  123 -------------
 .../com/cloud/api/commands/UpgradeSystemVMCmd.java |  104 -----------
 api/src/com/cloud/server/ManagementService.java    |   10 +-
 .../admin/systemvm/command/DestroySystemVmCmd.java |  106 +++++++++++
 .../admin/systemvm/command/ListSystemVMsCmd.java   |  138 +++++++++++++++
 .../admin/systemvm/command/MigrateSystemVMCmd.java |  134 ++++++++++++++
 .../admin/systemvm/command/RebootSystemVmCmd.java  |  112 ++++++++++++
 .../admin/systemvm/command/StartSystemVMCmd.java   |  116 ++++++++++++
 .../admin/systemvm/command/StopSystemVmCmd.java    |  123 +++++++++++++
 .../admin/systemvm/command/UpgradeSystemVMCmd.java |  104 +++++++++++
 client/tomcatconf/commands.properties.in           |   14 +-
 .../src/com/cloud/server/ManagementServerImpl.java |   10 +-
 17 files changed, 850 insertions(+), 850 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java b/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
deleted file mode 100644
index 9f2abbe..0000000
--- a/api/src/com/cloud/api/commands/DestroySystemVmCmd.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(responseObject=SystemVmResponse.class, description="Destroyes a system virtual machine.")
-public class DestroySystemVmCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName());
-
-    private static final String s_name = "destroysystemvmresponse";
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
-    private Long id;
-
-    public Long getId() {
-        return id;
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public static String getResultObjectName() {
-        return "systemvm";
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
-        if(type == VirtualMachine.Type.ConsoleProxy){
-            return EventTypes.EVENT_PROXY_DESTROY;
-        }
-        else{
-            return EventTypes.EVENT_SSVM_DESTROY;
-        }
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "destroying system vm: " + getId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SystemVm;
-    }
-
-    @Override
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Vm Id: "+getId());
-        VirtualMachine instance = _mgr.destroySystemVM(this);
-        if (instance != null) {
-            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java b/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
deleted file mode 100644
index 1378e98..0000000
--- a/api/src/com/cloud/api/commands/ListSystemVMsCmd.java
+++ /dev/null
@@ -1,138 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import com.cloud.api.response.ListResponse;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.utils.Pair;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="List system virtual machines.", responseObject=SystemVmResponse.class)
-public class ListSystemVMsCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName());
-
-    private static final String s_name = "listsystemvmsresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="host")
-    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the system VM")
-    private Long hostId;
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the system VM")
-    private Long id;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the system VM")
-    private String systemVmName;
-
-    @IdentityMapper(entityTableName="host_pod_ref")
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the system VM")
-    private Long podId;
-
-    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the system VM")
-    private String state;
-
-    @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".")
-    private String systemVmType;
-
-    @IdentityMapper(entityTableName="data_center")
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the system VM")
-    private Long zoneId;
-
-    @IdentityMapper(entityTableName="storage_pool")
-    @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to", since="3.0.1")
-    private Long storageId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getHostId() {
-        return hostId;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getSystemVmName() {
-        return systemVmName;
-    }
-
-    public Long getPodId() {
-        return podId;
-    }
-
-    public String getState() {
-        return state;
-    }
-
-    public String getSystemVmType() {
-        return systemVmType;
-    }
-
-    public Long getZoneId() {
-        return zoneId;
-    }
-
-    public Long getStorageId() {
-        return storageId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SystemVm;
-    }
-
-    @Override
-    public void execute(){
-        Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
-        ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
-        List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
-        for (VirtualMachine systemVM : systemVMs.first()) {
-            SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
-            vmResponse.setObjectName("systemvm");
-            vmResponses.add(vmResponse);
-        }
-
-        response.setResponses(vmResponses, systemVMs.second());
-        response.setResponseName(getCommandName());
-        this.setResponseObject(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java b/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
deleted file mode 100644
index 73240cd..0000000
--- a/api/src/com/cloud/api/commands/MigrateSystemVMCmd.java
+++ /dev/null
@@ -1,134 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmInstanceResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ManagementServerException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.exception.VirtualMachineMigrationException;
-import com.cloud.host.Host;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="Attempts Migration of a system virtual machine to the host specified.", responseObject=SystemVmInstanceResponse.class)
-public class MigrateSystemVMCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName());
-
-    private static final String s_name = "migratesystemvmresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="host")
-    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=true, description="destination Host ID to migrate VM to")
-    private Long hostId;
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine")
-    private Long virtualMachineId;
-
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getHostId() {
-        return hostId;
-    }
-
-    public Long getVirtualMachineId() {
-        return virtualMachineId;
-    }
-
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        return EventTypes.EVENT_VM_MIGRATE;
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId();
-    }
-
-    @Override
-    public void execute(){
-
-        Host destinationHost = _resourceService.getHost(getHostId());
-        if (destinationHost == null) {
-            throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
-        }
-        try{
-            UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId());
-            //FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
-            VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
-            if (migratedVm != null) {
-                // return the generic system VM instance response
-                SystemVmInstanceResponse response = _responseGenerator.createSystemVmInstanceResponse(migratedVm);
-                response.setResponseName(getCommandName());
-                this.setResponseObject(response);
-            } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
-            }
-        } catch (ResourceUnavailableException ex) {
-            s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        } catch (ManagementServerException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        } catch (VirtualMachineMigrationException e) {
-            s_logger.warn("Exception: ", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java b/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
deleted file mode 100644
index fab1b9c..0000000
--- a/api/src/com/cloud/api/commands/RebootSystemVmCmd.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="Reboots a system VM.", responseObject=SystemVmResponse.class)
-public class RebootSystemVmCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
-
-    private static final String s_name = "rebootsystemvmresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
-        if(type == VirtualMachine.Type.ConsoleProxy){
-            return EventTypes.EVENT_PROXY_REBOOT;
-        }
-        else{
-            return EventTypes.EVENT_SSVM_REBOOT;
-        }
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "rebooting system vm: " + getId();
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SystemVm;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Vm Id: "+getId());
-        VirtualMachine result = _mgr.rebootSystemVM(this);
-        if (result != null) {
-            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/StartSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/StartSystemVMCmd.java b/api/src/com/cloud/api/commands/StartSystemVMCmd.java
deleted file mode 100644
index b6b8922..0000000
--- a/api/src/com/cloud/api/commands/StartSystemVMCmd.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(responseObject=SystemVmResponse.class, description="Starts a system virtual machine.")
-public class StartSystemVMCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
-
-    private static final String s_name = "startsystemvmresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
-    private Long id;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    public static String getResultObjectName() {
-        return "systemvm";
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
-        if(type == VirtualMachine.Type.ConsoleProxy){
-            return EventTypes.EVENT_PROXY_START;
-        }
-        else{
-            return EventTypes.EVENT_SSVM_START;
-        }
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "starting system vm: " + getId();
-    }
-
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SystemVm;
-    }
-
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Vm Id: "+getId());
-        VirtualMachine instance = _mgr.startSystemVM(getId());
-        if (instance != null) {
-            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/StopSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/StopSystemVmCmd.java b/api/src/com/cloud/api/commands/StopSystemVmCmd.java
deleted file mode 100644
index 71316ee..0000000
--- a/api/src/com/cloud/api/commands/StopSystemVmCmd.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(description="Stops a system VM.", responseObject=SystemVmResponse.class)
-public class StopSystemVmCmd extends BaseAsyncCmd {
-    public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
-
-    private static final String s_name = "stopsystemvmresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
-    private Long id;
-
-    @Parameter(name=ApiConstants.FORCED, type=CommandType.BOOLEAN, required=false, description="Force stop the VM.  The caller knows the VM is stopped.")
-    private Boolean forced;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public String getEventType() {
-        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
-        if(type == VirtualMachine.Type.ConsoleProxy){
-            return EventTypes.EVENT_PROXY_STOP;
-        }
-        else{
-            return EventTypes.EVENT_SSVM_STOP;
-        }
-    }
-
-    @Override
-    public String getEventDescription() {
-        return  "stopping system vm: " + getId();
-    }
-
-    @Override
-    public AsyncJob.Type getInstanceType() {
-        return AsyncJob.Type.SystemVm;
-    }
-
-    @Override
-    public Long getInstanceId() {
-        return getId();
-    }
-
-    public boolean isForced() {
-        return (forced != null) ? forced : false;
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
-        UserContext.current().setEventDetails("Vm Id: "+getId());
-        VirtualMachine result = _mgr.stopSystemVM(this);
-        if (result != null) {
-            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/api/commands/UpgradeSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/UpgradeSystemVMCmd.java b/api/src/com/cloud/api/commands/UpgradeSystemVMCmd.java
deleted file mode 100644
index cc7deaf..0000000
--- a/api/src/com/cloud/api/commands/UpgradeSystemVMCmd.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.api.commands;
-
-import org.apache.cloudstack.api.user.vm.command.UpgradeVMCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.IdentityMapper;
-import org.apache.cloudstack.api.Implementation;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import com.cloud.api.response.SystemVmResponse;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.offering.ServiceOffering;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
-import com.cloud.vm.VirtualMachine;
-
-@Implementation(responseObject=SystemVmResponse.class, description="Changes the service offering for a system vm (console proxy or secondary storage). " +
-                                                                                            "The system vm must be in a \"Stopped\" state for " +
-                                                                                            "this command to take effect.")
-public class UpgradeSystemVMCmd extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
-    private static final String s_name = "changeserviceforsystemvmresponse";
-
-    /////////////////////////////////////////////////////
-    //////////////// API parameters /////////////////////
-    /////////////////////////////////////////////////////
-
-    @IdentityMapper(entityTableName="vm_instance")
-    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system vm")
-    private Long id;
-
-    @IdentityMapper(entityTableName="disk_offering")
-    @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, required=true,
-                description="the service offering ID to apply to the system vm")
-    private Long serviceOfferingId;
-
-    /////////////////////////////////////////////////////
-    /////////////////// Accessors ///////////////////////
-    /////////////////////////////////////////////////////
-
-    public Long getId() {
-        return id;
-    }
-
-    public Long getServiceOfferingId() {
-        return serviceOfferingId;
-    }
-
-    /////////////////////////////////////////////////////
-    /////////////// API Implementation///////////////////
-    /////////////////////////////////////////////////////
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        Account account = UserContext.current().getCaller();
-        if (account != null) {
-            return account.getId();
-        }
-
-        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
-    }
-
-    @Override
-    public void execute(){
-        UserContext.current().setEventDetails("Vm Id: "+getId());
-
-        ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
-        if (serviceOffering == null) {
-            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
-        }
-
-        VirtualMachine result = _mgr.upgradeSystemVM(this);
-        if (result != null) {
-            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index a2ab206..3bf39f5 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -34,7 +34,7 @@ import org.apache.cloudstack.api.user.offering.command.ListDiskOfferingsCmd;
 import org.apache.cloudstack.api.user.offering.command.ListServiceOfferingsCmd;
 import org.apache.cloudstack.api.user.ssh.command.CreateSSHKeyPairCmd;
 import org.apache.cloudstack.api.user.ssh.command.DeleteSSHKeyPairCmd;
-import com.cloud.api.commands.DestroySystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.DestroySystemVmCmd;
 import org.apache.cloudstack.api.user.volume.command.ExtractVolumeCmd;
 import org.apache.cloudstack.api.user.template.command.ListTemplatesCmd;
 import org.apache.cloudstack.api.user.template.command.UpdateTemplateCmd;
@@ -50,17 +50,17 @@ import org.apache.cloudstack.api.user.iso.command.ListIsosCmd;
 import com.cloud.api.commands.ListPodsByCmd;
 import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
 import com.cloud.api.commands.ListStoragePoolsCmd;
-import com.cloud.api.commands.ListSystemVMsCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.ListVMGroupsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
 import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
-import com.cloud.api.commands.RebootSystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
 import org.apache.cloudstack.api.user.ssh.command.RegisterSSHKeyPairCmd;
-import com.cloud.api.commands.StopSystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;
 import com.cloud.api.commands.UpdateDomainCmd;
 import org.apache.cloudstack.api.user.iso.command.UpdateIsoCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.UpdateVMGroupCmd;
-import com.cloud.api.commands.UpgradeSystemVMCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.UpgradeSystemVMCmd;
 import com.cloud.api.commands.UploadCustomCertificateCmd;
 import com.cloud.api.view.vo.DomainRouterJoinVO;
 import com.cloud.async.AsyncJob;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/DestroySystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/DestroySystemVmCmd.java
new file mode 100644
index 0000000..56a82fb
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/DestroySystemVmCmd.java
@@ -0,0 +1,106 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(responseObject=SystemVmResponse.class, description="Destroyes a system virtual machine.")
+public class DestroySystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(DestroySystemVmCmd.class.getName());
+
+    private static final String s_name = "destroysystemvmresponse";
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "systemvm";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if(type == VirtualMachine.Type.ConsoleProxy){
+            return EventTypes.EVENT_PROXY_DESTROY;
+        }
+        else{
+            return EventTypes.EVENT_SSVM_DESTROY;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "destroying system vm: " + getId();
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Vm Id: "+getId());
+        VirtualMachine instance = _mgr.destroySystemVM(this);
+        if (instance != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/ListSystemVMsCmd.java
new file mode 100644
index 0000000..a1e27cd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/ListSystemVMsCmd.java
@@ -0,0 +1,138 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.utils.Pair;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(description="List system virtual machines.", responseObject=SystemVmResponse.class)
+public class ListSystemVMsCmd extends BaseListCmd {
+    public static final Logger s_logger = Logger.getLogger(ListSystemVMsCmd.class.getName());
+
+    private static final String s_name = "listsystemvmsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="host")
+    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="the host ID of the system VM")
+    private Long hostId;
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the system VM")
+    private Long id;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the system VM")
+    private String systemVmName;
+
+    @IdentityMapper(entityTableName="host_pod_ref")
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID of the system VM")
+    private Long podId;
+
+    @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="the state of the system VM")
+    private String state;
+
+    @Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".")
+    private String systemVmType;
+
+    @IdentityMapper(entityTableName="data_center")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the system VM")
+    private Long zoneId;
+
+    @IdentityMapper(entityTableName="storage_pool")
+    @Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to", since="3.0.1")
+    private Long storageId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getSystemVmName() {
+        return systemVmName;
+    }
+
+    public Long getPodId() {
+        return podId;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public String getSystemVmType() {
+        return systemVmType;
+    }
+
+    public Long getZoneId() {
+        return zoneId;
+    }
+
+    public Long getStorageId() {
+        return storageId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.SystemVm;
+    }
+
+    @Override
+    public void execute(){
+        Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
+        ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
+        List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
+        for (VirtualMachine systemVM : systemVMs.first()) {
+            SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
+            vmResponse.setObjectName("systemvm");
+            vmResponses.add(vmResponse);
+        }
+
+        response.setResponses(vmResponses, systemVMs.second());
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/MigrateSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/MigrateSystemVMCmd.java
new file mode 100644
index 0000000..8876be1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/MigrateSystemVMCmd.java
@@ -0,0 +1,134 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmInstanceResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import com.cloud.host.Host;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(description="Attempts Migration of a system virtual machine to the host specified.", responseObject=SystemVmInstanceResponse.class)
+public class MigrateSystemVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName());
+
+    private static final String s_name = "migratesystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="host")
+    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=true, description="destination Host ID to migrate VM to")
+    private Long hostId;
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine")
+    private Long virtualMachineId;
+
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Long getVirtualMachineId() {
+        return virtualMachineId;
+    }
+
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_MIGRATE;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "Attempting to migrate VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId();
+    }
+
+    @Override
+    public void execute(){
+
+        Host destinationHost = _resourceService.getHost(getHostId());
+        if (destinationHost == null) {
+            throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId());
+        }
+        try{
+            UserContext.current().setEventDetails("VM Id: " + getVirtualMachineId() + " to host Id: "+ getHostId());
+            //FIXME : Should not be calling UserVmService to migrate all types of VMs - need a generic VM layer
+            VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
+            if (migratedVm != null) {
+                // return the generic system VM instance response
+                SystemVmInstanceResponse response = _responseGenerator.createSystemVmInstanceResponse(migratedVm);
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
+            }
+        } catch (ResourceUnavailableException ex) {
+            s_logger.warn("Exception: ", ex);
+            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+        } catch (ConcurrentOperationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+        } catch (ManagementServerException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+        } catch (VirtualMachineMigrationException e) {
+            s_logger.warn("Exception: ", e);
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/RebootSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/RebootSystemVmCmd.java
new file mode 100644
index 0000000..61a8892
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/RebootSystemVmCmd.java
@@ -0,0 +1,112 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(description="Reboots a system VM.", responseObject=SystemVmResponse.class)
+public class RebootSystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(RebootSystemVmCmd.class.getName());
+
+    private static final String s_name = "rebootsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if(type == VirtualMachine.Type.ConsoleProxy){
+            return EventTypes.EVENT_PROXY_REBOOT;
+        }
+        else{
+            return EventTypes.EVENT_SSVM_REBOOT;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "rebooting system vm: " + getId();
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.SystemVm;
+    }
+
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Vm Id: "+getId());
+        VirtualMachine result = _mgr.rebootSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/StartSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/StartSystemVMCmd.java
new file mode 100644
index 0000000..f9e12a8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/StartSystemVMCmd.java
@@ -0,0 +1,116 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(responseObject=SystemVmResponse.class, description="Starts a system virtual machine.")
+public class StartSystemVMCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StartSystemVMCmd.class.getName());
+
+    private static final String s_name = "startsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
+    private Long id;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "systemvm";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if(type == VirtualMachine.Type.ConsoleProxy){
+            return EventTypes.EVENT_PROXY_START;
+        }
+        else{
+            return EventTypes.EVENT_SSVM_START;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "starting system vm: " + getId();
+    }
+
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.SystemVm;
+    }
+
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Vm Id: "+getId());
+        VirtualMachine instance = _mgr.startSystemVM(getId());
+        if (instance != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/StopSystemVmCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/StopSystemVmCmd.java
new file mode 100644
index 0000000..1bf9583
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/StopSystemVmCmd.java
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(description="Stops a system VM.", responseObject=SystemVmResponse.class)
+public class StopSystemVmCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger.getLogger(StopSystemVmCmd.class.getName());
+
+    private static final String s_name = "stopsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system virtual machine")
+    private Long id;
+
+    @Parameter(name=ApiConstants.FORCED, type=CommandType.BOOLEAN, required=false, description="Force stop the VM.  The caller knows the VM is stopped.")
+    private Boolean forced;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public String getEventType() {
+        VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+        if(type == VirtualMachine.Type.ConsoleProxy){
+            return EventTypes.EVENT_PROXY_STOP;
+        }
+        else{
+            return EventTypes.EVENT_SSVM_STOP;
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return  "stopping system vm: " + getId();
+    }
+
+    @Override
+    public AsyncJob.Type getInstanceType() {
+        return AsyncJob.Type.SystemVm;
+    }
+
+    @Override
+    public Long getInstanceId() {
+        return getId();
+    }
+
+    public boolean isForced() {
+        return (forced != null) ? forced : false;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, ConcurrentOperationException {
+        UserContext.current().setEventDetails("Vm Id: "+getId());
+        VirtualMachine result = _mgr.stopSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/api/src/org/apache/cloudstack/api/admin/systemvm/command/UpgradeSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/admin/systemvm/command/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/admin/systemvm/command/UpgradeSystemVMCmd.java
new file mode 100644
index 0000000..88b69e1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/admin/systemvm/command/UpgradeSystemVMCmd.java
@@ -0,0 +1,104 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.admin.systemvm.command;
+
+import org.apache.cloudstack.api.user.vm.command.UpgradeVMCmd;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.IdentityMapper;
+import org.apache.cloudstack.api.Implementation;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import com.cloud.api.response.SystemVmResponse;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@Implementation(responseObject=SystemVmResponse.class, description="Changes the service offering for a system vm (console proxy or secondary storage). " +
+                                                                                            "The system vm must be in a \"Stopped\" state for " +
+                                                                                            "this command to take effect.")
+public class UpgradeSystemVMCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
+    private static final String s_name = "changeserviceforsystemvmresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="vm_instance")
+    @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the system vm")
+    private Long id;
+
+    @IdentityMapper(entityTableName="disk_offering")
+    @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.LONG, required=true,
+                description="the service offering ID to apply to the system vm")
+    private Long serviceOfferingId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        Account account = UserContext.current().getCaller();
+        if (account != null) {
+            return account.getId();
+        }
+
+        return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+    }
+
+    @Override
+    public void execute(){
+        UserContext.current().setEventDetails("Vm Id: "+getId());
+
+        ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
+        if (serviceOffering == null) {
+            throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+        }
+
+        VirtualMachine result = _mgr.upgradeSystemVM(this);
+        if (result != null) {
+            SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index decd475..e00c68d 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -187,13 +187,13 @@ configureVirtualRouterElement=org.apache.cloudstack.api.admin.router.command.Con
 createVirtualRouterElement=org.apache.cloudstack.api.admin.router.command.CreateVirtualRouterElementCmd;7
 
 #### system vm commands
-startSystemVm=com.cloud.api.commands.StartSystemVMCmd;1
-rebootSystemVm=com.cloud.api.commands.RebootSystemVmCmd;1
-stopSystemVm=com.cloud.api.commands.StopSystemVmCmd;1
-destroySystemVm=com.cloud.api.commands.DestroySystemVmCmd;1
-listSystemVms=com.cloud.api.commands.ListSystemVMsCmd;3
-migrateSystemVm=com.cloud.api.commands.MigrateSystemVMCmd;1
-changeServiceForSystemVm=com.cloud.api.commands.UpgradeSystemVMCmd;1
+startSystemVm=org.apache.cloudstack.api.admin.systemvm.command.StartSystemVMCmd;1
+rebootSystemVm=org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;1
+stopSystemVm=org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;1
+destroySystemVm=org.apache.cloudstack.api.admin.systemvm.command.DestroySystemVmCmd;1
+listSystemVms=org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;3
+migrateSystemVm=org.apache.cloudstack.api.admin.systemvm.command.MigrateSystemVMCmd;1
+changeServiceForSystemVm=org.apache.cloudstack.api.admin.systemvm.command.UpgradeSystemVMCmd;1
 
 #### configuration commands
 updateConfiguration=com.cloud.api.commands.UpdateCfgCmd;1

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/163fe7b8/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index d39dd23..fd94733 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -72,7 +72,7 @@ import com.cloud.alert.dao.AlertDao;
 import org.apache.cloudstack.api.ApiConstants;
 import com.cloud.api.ApiDBUtils;
 import org.apache.cloudstack.api.user.ssh.command.CreateSSHKeyPairCmd;
-import com.cloud.api.commands.DestroySystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.DestroySystemVmCmd;
 import org.apache.cloudstack.api.user.volume.command.ExtractVolumeCmd;
 import org.apache.cloudstack.api.user.vm.command.GetVMPasswordCmd;
 import com.cloud.api.commands.ListAlertsCmd;
@@ -85,17 +85,17 @@ import com.cloud.api.commands.ListPodsByCmd;
 import org.apache.cloudstack.api.user.address.command.ListPublicIpAddressesCmd;
 import org.apache.cloudstack.api.user.ssh.command.ListSSHKeyPairsCmd;
 import com.cloud.api.commands.ListStoragePoolsCmd;
-import com.cloud.api.commands.ListSystemVMsCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.ListSystemVMsCmd;
 import com.cloud.api.commands.ListVlanIpRangesCmd;
 import org.apache.cloudstack.api.user.datacenter.command.ListZonesByCmd;
-import com.cloud.api.commands.RebootSystemVmCmd;
-import com.cloud.api.commands.StopSystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.RebootSystemVmCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.StopSystemVmCmd;
 import com.cloud.api.commands.UpdateDomainCmd;
 import org.apache.cloudstack.api.admin.host.command.UpdateHostPasswordCmd;
 import org.apache.cloudstack.api.user.iso.command.UpdateIsoCmd;
 import com.cloud.api.commands.UpdateTemplateOrIsoCmd;
 import org.apache.cloudstack.api.user.vmgroup.command.UpdateVMGroupCmd;
-import com.cloud.api.commands.UpgradeSystemVMCmd;
+import org.apache.cloudstack.api.admin.systemvm.command.UpgradeSystemVMCmd;
 import com.cloud.api.commands.UploadCustomCertificateCmd;
 import com.cloud.api.response.ExtractResponse;
 import com.cloud.api.view.vo.DomainRouterJoinVO;