Sep 26, 2011 5:45 AM
Trouble moving devices between deviceClasses via zendmd moveObject
-
Like (0)
Hi,
recently i had about 400 discovered devices, and wanted to move them all to a new deviceClass /Devices/ToIP.
i wrongly remembered some time ago I did it via device.moveObject(device, dmd.Devices.ToIP), but it seems it wasn't like that...
Now i have a Discovered with 400 elements on its device counter, but with the original ten devices (before the discovery).
I tried also to delete the devices under the new deviceClass /Devices/ToIP (for d in dmd.Devices.ToIP.getSubDevices(): if (condition): d.deleteDevice()), and it worked.
Now for trying to take out those 400 counted devices under discovered, i'm trying to add a device with the same IP as the old (which is done without errors), the intention is to delete the device again, but the device does not appear via GUI. Via zendmd i can see it, but the deleteDevice() is yelling that the object has not a primaryAq:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/opt/zenoss/Products/ZenModel/Device.py", line 1842, in deleteDevice
parent = self.getPrimaryParent()
File "/opt/zenoss/Products/ZenRelations/PrimaryPathObjectManager.py", line 85, in getPrimaryParent
return self.__primary_parent__.primaryAq()
AttributeError: 'NoneType' object has no attribute 'primaryAq'
The only thing i'm trying to get is to clean this mess... tried to do the deviceSearch, componentSearch and layer3_catalog repairs. But i'm still in the same place.
The new (and tried to be deleted) devices don't get listed on dmd.Devices.Discovered.getSubDevices() nor dmd.Devices.ToIP.getSubDevices().
Any hint? I promise i will never use moveObject if I don't understand completely its use :S.
Thanks!
ok, i've seen one thing more:
dmd.Devices.Discovered.devices() returns the relation of Discovered device Class with those lost devices. I guess it's the only thing that stands from that discovery...
i've tried to undo the moveObject by doing:
for d in dmd.Devices.Discovered.devices():
if '<filterexpression>' in d.getManageIp():
d.moveObject(d,dmd.Devices.Discovered)
and after that, i could do:
for d in dmd.Devices.Discovered.devices():
if '10.102' in d.getManageIp():
try:
d.deleteDevice()
except:
print "Exception %s!"%d.getManageIp()
d.checkRelations(repair=True)
pass
this got to delete some devices, but none of these actions had a result on the GUI, the Discovered devices count is still over 400 devices. It's counting the devices relation, but... how could i delete them?
luizzmizz:
You'll want to use the .changeDeviceClass method on device objects to move them. On IRC we'll try to clean up any mess left behind.
Best,
--Shane
For the same reasons as message/61588#, this question gets solved.
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||