cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9299) Out-of-band Management for CloudStack
Date Mon, 02 May 2016 22:29:13 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15267631#comment-15267631
] 

ASF GitHub Bot commented on CLOUDSTACK-9299:
--------------------------------------------

Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1502#discussion_r61816081
  
    --- Diff: test/integration/smoke/test_outofbandmanagement.py ---
    @@ -0,0 +1,561 @@
    +# 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.
    +
    +
    +import marvin
    +from marvin.cloudstackTestCase import *
    +from marvin.cloudstackAPI import *
    +from marvin.lib.utils import *
    +from marvin.lib.base import *
    +from marvin.lib.common import *
    +from marvin.lib.utils import (random_gen)
    +from nose.plugins.attrib import attr
    +
    +from ipmisim.ipmisim import IpmiServerContext, IpmiServer, ThreadedIpmiServer
    +
    +import socket
    +import sys
    +import thread
    +import time
    +
    +
    +class TestOutOfBandManagement(cloudstackTestCase):
    +    """ Test cases for out of band management
    +    """
    +
    +    def setUp(self):
    +        self.apiclient = self.testClient.getApiClient()
    +        self.hypervisor = self.testClient.getHypervisorInfo()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.services = self.testClient.getParsedTestDataConfig()
    +        self.mgtSvrDetails = self.config.__dict__["mgtSvr"][0].__dict__
    +
    +        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
    +        self.host = None
    +        self.server = None
    +
    +        # use random port for ipmisim
    +        s = socket.socket()
    +        s.bind(('', 0))
    +        self.serverPort = s.getsockname()[1]
    +        s.close()
    +
    +        self.cleanup = []
    +
    +
    +    def tearDown(self):
    +        try:
    +            self.dbclient.execute("delete from oobm where port=%d" % self.getIpmiServerPort())
    +            self.dbclient.execute("delete from mshost_peer where peer_runid=%s" % self.getFakeMsRunId())
    +            self.dbclient.execute("delete from mshost where runid=%s" % self.getFakeMsRunId())
    +            self.dbclient.execute("delete from cluster_details where name='outOfBandManagementEnabled'")
    +            self.dbclient.execute("delete from data_center_details where name='outOfBandManagementEnabled'")
    +            cleanup_resources(self.apiclient, self.cleanup)
    +            if self.server:
    +                self.server.shutdown()
    +                self.server.server_close()
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +
    +    def getFakeMsId(self):
    +        return 1234567890
    +
    +
    +    def getFakeMsRunId(self):
    +        return 123456
    +
    +
    +    def getHost(self, hostId=None):
    +        if self.host and hostId is None:
    +            return self.host
    +
    +        response = list_hosts(
    +                        self.apiclient,
    +                        zoneid=self.zone.id,
    +                        type='Routing',
    +                        id=hostId
    +                        )
    +        if len(response) > 0:
    +            self.host = response[0]
    +            return self.host
    +        raise self.skipTest("No hosts found, skipping out-of-band management test")
    +
    +
    +    def getIpmiServerIp(self):
    +        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    +        s.connect((self.mgtSvrDetails["mgtSvrIp"], self.mgtSvrDetails["port"]))
    +        return s.getsockname()[0]
    +
    +
    +    def getIpmiServerPort(self):
    +        return self.serverPort
    +
    +
    +    def getOobmConfigCmd(self):
    +        cmd = configureOutOfBandManagement.configureOutOfBandManagementCmd()
    +        cmd.driver = 'ipmitool' # The default available driver
    +        cmd.address = self.getIpmiServerIp()
    +        cmd.port = self.getIpmiServerPort()
    +        cmd.username = 'admin'
    +        cmd.password = 'password'
    +        cmd.hostid = self.getHost().id
    +        return cmd
    +
    +
    +    def getOobmEnableCmd(self):
    +        cmd = enableOutOfBandManagementForHost.enableOutOfBandManagementForHostCmd()
    +        cmd.hostid = self.getHost().id
    +        return cmd
    +
    +
    +    def getOobmDisableCmd(self):
    +        cmd = disableOutOfBandManagementForHost.disableOutOfBandManagementForHostCmd()
    +        cmd.hostid = self.getHost().id
    +        return cmd
    +
    +
    +    def getOobmIssueActionCmd(self):
    +        cmd = issueOutOfBandManagementPowerAction.issueOutOfBandManagementPowerActionCmd()
    +        cmd.hostid = self.getHost().id
    +        cmd.action = 'STATUS'
    +        return cmd
    +
    +
    +    def issuePowerActionCmd(self, action, timeout=None):
    +        cmd = self.getOobmIssueActionCmd()
    +        cmd.action = action
    +        if timeout:
    +            cmd.timeout = timeout
    +        return self.apiclient.issueOutOfBandManagementPowerAction(cmd)
    +
    +
    +    def configureAndEnableOobm(self):
    +        self.apiclient.configureOutOfBandManagement(self.getOobmConfigCmd())
    +        response = self.apiclient.enableOutOfBandManagementForHost(self.getOobmEnableCmd())
    +        self.assertEqual(response.enabled, True)
    +
    +
    +    def startIpmiServer(self):
    +        def startIpmiServer(tname, server):
    +            self.debug("Starting ipmisim server")
    +            try:
    +                server.serve_forever()
    +            except Exception: pass
    +        IpmiServerContext('reset')
    +        ThreadedIpmiServer.allow_reuse_address = False
    +        server = ThreadedIpmiServer(('0.0.0.0', self.getIpmiServerPort()), IpmiServer)
    +        thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
    +        self.server = server
    +
    +
    +    def checkSyncToState(self, state, interval):
    +        self.debug("Waiting for background thread to update powerstate to " + state)
    +        time.sleep(1 + int(interval)*2/1000) # interval is in ms
    +        response = self.getHost(hostId=self.getHost().id).outofbandmanagement
    +        self.assertEqual(response.powerstate, state)
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_configure_invalid_driver(self):
    +        """
    +            Tests out-of-band management configuration with invalid driver
    +        """
    +        cmd = self.getOobmConfigCmd()
    +        cmd.driver = 'randomDriverThatDoesNotExist'
    +        try:
    +            response = self.apiclient.configureOutOfBandManagement(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_configure_default_driver(self):
    +        """
    +            Tests out-of-band management configuration with valid data
    +        """
    +        cmd = self.getOobmConfigCmd()
    +        response = self.apiclient.configureOutOfBandManagement(cmd)
    +        self.assertEqual(response.hostid, cmd.hostid)
    +        self.assertEqual(response.driver, cmd.driver)
    +        self.assertEqual(response.address, cmd.address)
    +        self.assertEqual(response.port, str(cmd.port))
    +        self.assertEqual(response.username, cmd.username)
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_enable_feature_invalid(self):
    +        """
    +            Tests out-of-band management host enable feature with
    +            invalid options
    +        """
    +        cmd = self.getOobmEnableCmd()
    +        cmd.hostid = -1
    +        try:
    +            response = self.apiclient.enableOutOfBandManagementForHost(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +        try:
    +            cmd = enableOutOfBandManagementForCluster.enableOutOfBandManagementForClusterCmd()
    +            response = self.apiclient.enableOutOfBandManagementForCluster(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +        try:
    +            cmd = enableOutOfBandManagementForZone.enableOutOfBandManagementForZoneCmd()
    +            response = self.apiclient.enableOutOfBandManagementForZone(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_disable_feature_invalid(self):
    +        """
    +            Tests out-of-band management host disable feature with
    +            invalid options
    +        """
    +        cmd = self.getOobmDisableCmd()
    +        cmd.hostid = -1
    +        try:
    +            response = self.apiclient.disableOutOfBandManagementForHost(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +        try:
    +            cmd = disableOutOfBandManagementForCluster.disableOutOfBandManagementForClusterCmd()
    +            response = self.apiclient.disableOutOfBandManagementForCluster(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +        try:
    +            cmd = disableOutOfBandManagementForZone.disableOutOfBandManagementForZoneCmd()
    +            response = self.apiclient.disableOutOfBandManagementForZone(cmd)
    +            self.fail("Expected an exception to be thrown, failing")
    +        except Exception: pass
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_enable_feature_valid(self):
    +        """
    +            Tests out-of-band management host enable feature with
    +            valid options
    +        """
    +        self.apiclient.configureOutOfBandManagement(self.getOobmConfigCmd())
    +        cmd = self.getOobmEnableCmd()
    +        response = self.apiclient.enableOutOfBandManagementForHost(cmd)
    +        self.assertEqual(response.hostid, cmd.hostid)
    +        self.assertEqual(response.enabled, True)
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_disable_feature_valid(self):
    +        """
    +            Tests out-of-band management host disable feature with
    +            valid options
    +        """
    +
    +        self.apiclient.configureOutOfBandManagement(self.getOobmConfigCmd())
    +        cmd = self.getOobmDisableCmd()
    +        response = self.apiclient.disableOutOfBandManagementForHost(cmd)
    +        self.assertEqual(response.hostid, cmd.hostid)
    +        self.assertEqual(response.enabled, False)
    +
    +        response = self.getHost(hostId=cmd.hostid).outofbandmanagement
    +        self.assertEqual(response.powerstate, 'Disabled')
    +
    +
    +    @attr(tags=["smoke", "advanced"])
    +    def test_oobm_enabledisable_across_clusterzones(self):
    --- End diff --
    
    Could this method be separated for zone, cluster, and host?  It seems like it would make
the test case more readable.


> Out-of-band Management for CloudStack
> -------------------------------------
>
>                 Key: CLOUDSTACK-9299
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9299
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Rohit Yadav
>            Assignee: Rohit Yadav
>             Fix For: 4.9.0, Future
>
>
> Support access to a host’s out-of-band management interface (e.g. IPMI, iLO, DRAC,
etc.) to manage host power operations (on/off etc.) and querying current power state.
> FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Out-of-band+Management+for+CloudStack



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message