Skip to content

Loading…

Feature/deviceclass change #1

Merged
merged 2 commits into from

2 participants

@joshw

No description provided.

@brianbruggeman brianbruggeman merged commit aa6bdd4 into develop

1 check passed

Details default Jenkins build 'request-ZenPacks.zenoss.OpenStack' #187 has succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
32 ZenPacks/zenoss/OpenStack/browser/resources/js/OpenStack.js
@@ -7,13 +7,13 @@ ZC.registerName('OpenStackImage', _t('Image'), _t('Images'));
ZC.registerName('OpenStackServer', _t('Server'), _t('Servers'));
var addOpenStack = new Zenoss.Action({
- text: _t('Add OpenStack') + '...',
+ text: _t('Add OpenStack Endpoint (User)') + '...',
id: 'addopenstack-item',
permission: 'Manage DMD',
handler: function(btn, e){
var win = new Zenoss.dialog.CloseDialog({
width: 450,
- title: _t('Add OpenStack'),
+ title: _t('Add OpenStack Endpoint (User)'),
items: [{
xtype: 'form',
buttonAlign: 'left',
@@ -41,9 +41,9 @@ var addOpenStack = new Zenoss.Action({
xtype: 'container',
layout: 'hbox',
items: [{
- xtype: 'textfield',
+ xtype: 'password',
name: 'api_key',
- fieldLabel: _t('API Key'),
+ fieldLabel: _t('Password / API Key'),
id: "openstack_api_key",
width: 260,
allowBlank: false
@@ -88,29 +88,6 @@ var addOpenStack = new Zenoss.Action({
}, {
xtype: 'container',
layout: 'hbox',
- items: [{
- xtype: 'combo',
- width: 260,
- name: 'api_version',
- fieldLabel: _t('Compute API Version'),
- id: "openstack_api_version",
- mode: 'local',
- store: [['1.1', '1.1'], ['2', '2'], ['3', '3']],
- value: '2',
- forceSelection: true,
- editable: false,
- allowBlank: false,
- triggerAction: 'all',
- selectOnFocus: false,
- },{
- xtype: 'label',
- style: 'font-style: italic',
- text: '(NOVA_VERSION)',
- margin: '0 0 0 10'
- }]
- }, {
- xtype: 'container',
- layout: 'hbox',
items: [{
xtype: 'textfield',
name: 'region_name',
@@ -202,7 +179,6 @@ function addOpenStackEndPointInspectorFields(inspector) {
inspector.addPropertyTpl(_t('Username'), '{values.username}');
inspector.addPropertyTpl(_t('Project ID'), '{values.project_id}');
inspector.addPropertyTpl(_t('Auth URL'), '{values.auth_url}');
- inspector.addPropertyTpl(_t('Compute API Version'), '{values.api_version}');
inspector.addPropertyTpl(_t('Region Name'), '{values.region_name}');
inspector.addPropertyTpl(_t('Total Servers'), '{values.serverCount}');
inspector.addPropertyTpl(_t('Total Flavors'), '{values.flavorCount}');
View
6 ZenPacks/zenoss/OpenStack/facades.py
@@ -23,13 +23,13 @@
from ZenPacks.zenoss.OpenStack.interfaces import IOpenStackFacade
-OPENSTACK_DEVICE_PATH = "/Devices/OpenStack"
+OPENSTACK_DEVICE_PATH = "/Devices/OpenStack/User"
class OpenStackFacade(ZuulFacade):
implements(IOpenStackFacade)
- def addOpenStack(self, username, api_key, project_id, auth_url, api_version,
+ def addOpenStack(self, username, api_key, project_id, auth_url,
region_name=None, collector='localhost'):
"""Add a new OpenStack endpoint to the system."""
parsed_url = urlparse(auth_url)
@@ -46,7 +46,7 @@ def addOpenStack(self, username, api_key, project_id, auth_url, api_version,
'zCommandPassword': api_key,
'zOpenStackProjectId': project_id,
'zOpenStackAuthUrl': auth_url,
- 'zOpenstackComputeApiVersion': api_version,
+ 'zOpenstackComputeApiVersion': 2,
'zOpenStackRegionName': region_name or '',
}
View
30 ZenPacks/zenoss/OpenStack/migrate/ChangeDeviceClass.py
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (C) Zenoss, Inc. 2014, all rights reserved.
+#
+# This content is made available according to terms specified in
+# License.zenoss under the directory where your Zenoss product is installed.
+#
+##############################################################################
+
+
+import logging
+log = logging.getLogger('zen.migrate')
+
+import Globals
+from Products.ZenModel.migrate.Migrate import Version
+from Products.ZenModel.ZenPack import ZenPackMigration
+
+
+class ChangeDeviceClass(ZenPackMigration):
+ """
+ ZenPacks.zenoss.OpenStack 1.2.3 moved the device class from /OpenStack
+ to /OpenStack/User.
+ """
+
+ version = Version(1, 2, 3)
+
+ def migrate(self, pack):
+ for device in pack.dmd.Devices.getOrganizer('/OpenStack').devices():
+ log.info("Moving device '%s' from /OpenStack to /OpenStack/User" % device.id)
+ device.changeDeviceClass('/OpenStack/User')
View
0 ZenPacks/zenoss/OpenStack/migrate/__init__.py
No changes.
View
20 ZenPacks/zenoss/OpenStack/objects/objects.xml
@@ -17,15 +17,16 @@ True
<property visible="True" type="lines" id="zDeviceTemplates" >
['OpenStackEndpoint']
</property>
-<property visible="True" type="string" id="zPythonClass" >
-ZenPacks.zenoss.OpenStack.Endpoint
-</property>
<property visible="True" type="float" id="zCommandCommandTimeout" >
300.0
</property>
<property visible="True" type="int" id="zCommandCycleTime" >
300
</property>
+<object id='User' module='Products.ZenModel.DeviceClass' class='DeviceClass'>
+<property visible="True" type="string" id="zPythonClass" >
+ZenPacks.zenoss.OpenStack.Endpoint
+</property>
<tomanycont id='rrdTemplates'>
<object id='OpenStackEndpoint' module='Products.ZenModel.RRDTemplate' class='RRDTemplate'>
<property type="string" id="targetPythonClass" mode="w" >
@@ -292,6 +293,9 @@ True
</property>
<tomanycont id='graphPoints'>
<object id='Total' module='Products.ZenModel.DataPointGraphPoint' class='DataPointGraphPoint'>
+<property type="long" id="sequence" mode="w" >
+0
+</property>
<property type="string" id="color" mode="w" >
000000
</property>
@@ -526,6 +530,9 @@ AVERAGE
</property>
</object>
<object id='Total' module='Products.ZenModel.DataPointGraphPoint' class='DataPointGraphPoint'>
+<property type="long" id="sequence" mode="w" >
+0
+</property>
<property type="string" id="color" mode="w" >
000000
</property>
@@ -610,6 +617,9 @@ False
<property type="boolean" id="hasSummary" mode="w" >
True
</property>
+<property type="long" id="sequence" mode="w" >
+0
+</property>
<tomanycont id='graphPoints'>
<object id='Active' module='Products.ZenModel.DataPointGraphPoint' class='DataPointGraphPoint'>
<property type="long" id="sequence" mode="w" >
@@ -989,6 +999,9 @@ AVERAGE
</property>
</object>
<object id='Total' module='Products.ZenModel.DataPointGraphPoint' class='DataPointGraphPoint'>
+<property type="long" id="sequence" mode="w" >
+0
+</property>
<property type="string" id="color" mode="w" >
000000
</property>
@@ -1081,6 +1094,7 @@ AVERAGE
</object>
</tomanycont>
</object>
+</object>
<!-- ('', 'zport', 'dmd', 'Events', 'Status', 'Image') -->
<object id='/zport/dmd/Events/Status/Image' module='Products.ZenEvents.EventClass' class='EventClass'>
<tomanycont id='instances'>
View
4 ZenPacks/zenoss/OpenStack/routers.py
@@ -19,12 +19,12 @@ class OpenStackRouter(DirectRouter):
def _getFacade(self):
return Zuul.getFacade('openstack', self.context)
- def addOpenStack(self, username, api_key, project_id, auth_url, api_version,
+ def addOpenStack(self, username, api_key, project_id, auth_url,
region_name=None, collector='localhost'):
facade = self._getFacade()
success, message = facade.addOpenStack(
- username, api_key, project_id, auth_url, api_version,
+ username, api_key, project_id, auth_url,
region_name=region_name, collector=collector)
if success:
Something went wrong with that request. Please try again.