summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/instance_usage_audit_log.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/instance_usage_audit_log.py b/nova/api/openstack/compute/contrib/instance_usage_audit_log.py
new file mode 100644
index 000000000..4a427d2a7
--- /dev/null
+++ b/nova/api/openstack/compute/contrib/instance_usage_audit_log.py
@@ -0,0 +1,71 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack LLC.
+# All Rights Reserved.
+#
+# Licensed 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.
+
+
+import datetime
+from webob import exc
+
+from nova.api.openstack import extensions
+from nova.compute import utils as compute_utils
+from nova import context as nova_context
+from nova import exception
+from nova import flags
+
+FLAGS = flags.FLAGS
+
+
+authorize = extensions.extension_authorizer('compute',
+ 'instance_usage_audit_log')
+
+
+class InstanceUsageAuditLogController(object):
+
+ def index(self, req):
+ context = req.environ['nova.context']
+ authorize(context)
+ task_log = compute_utils.get_audit_task_logs(context)
+ return {'instance_usage_audit_logs': task_log}
+
+ def show(self, req, id):
+ context = req.environ['nova.context']
+ authorize(context)
+ try:
+ if '.' in id:
+ before_date = datetime.datetime.strptime(str(id),
+ "%Y-%m-%d %H:%M:%S.%f")
+ else:
+ before_date = datetime.datetime.strptime(str(id),
+ "%Y-%m-%d %H:%M:%S")
+ except ValueError:
+ msg = _("Invalid timestamp for date %s") % id
+ raise webob.exc.HTTPBadRequest(explanation=msg)
+ task_log = compute_utils.get_audit_task_logs(context,
+ before=before_date)
+ return {'instance_usage_audit_log': task_log}
+
+
+class Instance_usage_audit_log(extensions.ExtensionDescriptor):
+ """Admin-only Task Log Monitoring"""
+ name = "OSInstanceUsageAuditLog"
+ alias = "os-instance_usage_audit_log"
+ namespace = "http://docs.openstack.org/ext/services/api/v1.1"
+ updated = "2012-07-06T01:00:00+00:00"
+
+ def get_resources(self):
+ ext = extensions.ResourceExtension('os-instance_usage_audit_log',
+ InstanceUsageAuditLogController())
+ return [ext]
at it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include <common.h> #include <ppc4xx.h> #include <asm/processor.h> # define SDRAM_LEN 0x08000000 /* * this is even after checkboard. It returns the size of the SDRAM * that we have installed. This function is called by board_init_f * in arch/ppc/lib/board.c to initialize the memory and return what I * found. */ phys_size_t initdram (int board_type) { /* Configure the SDRAMS */ /* disable memory controller */ mtdcr (SDRAM0_CFGADDR, SDRAM0_CFG); mtdcr (SDRAM0_CFGDATA, 0x00000000); udelay (500); /* Clear SDRAM0_BESR0 (Bus Error Syndrome Register) */ mtdcr (SDRAM0_CFGADDR, SDRAM0_BESR0); mtdcr (SDRAM0_CFGDATA, 0xffffffff); /* Clear SDRAM0_BESR1 (Bus Error Syndrome Register) */ mtdcr (SDRAM0_CFGADDR, SDRAM0_BESR1); mtdcr (SDRAM0_CFGDATA, 0xffffffff); /* Clear SDRAM0_ECCCFG (disable ECC) */ mtdcr (SDRAM0_CFGADDR, SDRAM0_ECCCFG); mtdcr (SDRAM0_CFGDATA, 0x00000000); /* Clear SDRAM0_ECCESR (ECC Error Syndrome Register) */ mtdcr (SDRAM0_CFGADDR, SDRAM0_ECCESR); mtdcr (SDRAM0_CFGDATA, 0xffffffff); /* Timing register: CASL=2, PTA=2, CTP=2, LDF=1, RFTA=5, RCD=2 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_TR); mtdcr (SDRAM0_CFGDATA, 0x010a4016); /* Memory Bank 0 Config == BA=0x00000000, SZ=64M, AM=3, BE=1 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_B0CR); mtdcr (SDRAM0_CFGDATA, 0x00084001); /* Memory Bank 1 Config == BA=0x04000000, SZ=64M, AM=3, BE=1 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_B1CR); mtdcr (SDRAM0_CFGDATA, 0x04084001); /* Memory Bank 2 Config == BE=0 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_B2CR); mtdcr (SDRAM0_CFGDATA, 0x00000000); /* Memory Bank 3 Config == BE=0 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_B3CR); mtdcr (SDRAM0_CFGDATA, 0x00000000); /* refresh timer = 0x400 */ mtdcr (SDRAM0_CFGADDR, SDRAM0_RTR); mtdcr (SDRAM0_CFGDATA, 0x04000000); /* Power management idle timer set to the default. */ mtdcr (SDRAM0_CFGADDR, SDRAM0_PMIT); mtdcr (SDRAM0_CFGDATA, 0x07c00000); udelay (500); /* Enable banks (DCE=1, BPRF=1, ECCDD=1, EMDUL=1) */ mtdcr (SDRAM0_CFGADDR, SDRAM0_CFG); mtdcr (SDRAM0_CFGDATA, 0x80e00000); return SDRAM_LEN; } /*