Archived community.zenoss.org | full text search
Skip navigation
664 Views 0 Replies Latest reply: Apr 25, 2013 10:06 AM by PaVan Jakati RSS
PaVan Jakati Rank: White Belt 29 posts since
Mar 12, 2013
Currently Being Moderated

Apr 25, 2013 10:06 AM

Why so many transforms for Vmware Devices

Hi All ,

 

I see lot of transforms written for Vmware Devices , i am not sure if these are custom buit (only is my set up) or in all the standard set up where vmware zenpacks are installed . Below are few such transforms . Kindly suggest .

 

/VMware/Guest/Power/On
#IF THIS IS A GUEST POWER ON, CHANGE GUEST STATUSES
if device is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'powerState', None ) != 'poweredOn':
        @transact
        def updateDb():
            guests[0].powerState='poweredOn'
        updateDb()
--------------------------------------------------------------------------------
/VMware/Guest/Power/Off
#IF THIS IS A GUEST POWER OFF, CHANGE GUEST STATUSES
if device is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'powerState', None ) != 'poweredOff':
        @transact
        def updateDb():
            guests[0].powerState='poweredOff'
        updateDb()
--------------------------------------------------------------------------------
/VMware/Guest/Power/Shutdown
#IF THIS IS A GUEST POWER SHUTDOWN, CHANGE GUEST STATUSES
if device is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'powerState', None ) != 'poweredOff':
        @transact
        def updateDb():
            guests[0].powerState='poweredOff'
        updateDb()
--------------------------------------------------------------------------------
/VMware/Guest/Power/Standby
#IF THIS IS A GUEST POWER STANDBY, CHANGE GUEST STATUSES
if device is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'powerState', None ) != 'suspended':
        @transact
        def updateDb():
            guests[0].powerState='suspended'
        updateDb()
--------------------------------------------------------------------------------
/VMware/Guest/Power/Suspend
#IF THIS IS A GUEST POWER SUSPEND, CHANGE GUEST STATUSES
if device is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'powerState', None ) != 'suspended':
        @transact
        def updateDb():
            guests[0].powerState='suspended'
        updateDb()
--------------------------------------------------------------------------------
/VMware/Guest/Connection/Disconnect
#IF THIS IS A GUEST DISCONNECT, CHANGE GUEST STATUSES
if dev is not None and evt.component:
    from Products.Zuul.utils import unbrain
    guests = map(unbrain, device.vmwareGuestSearch(id=evt.component))
    if guests and getattr(guests[0], 'connectionState', None ) != 'disconnected':
        @transact
        def updateDb():
guests[0].connectionState='disconnected'
        updateDb()

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points