cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [23/90] [abbrv] [partial] Moved most of the VOs and DAOs from server package into engine-schema as well
Date Wed, 08 May 2013 11:59:52 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/user/dao/UserStatsLogDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/UserStatsLogDao.java b/engine/schema/src/com/cloud/user/dao/UserStatsLogDao.java
new file mode 100644
index 0000000..e989d70
--- /dev/null
+++ b/engine/schema/src/com/cloud/user/dao/UserStatsLogDao.java
@@ -0,0 +1,23 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.user.dao;
+
+import com.cloud.user.UserStatsLogVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface UserStatsLogDao extends GenericDao<UserStatsLogVO, Long> {
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/user/dao/UserStatsLogDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/UserStatsLogDaoImpl.java b/engine/schema/src/com/cloud/user/dao/UserStatsLogDaoImpl.java
new file mode 100644
index 0000000..c4dfe66
--- /dev/null
+++ b/engine/schema/src/com/cloud/user/dao/UserStatsLogDaoImpl.java
@@ -0,0 +1,31 @@
+// 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.user.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.user.UserStatsLogVO;
+import com.cloud.utils.db.GenericDaoBase;
+
+@Component
+@Local(value={UserStatsLogDao.class})
+public class UserStatsLogDaoImpl extends GenericDaoBase<UserStatsLogVO, Long> implements UserStatsLogDao {
+	public UserStatsLogDaoImpl(){
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/ConsoleProxyVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/ConsoleProxyVO.java b/engine/schema/src/com/cloud/vm/ConsoleProxyVO.java
new file mode 100644
index 0000000..5c1da48
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/ConsoleProxyVO.java
@@ -0,0 +1,287 @@
+// 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.vm;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
+/**
+ * ConsoleProxyVO domain object
+ */
+
+@Entity
+@Table(name = "console_proxy")
+@PrimaryKeyJoinColumn(name = "id")
+@DiscriminatorValue(value = "ConsoleProxy")
+public class ConsoleProxyVO extends VMInstanceVO implements ConsoleProxy {
+    public static final String keyContent =
+            "-----BEGIN PRIVATE KEY-----\n" +
+                    "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCDT9AtEfs+s/I8QXp6rrCw0iNJ\n" +
+                    "0+GgsybNHheU+JpL39LMTZykCrZhZnyDvwdxCoOfE38Sa32baHKNds+y2SHnMNsOkw8OcNucHEBX\n" +
+                    "1FIpOBGph9D6xC+umx9od6xMWETUv7j6h2u+WC3OhBM8fHCBqIiAol31/IkcqDxxsHlQ8S/oCfTl\n" +
+                    "XJUY6Yn628OA1XijKdRnadV0hZ829cv/PZKljjwQUTyrd0KHQeksBH+YAYSo2JUl8ekNLsOi8/cP\n" +
+                    "tfojnltzRI1GXi0ZONs8VnDzJ0a2gqZY+uxlz+CGbLnGnlN4j9cBpE+MfUE+35Dq121sTpsSgF85\n" +
+                    "Mz+pVhn2S633AgMBAAECggEAH/Szd9RxbVADenCA6wxKSa3KErRyq1YN8ksJeCKMAj0FIt0caruE\n" +
+                    "qO11DebWW8cwQu1Otl/cYI6pmg24/BBldMrp9IELX/tNJo+lhPpRyGAxxC0eSXinFfoASb8d+jJd\n" +
+                    "Bd1mmemM6fSxqRlxSP4LrzIhjhR1g2CiyYuTsiM9UtoVKGyHwe7KfFwirUOJo3Mr18zUVNm7YqY4\n" +
+                    "IVhOSq59zkH3ULBlYq4bG50jpxa5mNSCZ7IpafPY/kE/CbR+FWNt30+rk69T+qb5abg6+XGm+OAm\n" +
+                    "bnQ18yZEqX6nJLk7Ch0cfA5orGgrTMOrM71wK7tBBDQ308kOxDGebx6j0qD36QKBgQDTRDr8kuhA\n" +
+                    "9sUyKr9vk2DQCMpNvEeiwI3JRMqmmxpNAtg01aJ3Ya57vX5Fc+zcuV87kP6FM1xgpHQvnw5LWo2J\n" +
+                    "s7ANwQcP8ricEW5zkZhSjI4ssMeAubmsHOloGxmLFYZqwx0JI7CWViGTLMcUlqKblmHcjeQDeDfP\n" +
+                    "P1TaCItFmwKBgQCfHZwVvIcaDs5vxVpZ4ftvflIrW8qq0uOVK6QIf9A/YTGhCXl2qxxTg2A6+0rg\n" +
+                    "ZqI7zKzUDxIbVv0KlgCbpHDC9d5+sdtDB3wW2pimuJ3p1z4/RHb4n/lDwXCACZl1S5l24yXX2pFZ\n" +
+                    "wdPCXmy5PYkHMssFLNhI24pprUIQs66M1QKBgQDQwjAjWisD3pRXESSfZRsaFkWJcM28hdbVFhPF\n" +
+                    "c6gWhwQLmTp0CuL2RPXcPUPFi6sN2iWWi3zxxi9Eyz+9uBn6AsOpo56N5MME/LiOnETO9TKb+Ib6\n" +
+                    "rQtKhjshcv3XkIqFPo2XdVvOAgglPO7vajX91iiXXuH7h7RmJud6l0y/lwKBgE+bi90gLuPtpoEr\n" +
+                    "VzIDKz40ED5bNYHT80NNy0rpT7J2GVN9nwStRYXPBBVeZq7xCpgqpgmO5LtDAWULeZBlbHlOdBwl\n" +
+                    "NhNKKl5wzdEUKwW0yBL1WSS5PQgWPwgARYP25/ggW22sj+49WIo1neXsEKPGWObk8e050f1fTt92\n" +
+                    "Vo1lAoGAb1gCoyBCzvi7sqFxm4V5oapnJeiQQJFjhoYWqGa26rQ+AvXXNuBcigIeDXNJPctSF0Uc\n" +
+                    "p11KbbCgiruBbckvM1vGsk6Sx4leRk+IFHRpJktFUek4o0eUg0shOsyyvyet48Dfg0a8FvcxROs0\n" +
+                    "gD+IYds5doiob/hcm1hnNB/3vk4=\n" +
+                    "-----END PRIVATE KEY-----\n";
+
+    public static final String certContent =
+            "-----BEGIN CERTIFICATE-----\n" +
+                    "MIIFZTCCBE2gAwIBAgIHKBCduBUoKDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE\n" +
+                    "BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY\n" +
+                    "BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm\n" +
+                    "aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5\n" +
+                    "IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky\n" +
+                    "ODcwHhcNMTIwMjAzMDMzMDQwWhcNMTcwMjA3MDUxMTIzWjBZMRkwFwYDVQQKDBAq\n" +
+                    "LnJlYWxob3N0aXAuY29tMSEwHwYDVQQLDBhEb21haW4gQ29udHJvbCBWYWxpZGF0\n" +
+                    "ZWQxGTAXBgNVBAMMECoucmVhbGhvc3RpcC5jb20wggEiMA0GCSqGSIb3DQEBAQUA\n" +
+                    "A4IBDwAwggEKAoIBAQCDT9AtEfs+s/I8QXp6rrCw0iNJ0+GgsybNHheU+JpL39LM\n" +
+                    "TZykCrZhZnyDvwdxCoOfE38Sa32baHKNds+y2SHnMNsOkw8OcNucHEBX1FIpOBGp\n" +
+                    "h9D6xC+umx9od6xMWETUv7j6h2u+WC3OhBM8fHCBqIiAol31/IkcqDxxsHlQ8S/o\n" +
+                    "CfTlXJUY6Yn628OA1XijKdRnadV0hZ829cv/PZKljjwQUTyrd0KHQeksBH+YAYSo\n" +
+                    "2JUl8ekNLsOi8/cPtfojnltzRI1GXi0ZONs8VnDzJ0a2gqZY+uxlz+CGbLnGnlN4\n" +
+                    "j9cBpE+MfUE+35Dq121sTpsSgF85Mz+pVhn2S633AgMBAAGjggG+MIIBujAPBgNV\n" +
+                    "HRMBAf8EBTADAQEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNV\n" +
+                    "HQ8BAf8EBAMCBaAwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5\n" +
+                    "LmNvbS9nZHMxLTY0LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYI\n" +
+                    "KwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3Np\n" +
+                    "dG9yeS8wgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au\n" +
+                    "Z29kYWRkeS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdv\n" +
+                    "ZGFkZHkuY29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSME\n" +
+                    "GDAWgBT9rGEyk2xF1uLuhV+auud2mWjM5zArBgNVHREEJDAighAqLnJlYWxob3N0\n" +
+                    "aXAuY29tgg5yZWFsaG9zdGlwLmNvbTAdBgNVHQ4EFgQUZyJz9/QLy5TWIIscTXID\n" +
+                    "E8Xk47YwDQYJKoZIhvcNAQEFBQADggEBAKiUV3KK16mP0NpS92fmQkCLqm+qUWyN\n" +
+                    "BfBVgf9/M5pcT8EiTZlS5nAtzAE/eRpBeR3ubLlaAogj4rdH7YYVJcDDLLoB2qM3\n" +
+                    "qeCHu8LFoblkb93UuFDWqRaVPmMlJRnhsRkL1oa2gM2hwQTkBDkP7w5FG1BELCgl\n" +
+                    "gZI2ij2yxjge6pOEwSyZCzzbCcg9pN+dNrYyGEtB4k+BBnPA3N4r14CWbk+uxjrQ\n" +
+                    "6j2Ip+b7wOc5IuMEMl8xwTyjuX3lsLbAZyFI9RCyofwA9NqIZ1GeB6Zd196rubQp\n" +
+                    "93cmBqGGjZUs3wMrGlm7xdjlX6GQ9UvmvkMub9+lL99A5W50QgCmFeI=\n" +
+                    "-----END CERTIFICATE-----\n";
+
+    public static final String rootCa =
+            "-----BEGIN CERTIFICATE-----\n" +
+                    "MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx\n" +
+                    "ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g\n" +
+                    "RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw\n" +
+                    "MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH\n" +
+                    "QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j\n" +
+                    "b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j\n" +
+                    "b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj\n" +
+                    "YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN\n" +
+                    "AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H\n" +
+                    "KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm\n" +
+                    "VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR\n" +
+                    "SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT\n" +
+                    "cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ\n" +
+                    "6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu\n" +
+                    "MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS\n" +
+                    "kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB\n" +
+                    "BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f\n" +
+                    "BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv\n" +
+                    "c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH\n" +
+                    "AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO\n" +
+                    "BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG\n" +
+                    "OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU\n" +
+                    "A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o\n" +
+                    "0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX\n" +
+                    "RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH\n" +
+                    "qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV\n" +
+                    "U+4=\n" +
+                    "-----END CERTIFICATE-----\n" +
+                    "-----BEGIN CERTIFICATE-----\n" +
+                    "MIIE+zCCBGSgAwIBAgICAQ0wDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1Zh\n" +
+                    "bGlDZXJ0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIElu\n" +
+                    "Yy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24g\n" +
+                    "QXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAe\n" +
+                    "BgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTA0MDYyOTE3MDYyMFoX\n" +
+                    "DTI0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBE\n" +
+                    "YWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgMiBDZXJ0\n" +
+                    "aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgC\n" +
+                    "ggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv\n" +
+                    "2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+q\n" +
+                    "N1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiO\n" +
+                    "r18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lN\n" +
+                    "f4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+YihfukEH\n" +
+                    "U1jPEX44dMX4/7VpkI+EdOqXG68CAQOjggHhMIIB3TAdBgNVHQ4EFgQU0sSw0pHU\n" +
+                    "TBFxs2HLPaH+3ahq1OMwgdIGA1UdIwSByjCBx6GBwaSBvjCBuzEkMCIGA1UEBxMb\n" +
+                    "VmFsaUNlcnQgVmFsaWRhdGlvbiBOZXR3b3JrMRcwFQYDVQQKEw5WYWxpQ2VydCwg\n" +
+                    "SW5jLjE1MDMGA1UECxMsVmFsaUNlcnQgQ2xhc3MgMiBQb2xpY3kgVmFsaWRhdGlv\n" +
+                    "biBBdXRob3JpdHkxITAfBgNVBAMTGGh0dHA6Ly93d3cudmFsaWNlcnQuY29tLzEg\n" +
+                    "MB4GCSqGSIb3DQEJARYRaW5mb0B2YWxpY2VydC5jb22CAQEwDwYDVR0TAQH/BAUw\n" +
+                    "AwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGGF2h0dHA6Ly9vY3NwLmdv\n" +
+                    "ZGFkZHkuY29tMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jZXJ0aWZpY2F0ZXMu\n" +
+                    "Z29kYWRkeS5jb20vcmVwb3NpdG9yeS9yb290LmNybDBLBgNVHSAERDBCMEAGBFUd\n" +
+                    "IAAwODA2BggrBgEFBQcCARYqaHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNv\n" +
+                    "bS9yZXBvc2l0b3J5MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOBgQC1\n" +
+                    "QPmnHfbq/qQaQlpE9xXUhUaJwL6e4+PrxeNYiY+Sn1eocSxI0YGyeR+sBjUZsE4O\n" +
+                    "WBsUs5iB0QQeyAfJg594RAoYC5jcdnplDQ1tgMQLARzLrUc+cb53S8wGd9D0Vmsf\n" +
+                    "SxOaFIqII6hR8INMqzW/Rn453HWkrugp++85j09VZw==\n" +
+                    "-----END CERTIFICATE-----\n" +
+                    "-----BEGIN CERTIFICATE-----\n" +
+                    "MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0\n" +
+                    "IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz\n" +
+                    "BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y\n" +
+                    "aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG\n" +
+                    "9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy\n" +
+                    "NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y\n" +
+                    "azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs\n" +
+                    "YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw\n" +
+                    "Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl\n" +
+                    "cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY\n" +
+                    "dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9\n" +
+                    "WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS\n" +
+                    "v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v\n" +
+                    "UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu\n" +
+                    "IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC\n" +
+                    "W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd\n" +
+                    "-----END CERTIFICATE-----\n";    
+
+    @Column(name = "public_ip_address", nullable = false)
+    private String publicIpAddress;
+
+    @Column(name = "public_mac_address", nullable = false)
+    private String publicMacAddress;
+
+    @Column(name = "public_netmask", nullable = false)
+    private String publicNetmask;
+
+    @Column(name = "active_session", updatable = true, nullable = false)
+    private int activeSession;
+
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "last_update", updatable = true, nullable = true)
+    private Date lastUpdateTime;
+
+    @Column(name = "session_details", updatable = true, nullable = true)
+    private byte[] sessionDetails;
+
+    @Transient
+    private boolean sslEnabled = false;
+
+    @Transient
+    private int port;
+
+    /**
+     * Correct constructor to use.
+     * 
+     */
+    public ConsoleProxyVO(long id, long serviceOfferingId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long dataCenterId, long domainId, long accountId,
+            int activeSession, boolean haEnabled) {
+        super(id, serviceOfferingId, name, name, Type.ConsoleProxy, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
+        this.activeSession = activeSession;
+    }
+
+    protected ConsoleProxyVO() {
+        super();
+    }
+
+    public void setPublicIpAddress(String publicIpAddress) {
+        this.publicIpAddress = publicIpAddress;
+    }
+
+    public void setPublicNetmask(String publicNetmask) {
+        this.publicNetmask = publicNetmask;
+    }
+
+    public void setPublicMacAddress(String publicMacAddress) {
+        this.publicMacAddress = publicMacAddress;
+    }
+
+    public void setActiveSession(int activeSession) {
+        this.activeSession = activeSession;
+    }
+
+    public void setLastUpdateTime(Date time) {
+        this.lastUpdateTime = time;
+    }
+
+    public void setSessionDetails(byte[] details) {
+        this.sessionDetails = details;
+    }
+
+    @Override
+    public String getPublicIpAddress() {
+        return this.publicIpAddress;
+    }
+
+    @Override
+    public String getPublicNetmask() {
+        return this.publicNetmask;
+    }
+
+    @Override
+    public String getPublicMacAddress() {
+        return this.publicMacAddress;
+    }
+
+    @Override
+    public int getActiveSession() {
+        return this.activeSession;
+    }
+
+    @Override
+    public Date getLastUpdateTime() {
+        return this.lastUpdateTime;
+    }
+
+    @Override
+    public byte[] getSessionDetails() {
+        return this.sessionDetails;
+    }
+
+    public boolean isSslEnabled() {
+        return sslEnabled;
+    }
+
+    public void setSslEnabled(boolean sslEnabled) {
+        this.sslEnabled = sslEnabled;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/DomainRouterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/DomainRouterVO.java b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
new file mode 100755
index 0000000..2cc9364
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
@@ -0,0 +1,246 @@
+// 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.vm;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.router.VirtualRouter;
+
+/**
+ */
+@Entity
+@Table(name="domain_router")
+@PrimaryKeyJoinColumn(name="id")
+@DiscriminatorValue(value="DomainRouter")
+public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
+    @Column(name="element_id")
+    private long elementId;
+
+    @Column(name="public_ip_address")
+    private String publicIpAddress;
+
+    @Column(name="public_mac_address")
+    private String publicMacAddress;
+
+    @Column(name="public_netmask")
+    private String publicNetmask;
+
+    @Column(name="is_redundant_router")
+    boolean isRedundantRouter;
+
+    @Column(name="priority")
+    int priority;
+
+    @Column(name="is_priority_bumpup")
+    boolean isPriorityBumpUp;
+
+    @Column(name="redundant_state")
+    @Enumerated(EnumType.STRING)
+    private RedundantState redundantState;
+
+    @Column(name="stop_pending")
+    boolean stopPending;
+
+    @Column(name="role")
+    @Enumerated(EnumType.STRING)
+    private Role role = Role.VIRTUAL_ROUTER;
+
+    @Column(name="template_version")
+    private String templateVersion;
+
+    @Column(name="scripts_version")
+    private String scriptsVersion;
+
+    @Column(name="vpc_id")
+    private Long vpcId;
+
+    public DomainRouterVO(long id,
+            long serviceOfferingId,
+            long elementId,
+            String name,
+            long templateId,
+            HypervisorType hypervisorType,
+            long guestOSId,
+            long domainId,
+            long accountId,
+            boolean isRedundantRouter,
+            int priority,
+            boolean isPriorityBumpUp,
+            RedundantState redundantState,
+            boolean haEnabled,
+            boolean stopPending, Long vpcId) {
+        super(id, serviceOfferingId, name, name, Type.DomainRouter, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
+        this.elementId = elementId;
+        this.isRedundantRouter = isRedundantRouter;
+        this.priority = priority;
+        this.redundantState = redundantState;
+        this.isPriorityBumpUp = isPriorityBumpUp;
+        this.stopPending = stopPending;
+        this.vpcId = vpcId;
+    }
+
+    public DomainRouterVO(long id,
+            long serviceOfferingId,
+            long elementId,
+            String name,
+            long templateId,
+            HypervisorType hypervisorType,
+            long guestOSId,
+            long domainId,
+            long accountId,
+            boolean isRedundantRouter,
+            int priority,
+            boolean isPriorityBumpUp,
+            RedundantState redundantState,
+            boolean haEnabled,
+            boolean stopPending,
+            VirtualMachine.Type vmType, Long vpcId) {
+        super(id, serviceOfferingId, name, name, vmType, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
+        this.elementId = elementId;
+        this.isRedundantRouter = isRedundantRouter;
+        this.priority = priority;
+        this.redundantState = redundantState;
+        this.isPriorityBumpUp = isPriorityBumpUp;
+        this.stopPending = stopPending;
+        this.vpcId = vpcId;
+    }
+
+    public long getElementId() {
+        return elementId;
+    }
+
+    public void setPublicIpAddress(String publicIpAddress) {
+        this.publicIpAddress = publicIpAddress;
+    }
+
+    public void setPublicMacAddress(String publicMacAddress) {
+        this.publicMacAddress = publicMacAddress;
+    }
+
+    public void setPublicNetmask(String publicNetmask) {
+        this.publicNetmask = publicNetmask;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public String getPublicNetmask() {
+        return publicNetmask;
+    }
+
+    public String getPublicMacAddress() {
+        return publicMacAddress;
+    }
+
+    protected DomainRouterVO() {
+        super();
+    }
+
+    @Override
+    public String getPublicIpAddress() {
+        return publicIpAddress;
+    }
+
+    @Override
+    public Role getRole() {
+        return role;
+    }
+
+    public void setRole(Role role) {
+        this.role = role;
+    }
+
+    @Override
+    public boolean getIsRedundantRouter() {
+        return this.isRedundantRouter;
+    }
+
+    public void setIsRedundantRouter(boolean isRedundantRouter) {
+        this.isRedundantRouter = isRedundantRouter;
+    }
+
+    @Override
+    public long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public int getPriority() {
+        return this.priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    @Override
+    public RedundantState getRedundantState() {
+        return this.redundantState;
+    }
+
+    public void setRedundantState(RedundantState redundantState) {
+        this.redundantState = redundantState;
+    }
+
+    public boolean getIsPriorityBumpUp() {
+        return this.isPriorityBumpUp;
+    }
+
+    public void setIsPriorityBumpUp(boolean isPriorityBumpUp) {
+        this.isPriorityBumpUp = isPriorityBumpUp;
+    }
+
+    @Override
+    public boolean isStopPending() {
+        return this.stopPending;
+    }
+
+    @Override
+    public void setStopPending(boolean stopPending) {
+        this.stopPending = stopPending;
+    }
+
+    public String getTemplateVersion() {
+        return this.templateVersion;
+    }
+
+    public void setTemplateVersion(String templateVersion) {
+        this.templateVersion = templateVersion;
+    }
+
+    public String getScriptsVersion() {
+        return this.scriptsVersion;
+    }
+
+    public void setScriptsVersion(String scriptsVersion) {
+        this.scriptsVersion = scriptsVersion;
+    }
+
+    @Override
+    public Long getVpcId() {
+        return vpcId;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/InstanceGroupVMMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/InstanceGroupVMMapVO.java b/engine/schema/src/com/cloud/vm/InstanceGroupVMMapVO.java
new file mode 100644
index 0000000..996655d
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/InstanceGroupVMMapVO.java
@@ -0,0 +1,71 @@
+// 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.vm;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.SecondaryTables;
+import javax.persistence.Table;
+
+@Entity
+@Table(name=("instance_group_vm_map"))
+@SecondaryTables({
+@SecondaryTable(name="user_vm",
+        pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}),      
+@SecondaryTable(name="instance_group", 
+		pkJoinColumns={@PrimaryKeyJoinColumn(name="group_id", referencedColumnName="id")})
+		})
+public class InstanceGroupVMMapVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+
+    @Column(name="group_id")
+    private long groupId;
+
+    @Column(name="instance_id")
+    private long instanceId;
+    
+
+    public InstanceGroupVMMapVO() { }
+
+    public InstanceGroupVMMapVO(long groupId, long instanceId) {
+        this.groupId = groupId;
+        this.instanceId = instanceId;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getGroupId() {
+        return groupId;
+    }
+
+    public long getInstanceId() {
+        return instanceId;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/InstanceGroupVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/InstanceGroupVO.java b/engine/schema/src/com/cloud/vm/InstanceGroupVO.java
new file mode 100644
index 0000000..ad66b5a
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/InstanceGroupVO.java
@@ -0,0 +1,120 @@
+// 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.vm;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="instance_group")
+@SecondaryTable(name="account",
+        pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")})
+public class InstanceGroupVO implements InstanceGroup {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="name")
+    String name;
+    
+    @Column(name="account_id")
+    private long accountId;
+    
+    @Column(name="domain_id", table="account", insertable=false, updatable=false)
+    private long domainId;
+    
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name="uuid")
+    private String uuid;
+    
+	@Column(name="type", table="account", insertable=false, updatable=false)
+	private short accountType;
+    
+    public InstanceGroupVO(String name, long accountId) {
+        this.name = name;
+        this.accountId = accountId;
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    protected InstanceGroupVO() {
+        super();
+    }
+    
+    @Override
+    public long getId() {
+    	return id;
+    }
+    
+    @Override
+    public String getName() {
+    	return name; 
+    }
+    
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+    
+    public long getDomainId() {
+        return domainId;
+    }
+    
+    public Date getRemoved() {
+        return removed;
+    }
+    
+	public Date getCreated() {
+		return created;
+	}
+    
+    public void setName(String name) {
+    	this.name = name;
+    }
+
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+    
+	@Override
+	public Short getAccountType() {
+		return accountType;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/ItWorkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/ItWorkDao.java b/engine/schema/src/com/cloud/vm/ItWorkDao.java
new file mode 100644
index 0000000..9b7d3fc
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/ItWorkDao.java
@@ -0,0 +1,45 @@
+// 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.vm;
+
+import java.util.List;
+
+import com.cloud.utils.db.GenericDao;
+import com.cloud.vm.ItWorkVO.Step;
+import com.cloud.vm.VirtualMachine.State;
+
+public interface ItWorkDao extends GenericDao<ItWorkVO, String> {
+    /**
+     * find a work item based on the instanceId and the state.
+     * 
+     * @param instanceId vm instance id
+     * @param state state
+     * @return ItWorkVO if found; null if not.
+     */
+    ItWorkVO findByOutstandingWork(long instanceId, State state);
+    
+    /**
+     * cleanup rows that are either Done or Cancelled and been that way 
+     * for at least wait time.
+     */
+    void cleanup(long wait);
+    
+    boolean updateStep(ItWorkVO work, Step step);
+
+    List<ItWorkVO> listWorkInProgressFor(long nodeId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/ItWorkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/ItWorkDaoImpl.java b/engine/schema/src/com/cloud/vm/ItWorkDaoImpl.java
new file mode 100644
index 0000000..3a849f8
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/ItWorkDaoImpl.java
@@ -0,0 +1,108 @@
+// 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.vm;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.time.InaccurateClock;
+import com.cloud.vm.ItWorkVO.Step;
+import com.cloud.vm.VirtualMachine.State;
+
+@Component
+@Local(value=ItWorkDao.class)
+public class ItWorkDaoImpl extends GenericDaoBase<ItWorkVO, String> implements ItWorkDao {
+    protected final SearchBuilder<ItWorkVO> AllFieldsSearch;
+    protected final SearchBuilder<ItWorkVO> CleanupSearch;
+    protected final SearchBuilder<ItWorkVO> OutstandingWorkSearch;
+    protected final SearchBuilder<ItWorkVO> WorkInProgressSearch;
+    
+    protected ItWorkDaoImpl() {
+        super();
+        
+        AllFieldsSearch = createSearchBuilder();
+        AllFieldsSearch.and("instance", AllFieldsSearch.entity().getInstanceId(), Op.EQ);
+        AllFieldsSearch.and("op", AllFieldsSearch.entity().getType(), Op.EQ);
+        AllFieldsSearch.and("step", AllFieldsSearch.entity().getStep(), Op.EQ);
+        AllFieldsSearch.done();
+        
+        CleanupSearch = createSearchBuilder();
+        CleanupSearch.and("step", CleanupSearch.entity().getType(), Op.IN);
+        CleanupSearch.and("time", CleanupSearch.entity().getUpdatedAt(), Op.LT);
+        CleanupSearch.done();
+        
+        OutstandingWorkSearch = createSearchBuilder();
+        OutstandingWorkSearch.and("instance", OutstandingWorkSearch.entity().getInstanceId(), Op.EQ);
+        OutstandingWorkSearch.and("op", OutstandingWorkSearch.entity().getType(), Op.EQ);
+        OutstandingWorkSearch.and("step", OutstandingWorkSearch.entity().getStep(), Op.NEQ);
+        OutstandingWorkSearch.done();
+        
+        WorkInProgressSearch = createSearchBuilder();
+        WorkInProgressSearch.and("server", WorkInProgressSearch.entity().getManagementServerId(), Op.EQ);
+        WorkInProgressSearch.and("step", WorkInProgressSearch.entity().getStep(), Op.NIN);
+        WorkInProgressSearch.done();
+    }
+    
+    @Override
+    public ItWorkVO findByOutstandingWork(long instanceId, State state) {
+        SearchCriteria<ItWorkVO> sc = OutstandingWorkSearch.create();
+        sc.setParameters("instance", instanceId);
+        sc.setParameters("op", state);
+        sc.setParameters("step", Step.Done);
+        
+        return findOneBy(sc);
+    }
+    
+    @Override
+    public void cleanup(long wait) {
+        SearchCriteria<ItWorkVO> sc = CleanupSearch.create();
+        sc.setParameters("step", Step.Done);
+        sc.setParameters("time", InaccurateClock.getTimeInSeconds() - wait);
+        
+        remove(sc);
+    }
+    
+    @Override
+    public boolean update(String id, ItWorkVO work) {
+        work.setUpdatedAt(InaccurateClock.getTimeInSeconds());
+        
+        return super.update(id, work);
+    }
+    
+    @Override
+    public boolean updateStep(ItWorkVO work, Step step) {
+        work.setStep(step);
+        return update(work.getId(), work);
+    }
+    
+    @Override
+    public List<ItWorkVO> listWorkInProgressFor(long nodeId) {
+        SearchCriteria<ItWorkVO> sc = WorkInProgressSearch.create();
+        sc.setParameters("server", nodeId);
+        sc.setParameters("step", Step.Done);
+        
+        return search(sc, null);
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/ItWorkVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/ItWorkVO.java b/engine/schema/src/com/cloud/vm/ItWorkVO.java
new file mode 100644
index 0000000..d218880
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/ItWorkVO.java
@@ -0,0 +1,179 @@
+// 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.vm;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.time.InaccurateClock;
+import com.cloud.vm.VirtualMachine.State;
+
+@Entity
+@Table(name="op_it_work")
+public class ItWorkVO {
+    enum ResourceType {
+        Volume,
+        Nic,
+        Host
+    }
+    
+    enum Step {
+        Prepare,
+        Starting,
+        Started,
+        Release,
+        Done,
+        Migrating,
+        Reconfiguring
+    }
+    
+    @Id
+    @Column(name="id")
+    String id;
+    
+    @Column(name="created_at")
+    long createdAt;
+    
+    @Column(name="mgmt_server_id")
+    long managementServerId;
+    
+    @Column(name="type")
+    State type;
+    
+    @Column(name="thread")
+    String threadName;
+    
+    @Column(name="step")
+    Step step;
+    
+    @Column(name="updated_at")
+    long updatedAt;
+    
+    @Column(name="instance_id")
+    long instanceId;
+    
+    public long getInstanceId() {
+        return instanceId;
+    }
+
+    @Column(name="resource_id")
+    long resourceId;
+    
+    @Column(name="resource_type")
+    ResourceType resourceType;
+    
+    @Column(name="vm_type")
+    @Enumerated(value=EnumType.STRING)
+    VirtualMachine.Type vmType;
+    
+    public VirtualMachine.Type getVmType() {
+        return vmType;
+    }
+    
+    public long getResourceId() {
+        return resourceId;
+    }
+
+    public void setResourceId(long resourceId) {
+        this.resourceId = resourceId;
+    }
+
+    public ResourceType getResourceType() {
+        return resourceType;
+    }
+
+    public void setResourceType(ResourceType resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    protected ItWorkVO() {
+    }
+    
+    protected ItWorkVO(String id, long managementServerId, State type, VirtualMachine.Type vmType, long instanceId) {
+        this.id = id;
+        this.managementServerId = managementServerId;
+        this.type = type;
+        this.threadName = Thread.currentThread().getName();
+        this.step = Step.Prepare;
+        this.instanceId = instanceId;
+        this.resourceType = null;
+        this.createdAt = InaccurateClock.getTimeInSeconds();
+        this.updatedAt = createdAt;
+        this.vmType = vmType;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public Long getCreatedAt() {
+        return createdAt;
+    }
+    
+    public long getManagementServerId() {
+        return managementServerId;
+    }
+    
+    public void setManagementServerId(long managementServerId) {
+        this.managementServerId = managementServerId;
+    }
+    
+    public State getType() {
+        return type;
+    }
+    
+    public void setType(State type) {
+        this.type = type;
+    }
+    
+    public String getThreadName() {
+        return threadName;
+    }
+    
+    public Step getStep() {
+        return step;
+    }
+    
+    public void setStep(Step step) {
+        this.step = step;
+    }
+    
+    public long getUpdatedAt() {
+        return updatedAt;
+    }
+    
+    public void setUpdatedAt(long updatedAt) {
+        this.updatedAt = updatedAt;
+    }
+    
+    public long getSecondsTaskIsInactive() {
+        return InaccurateClock.getTimeInSeconds() - this.updatedAt;
+    }
+    
+    public long getSecondsTaskHasBeenCreated() {
+        return InaccurateClock.getTimeInSeconds() - this.createdAt;
+    }
+    
+    @Override
+    public String toString() {
+        return new StringBuilder("ItWork[").append(id).append("-").append(type.toString()).append("-").append(instanceId).append("-").append(step.toString()).append("]").toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/NicVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/NicVO.java b/engine/schema/src/com/cloud/vm/NicVO.java
new file mode 100644
index 0000000..833cec5
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/NicVO.java
@@ -0,0 +1,365 @@
+// 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.vm;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.network.Networks.AddressFormat;
+import com.cloud.network.Networks.Mode;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "nics")
+public class NicVO implements Nic {
+    protected NicVO() {
+    }
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "instance_id")
+    Long instanceId;
+
+    @Column(name = "ip4_address")
+    String ip4Address;
+
+    @Column(name = "ip6_address")
+    String ip6Address;
+
+    @Column(name = "netmask")
+    String netmask;
+
+    @Column(name = "isolation_uri")
+    URI isolationUri;
+
+    @Column(name = "ip_type")
+    AddressFormat addressFormat;
+
+    @Column(name = "broadcast_uri")
+    URI broadcastUri;
+
+    @Column(name = "gateway")
+    String gateway;
+
+    @Column(name = "mac_address")
+    String macAddress;
+
+    @Column(name = "mode")
+    @Enumerated(value = EnumType.STRING)
+    Mode mode;
+
+    @Column(name = "network_id")
+    long networkId;
+
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    State state;
+
+    @Column(name = "reserver_name")
+    String reserver;
+
+    @Column(name = "reservation_id")
+    String reservationId;
+
+    @Column(name = "device_id")
+    int deviceId;
+
+    @Column(name = "update_time")
+    Date updateTime;
+
+    @Column(name = "default_nic")
+    boolean defaultNic;
+
+    @Column(name = "ip6_gateway")
+    String ip6Gateway;
+
+    @Column(name = "ip6_cidr")
+    String ip6Cidr;
+
+    @Column(name = "strategy")
+    @Enumerated(value = EnumType.STRING)
+    ReservationStrategy reservationStrategy;
+
+    @Enumerated(value = EnumType.STRING)
+    @Column(name = "vm_type")
+    VirtualMachine.Type vmType;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+    
+    @Column(name = "uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    @Column(name = "secondary_ip")
+    boolean secondaryIp;
+
+    public NicVO(String reserver, Long instanceId, long configurationId, VirtualMachine.Type vmType) {
+        this.reserver = reserver;
+        this.instanceId = instanceId;
+        this.networkId = configurationId;
+        this.state = State.Allocated;
+        this.vmType = vmType;
+    }
+
+    @Override
+    public String getIp4Address() {
+        return ip4Address;
+    }
+
+    public void setIp4Address(String address) {
+        ip4Address = address;
+    }
+
+    @Override
+    public String getMacAddress() {
+        return macAddress;
+    }
+
+    public void setMacAddress(String macAddress) {
+        this.macAddress = macAddress;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public boolean isDefaultNic() {
+        return defaultNic;
+    }
+
+    public void setDefaultNic(boolean defaultNic) {
+        this.defaultNic = defaultNic;
+    }
+
+    @Override
+    public String getIp6Address() {
+        return ip6Address;
+    }
+
+    public void setIp6Address(String ip6Address) {
+        this.ip6Address = ip6Address;
+    }
+
+    @Override
+    public String getNetmask() {
+        return netmask;
+    }
+
+    @Override
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+
+    @Override
+    public AddressFormat getAddressFormat() {
+        return addressFormat;
+    }
+
+    public void setAddressFormat(AddressFormat format) {
+        this.addressFormat = format;
+    }
+
+    public void setNetmask(String netmask) {
+        this.netmask = netmask;
+    }
+
+    @Override
+    public URI getIsolationUri() {
+        return isolationUri;
+    }
+
+    public void setIsolationUri(URI isolationUri) {
+        this.isolationUri = isolationUri;
+    }
+
+    @Override
+    public URI getBroadcastUri() {
+        return broadcastUri;
+    }
+
+    public void setBroadcastUri(URI broadcastUri) {
+        this.broadcastUri = broadcastUri;
+    }
+
+    public void setInstanceId(long instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public void setNetworkId(long networkId) {
+        this.networkId = networkId;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getInstanceId() {
+        return instanceId;
+    }
+
+    @Override
+    public long getNetworkId() {
+        return networkId;
+    }
+
+    @Override
+    public int getDeviceId() {
+        return deviceId;
+    }
+
+    @Override
+    public String getReservationId() {
+        return reservationId;
+    }
+
+    public void setReservationId(String id) {
+        this.reservationId = id;
+    }
+
+    public void setReservationStrategy(ReservationStrategy strategy) {
+        this.reservationStrategy = strategy;
+    }
+
+    public void setDeviceId(int deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    @Override
+    public Mode getMode() {
+        return mode;
+    }
+
+    public void setMode(Mode mode) {
+        this.mode = mode;
+    }
+
+    @Override
+    public String getReserver() {
+        return reserver;
+    }
+
+    public void setReserver(String reserver) {
+        this.reserver = reserver;
+    }
+
+    @Override
+    public ReservationStrategy getReservationStrategy() {
+        return reservationStrategy;
+    }
+
+    @Override
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("Nic[").append(id).append("-").append(instanceId).append("-").append(reservationId).append("-").append(ip4Address).append("]").toString();
+    }
+
+    @Override
+    public VirtualMachine.Type getVmType() {
+        return vmType;
+    }
+    
+    @Override
+    public String getUuid() {
+    	return this.uuid;
+    }
+    
+    public void setUuid(String uuid) {
+    	this.uuid = uuid;
+    }
+
+    @Override
+	public String getIp6Gateway() {
+		return ip6Gateway;
+	}
+
+	public void setIp6Gateway(String ip6Gateway) {
+		this.ip6Gateway = ip6Gateway;
+	}
+
+    @Override
+	public String getIp6Cidr() {
+		return ip6Cidr;
+	}
+
+	public void setIp6Cidr(String ip6Cidr) {
+		this.ip6Cidr = ip6Cidr;
+	}
+
+    public boolean getSecondaryIp() {
+        return secondaryIp;
+    }
+
+    public void setSecondaryIp(boolean secondaryIp) {
+        this.secondaryIp = secondaryIp;
+    }
+
+    public void setVmType(VirtualMachine.Type vmType) {
+        this.vmType = vmType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/SecondaryStorageVmVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/SecondaryStorageVmVO.java b/engine/schema/src/com/cloud/vm/SecondaryStorageVmVO.java
new file mode 100644
index 0000000..aa2efa5
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/SecondaryStorageVmVO.java
@@ -0,0 +1,135 @@
+// 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.vm;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
+/**
+ * SecondaryStorageVmVO domain object
+ */
+
+@Entity
+@Table(name = "secondary_storage_vm")
+@PrimaryKeyJoinColumn(name = "id")
+@DiscriminatorValue(value = "SecondaryStorageVm")
+public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStorageVm {
+
+    @Column(name = "public_ip_address", nullable = false)
+    private String publicIpAddress;
+
+    @Column(name = "public_mac_address", nullable = false)
+    private String publicMacAddress;
+
+    @Column(name = "public_netmask", nullable = false)
+    private String publicNetmask;
+
+    @Column(name = "guid", nullable = false)
+    private String guid;
+
+    @Column(name = "nfs_share", nullable = false)
+    private String nfsShare;
+
+    @Column(name = "role", nullable = false)
+    @Enumerated(value = EnumType.STRING)
+    private Role role;
+
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "last_update", updatable = true, nullable = true)
+    private Date lastUpdateTime;
+
+    public SecondaryStorageVmVO(long id, long serviceOfferingId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long dataCenterId, long domainId, long accountId,
+            Role role, boolean haEnabled) {
+        super(id, serviceOfferingId, name, name, Type.SecondaryStorageVm, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
+        this.role = role;
+    }
+
+    protected SecondaryStorageVmVO() {
+        super();
+    }
+
+    public void setPublicIpAddress(String publicIpAddress) {
+        this.publicIpAddress = publicIpAddress;
+    }
+
+    public void setPublicNetmask(String publicNetmask) {
+        this.publicNetmask = publicNetmask;
+    }
+
+    public void setPublicMacAddress(String publicMacAddress) {
+        this.publicMacAddress = publicMacAddress;
+    }
+
+    public void setLastUpdateTime(Date time) {
+        this.lastUpdateTime = time;
+    }
+
+    @Override
+    public String getPublicIpAddress() {
+        return this.publicIpAddress;
+    }
+
+    @Override
+    public String getPublicNetmask() {
+        return this.publicNetmask;
+    }
+
+    @Override
+    public String getPublicMacAddress() {
+        return this.publicMacAddress;
+    }
+
+    @Override
+    public Date getLastUpdateTime() {
+        return this.lastUpdateTime;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setNfsShare(String nfsShare) {
+        this.nfsShare = nfsShare;
+    }
+
+    public String getNfsShare() {
+        return nfsShare;
+    }
+
+    public Role getRole() {
+        return this.role;
+    }
+
+    public void setRole(Role role) {
+        this.role = role;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java b/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
new file mode 100644
index 0000000..24bb1e8
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/UserVmCloneSettingVO.java
@@ -0,0 +1,50 @@
+// 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.vm;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="user_vm_clone_setting")
+public class UserVmCloneSettingVO {
+
+    @Column(name="vm_id")
+    private Long vmId;
+
+    @Column(name="clone_type")
+    private String cloneType;
+
+    public UserVmCloneSettingVO() {
+
+    }
+
+    public UserVmCloneSettingVO(long id,
+            String cloneType) {
+        this.vmId = id;
+        this.cloneType = cloneType;
+    }
+
+    public long getVmId() {
+        return this.vmId;
+    }
+
+    public String getCloneType() {
+        return this.cloneType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
new file mode 100644
index 0000000..245b577
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
@@ -0,0 +1,85 @@
+// 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.vm;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="user_vm_details")
+public class UserVmDetailVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="vm_id")
+    private long vmId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value", length=1024)
+    private String value;
+    
+    public UserVmDetailVO() {}
+    
+    public UserVmDetailVO(long vmId, String name, String value) {
+    	this.vmId = vmId;
+    	this.name = name;
+    	this.value = value;
+    }
+
+	public long getId() {
+		return id;
+	}
+
+	public long getVmId() {
+		return vmId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public void setVmId(long vmId) {
+		this.vmId = vmId;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/UserVmVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/UserVmVO.java b/engine/schema/src/com/cloud/vm/UserVmVO.java
new file mode 100755
index 0000000..2e9bdf5
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/UserVmVO.java
@@ -0,0 +1,141 @@
+// 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.vm;
+
+import java.util.HashMap;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.uservm.UserVm;
+
+@Entity
+@Table(name="user_vm")
+@DiscriminatorValue(value="User")
+@PrimaryKeyJoinColumn(name="id")
+public class UserVmVO extends VMInstanceVO implements UserVm {
+
+    @Column(name="iso_id", nullable=true, length=17)
+    private Long isoId = null;
+    
+    @Column(name="user_data", updatable=true, nullable=true, length=32768)
+    @Basic(fetch = FetchType.LAZY)
+    private String userData;
+    
+    @Column(name="display_name", updatable=true, nullable=true)
+    private String displayName;
+    
+    @Column(name="update_parameters", updatable=true)
+    protected boolean updateParameters = true;
+    
+    transient String password;
+
+    @Override
+    public String getPassword() {
+        return password;
+    }
+    
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Override
+    public Long getIsoId() {
+        return isoId;
+    }
+    
+    @Override
+    public long getServiceOfferingId() {
+        return serviceOfferingId;
+    }
+
+    public UserVmVO(long id,
+                    String instanceName,
+                    String displayName,
+                    long templateId,
+                    HypervisorType hypervisorType,
+                    long guestOsId,
+                    boolean haEnabled,
+                    boolean limitCpuUse,
+                    long domainId,
+                    long accountId,
+                    long serviceOfferingId,
+                    String userData,
+                    String name, Long diskOfferingId) {
+        super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled, limitCpuUse, diskOfferingId);
+        this.userData = userData;
+        this.displayName = displayName;
+    	this.details = new HashMap<String, String>();
+    }
+    
+    protected UserVmVO() {
+        super();
+    }
+
+	public void setIsoId(Long id) {
+	    this.isoId = id;
+	}
+	
+    @Override
+	public void setUserData(String userData) {
+		this.userData = userData;
+	}
+
+    @Override
+	public String getUserData() {
+		return userData;
+	}
+	
+	@Override
+	public String getDisplayName() {
+	    return displayName;
+	}
+	
+	public void setDisplayName(String displayName) {
+	    this.displayName = displayName;
+	}
+	
+    @Override
+    public String getDetail(String name) {
+        assert (details != null) : "Did you forget to load the details?";
+        
+        return details != null ? details.get(name) : null;
+    }
+    
+    @Override
+    public void setAccountId(long accountId){
+        this.accountId = accountId;
+    }
+    
+    public void setDomainId(long domainId){
+        this.domainId = domainId;
+    }
+
+    public void setUpdateParameters(boolean updateParameters) {
+        this.updateParameters = updateParameters;
+    }
+
+    public boolean isUpdateParameters() {
+        return updateParameters;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDao.java b/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDao.java
new file mode 100644
index 0000000..cd93a69
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDao.java
@@ -0,0 +1,47 @@
+// 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.vm.dao;
+
+import java.util.Date;
+import java.util.List;
+
+import com.cloud.info.ConsoleProxyLoadInfo;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.vm.ConsoleProxyVO;
+import com.cloud.vm.VirtualMachine.State;
+
+public interface ConsoleProxyDao extends GenericDao<ConsoleProxyVO, Long> {
+	
+    public void update(long id, int activeSession, Date updateTime, byte[] sessionDetails);
+
+    public List<ConsoleProxyVO> getProxyListInStates(long dataCenterId, State... states);
+    public List<ConsoleProxyVO> getProxyListInStates(State... states);
+    
+    public List<ConsoleProxyVO> listByHostId(long hostId);
+    public List<ConsoleProxyVO> listByLastHostId(long hostId);
+    public List<ConsoleProxyVO> listUpByHostId(long hostId);
+    
+    public List<ConsoleProxyLoadInfo> getDatacenterProxyLoadMatrix();
+    public List<ConsoleProxyLoadInfo> getDatacenterVMLoadMatrix();
+    public List<ConsoleProxyLoadInfo> getDatacenterSessionLoadMatrix();
+    public List<Pair<Long, Integer>> getDatacenterStoragePoolHostInfo(long dcId, boolean countAllPoolTypes);
+    public List<Pair<Long, Integer>> getProxyLoadMatrix();
+    public int getProxyStaticLoad(long proxyVmId);
+    public int getProxyActiveLoad(long proxyVmId);
+    public List<Long> getRunningProxyListByMsid(long msid);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java
new file mode 100644
index 0000000..9af371e
--- /dev/null
+++ b/engine/schema/src/com/cloud/vm/dao/ConsoleProxyDaoImpl.java
@@ -0,0 +1,353 @@
+// 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.vm.dao;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.info.ConsoleProxyLoadInfo;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.Attribute;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.UpdateBuilder;
+import com.cloud.vm.ConsoleProxyVO;
+import com.cloud.vm.VirtualMachine.State;
+
+@Component
+@Local(value={ConsoleProxyDao.class})
+public class ConsoleProxyDaoImpl extends GenericDaoBase<ConsoleProxyVO, Long> implements ConsoleProxyDao {
+    private static final Logger s_logger = Logger.getLogger(ConsoleProxyDaoImpl.class);
+    
+    //
+    // query SQL for returnning console proxy assignment info as following
+    // 		proxy vm id, count of assignment
+    //
+    private static final String PROXY_ASSIGNMENT_MATRIX =
+    	"SELECT c.id, count(runningVm.id) AS count "																+
+    	" FROM console_proxy AS c LEFT JOIN vm_instance AS i ON c.id=i.id LEFT JOIN"																		+
+    	" (SELECT v.id AS id, v.proxy_id AS proxy_id FROM vm_instance AS v WHERE "  								+
+    	"  (v.state='Running' OR v.state='Creating' OR v.state='Starting' OR v.state='Migrating')) "				+
+    	" AS runningVm ON c.id = runningVm.proxy_id WHERE i.state='Running' "																+
+    	" GROUP BY c.id";
+    
+    //
+    // query SQL for returnning running VM count at data center basis
+    //
+    private static final String DATACENTER_VM_MATRIX =
+    	"SELECT d.id, d.name, count(v.id) AS count"																	+
+    	" FROM data_center AS d LEFT JOIN vm_instance AS v ON v.data_center_id=d.id "								+
+    	" WHERE (v.state='Creating' OR v.state='Starting' OR v.state='Running' OR v.state='Migrating')"  +
+    	" GROUP BY d.id, d.name";
+    
+    private static final String DATACENTER_ACTIVE_SESSION_MATRIX =
+    	"SELECT d.id, d.name, sum(c.active_session) AS count"														+
+    	" FROM data_center AS d LEFT JOIN vm_instance AS v ON v.data_center_id=d.id "								+
+    	" LEFT JOIN console_proxy AS c ON v.id=c.id "																+
+    	" WHERE v.type='ConsoleProxy' AND (v.state='Creating' OR v.state='Starting' OR v.state='Running' OR v.state='Migrating')"  +
+    	" GROUP BY d.id, d.name";
+    
+    //
+    // query SQL for returnning running console proxy count at data center basis
+    //
+    private static final String DATACENTER_PROXY_MATRIX =
+    	"SELECT d.id, d.name, count(dcid) as count" 													+
+    	" FROM data_center as d" 																		+
+    	" LEFT JOIN (" 																					+
+    	" SELECT v.data_center_id as dcid, c.active_session as active_session from vm_instance as v" 	+
+    	" INNER JOIN console_proxy as c ON v.id=c.id AND v.type='ConsoleProxy' AND (v.state='Creating' OR v.state='Starting' OR v.state='Running' OR v.state='Migrating')" +
+    	" ) as t ON d.id = t.dcid" 																		+
+    	" GROUP BY d.id, d.name";
+    
+    private static final String GET_PROXY_LOAD =
+    	"SELECT count(*) AS count"																				+
+    	" FROM vm_instance AS v " 																				+
+    	" WHERE v.proxy_id=? AND (v.state='Running' OR v.state='Starting' OR v.state='Creating' OR v.state='Migrating')";
+    
+    private static final String GET_PROXY_ACTIVE_LOAD =
+    	"SELECT active_session AS count"		+
+    	" FROM console_proxy" 					+
+    	" WHERE id=?";
+    
+    private static final String STORAGE_POOL_HOST_INFO =
+    	"SELECT p.data_center_id,  count(ph.host_id) " +
+    	" FROM storage_pool p, storage_pool_host_ref ph " +
+    	" WHERE p.id = ph.pool_id AND p.data_center_id = ? " +
+    	" GROUP by p.data_center_id";
+    
+    private static final String SHARED_STORAGE_POOL_HOST_INFO =
+    	"SELECT p.data_center_id,  count(ph.host_id) " +
+    	" FROM storage_pool p, storage_pool_host_ref ph " +
+    	" WHERE p.pool_type <> 'LVM' AND p.id = ph.pool_id AND p.data_center_id = ? " +
+    	" GROUP by p.data_center_id";
+    	
+    protected SearchBuilder<ConsoleProxyVO> DataCenterStatusSearch;
+    protected SearchBuilder<ConsoleProxyVO> StateSearch;
+    protected SearchBuilder<ConsoleProxyVO> HostSearch;
+    protected SearchBuilder<ConsoleProxyVO> LastHostSearch;
+    protected SearchBuilder<ConsoleProxyVO> HostUpSearch;
+    protected SearchBuilder<ConsoleProxyVO> StateChangeSearch;
+    
+    protected final Attribute _updateTimeAttr;
+    
+    public ConsoleProxyDaoImpl() {
+        DataCenterStatusSearch = createSearchBuilder();
+        DataCenterStatusSearch.and("dc", DataCenterStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        DataCenterStatusSearch.and("states", DataCenterStatusSearch.entity().getState(), SearchCriteria.Op.IN);
+        DataCenterStatusSearch.done();
+        
+        StateSearch = createSearchBuilder();
+        StateSearch.and("states", StateSearch.entity().getState(), SearchCriteria.Op.IN);
+        StateSearch.done();
+        
+        HostSearch = createSearchBuilder();
+        HostSearch.and("host", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        HostSearch.done();
+        
+        LastHostSearch = createSearchBuilder();
+        LastHostSearch.and("lastHost", LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ);
+        LastHostSearch.and("state", LastHostSearch.entity().getState(), SearchCriteria.Op.EQ);
+        LastHostSearch.done();
+        
+        HostUpSearch = createSearchBuilder();
+        HostUpSearch.and("host", HostUpSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        HostUpSearch.and("states", HostUpSearch.entity().getState(), SearchCriteria.Op.NIN);
+        HostUpSearch.done();
+        
+        StateChangeSearch = createSearchBuilder();
+        StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
+        StateChangeSearch.and("states", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
+        StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+        StateChangeSearch.and("update", StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ);
+        StateChangeSearch.done();
+        
+        _updateTimeAttr = _allAttributes.get("updateTime");
+        assert _updateTimeAttr != null : "Couldn't get this updateTime attribute";
+    }
+    
+    @Override
+    public void update(long id, int activeSession, Date updateTime, byte[] sessionDetails) {
+        ConsoleProxyVO ub = createForUpdate();
+        ub.setActiveSession(activeSession);
+        ub.setLastUpdateTime(updateTime);
+        ub.setSessionDetails(sessionDetails);
+        
+        update(id, ub);
+    }
+    
+    @Override
+    public boolean remove(Long id) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+        ConsoleProxyVO proxy = createForUpdate();
+        proxy.setPublicIpAddress(null);
+        proxy.setPrivateIpAddress(null);
+        
+        UpdateBuilder ub = getUpdateBuilder(proxy);
+        ub.set(proxy, "state", State.Destroyed);
+        ub.set(proxy, "privateIpAddress", null);
+        update(id, ub, proxy);
+        
+        boolean result = super.remove(id);
+        txn.commit();
+        return result;
+    }
+    
+    @Override
+    public List<ConsoleProxyVO> getProxyListInStates(long dataCenterId, State... states) {
+        SearchCriteria<ConsoleProxyVO> sc = DataCenterStatusSearch.create();
+        sc.setParameters("states", (Object[])states);
+        sc.setParameters("dc", dataCenterId);
+        return listBy(sc);
+    }
+
+    @Override
+    public List<ConsoleProxyVO> getProxyListInStates(State... states) {
+        SearchCriteria<ConsoleProxyVO> sc = StateSearch.create();
+        sc.setParameters("states", (Object[])states);
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<ConsoleProxyVO> listByHostId(long hostId) {
+        SearchCriteria<ConsoleProxyVO> sc = HostSearch.create();
+        sc.setParameters("host", hostId);
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<ConsoleProxyVO> listUpByHostId(long hostId) {
+        SearchCriteria<ConsoleProxyVO> sc = HostUpSearch.create();
+        sc.setParameters("host", hostId);
+        sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging});
+        return listBy(sc);
+    }
+    
+    @Override
+    public List<ConsoleProxyLoadInfo> getDatacenterProxyLoadMatrix() {
+    	return getDatacenterLoadMatrix(DATACENTER_PROXY_MATRIX);
+    }
+    
+    @Override
+    public List<ConsoleProxyLoadInfo> getDatacenterVMLoadMatrix() {
+    	return getDatacenterLoadMatrix(DATACENTER_VM_MATRIX);
+    }
+    
+    @Override
+    public List<ConsoleProxyLoadInfo> getDatacenterSessionLoadMatrix() {
+    	return getDatacenterLoadMatrix(DATACENTER_ACTIVE_SESSION_MATRIX);
+    }
+    
+    @Override
+    public List<Pair<Long, Integer>> getProxyLoadMatrix() {
+    	ArrayList<Pair<Long, Integer>> l = new ArrayList<Pair<Long, Integer>>();
+    	
+        Transaction txn = Transaction.currentTxn();;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(PROXY_ASSIGNMENT_MATRIX);
+            ResultSet rs = pstmt.executeQuery();
+            while(rs.next()) {
+            	l.add(new Pair<Long, Integer>(rs.getLong(1), rs.getInt(2)));
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+    
+    @Override
+    public List<Pair<Long, Integer>> getDatacenterStoragePoolHostInfo(long dcId, boolean countAllPoolTypes) {
+    	ArrayList<Pair<Long, Integer>> l = new ArrayList<Pair<Long, Integer>>();
+    	
+        Transaction txn = Transaction.currentTxn();;
+        PreparedStatement pstmt = null;
+        try {
+        	if(countAllPoolTypes) {
+                pstmt = txn.prepareAutoCloseStatement(STORAGE_POOL_HOST_INFO);
+            } else {
+                pstmt = txn.prepareAutoCloseStatement(SHARED_STORAGE_POOL_HOST_INFO);
+            }
+            pstmt.setLong(1, dcId);
+            
+            ResultSet rs = pstmt.executeQuery();
+            while(rs.next()) {
+            	l.add(new Pair<Long, Integer>(rs.getLong(1), rs.getInt(2)));
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+    
+    @Override
+    public int getProxyStaticLoad(long proxyVmId) {
+        Transaction txn = Transaction.currentTxn();;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(GET_PROXY_LOAD);
+            pstmt.setLong(1, proxyVmId);
+            
+            ResultSet rs = pstmt.executeQuery();
+            if(rs != null && rs.first()) {
+                return rs.getInt(1);
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return 0;
+    }
+    
+    @Override
+    public int getProxyActiveLoad(long proxyVmId) {
+        Transaction txn = Transaction.currentTxn();
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(GET_PROXY_ACTIVE_LOAD);
+            pstmt.setLong(1, proxyVmId);
+            
+            ResultSet rs = pstmt.executeQuery();
+            if(rs != null && rs.first()) {
+                return rs.getInt(1);
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return 0;
+    }
+    
+    private List<ConsoleProxyLoadInfo> getDatacenterLoadMatrix(String sql) {
+    	ArrayList<ConsoleProxyLoadInfo> l = new ArrayList<ConsoleProxyLoadInfo>();
+    	
+        Transaction txn = Transaction.currentTxn();;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(sql);
+            ResultSet rs = pstmt.executeQuery();
+            while(rs.next()) {
+            	ConsoleProxyLoadInfo info = new ConsoleProxyLoadInfo();
+            	info.setId(rs.getLong(1));
+            	info.setName(rs.getString(2));
+            	info.setCount(rs.getInt(3));
+            	l.add(info);
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+
+    @Override
+    public List<Long> getRunningProxyListByMsid(long msid) {
+    	List<Long> l = new ArrayList<Long>();
+        Transaction txn = Transaction.currentTxn();;
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = txn.prepareAutoCloseStatement(
+            		"SELECT c.id FROM console_proxy c, vm_instance v, host h " +
+            		"WHERE c.id=v.id AND v.state='Running' AND v.host_id=h.id AND h.mgmt_server_id=?");
+            
+            pstmt.setLong(1, msid);
+            ResultSet rs = pstmt.executeQuery();
+            while(rs.next()) {
+            	l.add(rs.getLong(1));
+            }
+        } catch (SQLException e) {
+        } catch (Throwable e) {
+        }
+        return l;
+    }
+
+	@Override
+	public List<ConsoleProxyVO> listByLastHostId(long hostId) {
+		SearchCriteria<ConsoleProxyVO> sc = LastHostSearch.create();
+		sc.setParameters("lastHost", hostId);
+		sc.setParameters("state", State.Stopped);
+		return listBy(sc);
+	}
+}


Mime
View raw message