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 18:28:13 GMT

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

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_r61780464
  
    --- Diff: engine/schema/src/org/apache/cloudstack/outofbandmanagement/dao/OutOfBandManagementDaoImpl.java
---
    @@ -0,0 +1,163 @@
    +// 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.
    +
    +package org.apache.cloudstack.outofbandmanagement.dao;
    +
    +import com.cloud.utils.DateUtil;
    +import com.cloud.utils.db.Attribute;
    +import com.cloud.utils.db.DB;
    +import com.cloud.utils.db.Filter;
    +import com.cloud.utils.db.GenericDaoBase;
    +import com.cloud.utils.db.SearchBuilder;
    +import com.cloud.utils.db.SearchCriteria;
    +import com.cloud.utils.db.TransactionLegacy;
    +import com.cloud.utils.db.UpdateBuilder;
    +import com.cloud.utils.exception.CloudRuntimeException;
    +import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement;
    +import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementVO;
    +import org.apache.log4j.Logger;
    +import org.springframework.stereotype.Component;
    +
    +import javax.ejb.Local;
    +import java.sql.PreparedStatement;
    +import java.sql.SQLException;
    +import java.util.List;
    +
    +@DB
    +@Component
    +@Local(value = {OutOfBandManagementDao.class})
    +public class OutOfBandManagementDaoImpl extends GenericDaoBase<OutOfBandManagementVO,
Long> implements OutOfBandManagementDao {
    +    private static final Logger LOG = Logger.getLogger(OutOfBandManagementDaoImpl.class);
    +
    +    private SearchBuilder<OutOfBandManagementVO> HostSearch;
    +    private SearchBuilder<OutOfBandManagementVO> ManagementServerSearch;
    +    private SearchBuilder<OutOfBandManagementVO> OutOfBandManagementOwnerSearch;
    +    private SearchBuilder<OutOfBandManagementVO> StateUpdateSearch;
    +
    +    private Attribute PowerStateAttr;
    +    private Attribute MsIdAttr;
    +    private Attribute UpdateTimeAttr;
    +
    +    public OutOfBandManagementDaoImpl() {
    +        super();
    +
    +        HostSearch = createSearchBuilder();
    +        HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
    +        HostSearch.done();
    +
    +        ManagementServerSearch = createSearchBuilder();
    +        ManagementServerSearch.and("server", ManagementServerSearch.entity().getManagementServerId(),
SearchCriteria.Op.EQ);
    +        ManagementServerSearch.done();
    +
    +        OutOfBandManagementOwnerSearch = createSearchBuilder();
    +        OutOfBandManagementOwnerSearch.and("server", OutOfBandManagementOwnerSearch.entity().getManagementServerId(),
SearchCriteria.Op.EQ);
    +        OutOfBandManagementOwnerSearch.or("serverNull", OutOfBandManagementOwnerSearch.entity().getManagementServerId(),
SearchCriteria.Op.NULL);
    +        OutOfBandManagementOwnerSearch.done();
    +
    +        StateUpdateSearch = createSearchBuilder();
    +        StateUpdateSearch.and("status", StateUpdateSearch.entity().getPowerState(), SearchCriteria.Op.EQ);
    +        StateUpdateSearch.and("id", StateUpdateSearch.entity().getId(), SearchCriteria.Op.EQ);
    +        StateUpdateSearch.and("update", StateUpdateSearch.entity().getUpdateCount(),
SearchCriteria.Op.EQ);
    +        StateUpdateSearch.done();
    +
    +        PowerStateAttr = _allAttributes.get("powerState");
    +        MsIdAttr = _allAttributes.get("managementServerId");
    +        UpdateTimeAttr = _allAttributes.get("updateTime");
    +        assert (PowerStateAttr != null && MsIdAttr != null && UpdateTimeAttr
!= null) : "Couldn't find one of these attributes";
    +    }
    +
    +    @Override
    +    public OutOfBandManagement findByHost(long hostId) {
    +        SearchCriteria<OutOfBandManagementVO> sc = HostSearch.create("hostId",
hostId);
    +        return findOneBy(sc);
    +    }
    +
    +    @Override
    +    public List<OutOfBandManagementVO> findAllByManagementServer(long serverId)
{
    +        SearchCriteria<OutOfBandManagementVO> sc = OutOfBandManagementOwnerSearch.create();
    +        sc.setParameters("server", serverId);
    +        return listBy(sc, new Filter(OutOfBandManagementVO.class, "updateTime", true,
null, null));
    +    }
    +
    +    private void executeExpireOwnershipSql(final String sql, long resource) {
    +        TransactionLegacy txn = TransactionLegacy.currentTxn();
    +        try {
    --- End diff --
    
    To ensure that the transaction is properly closed, declare as a try with resources.


> 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