-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CE-135] Initialize the vSphere agent
Initialzie the vSphere agent framework. The implementation code will be added in seperator PR. Change-Id: If9e215ceacbfdb461aa71ee63cc2c0f37cf58ce3 Signed-off-by: hainingzhang <haininghenryzh@vmware.com>
- Loading branch information
1 parent
da4f998
commit 4abb486
Showing
3 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copyright 2017 (c) VMware, Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright 2017 (c) VMware, Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import logging | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) | ||
from common import log_handler, LOG_LEVEL | ||
|
||
from agent import compose_up, compose_clean, compose_start, compose_stop, \ | ||
compose_restart | ||
|
||
from common import NETWORK_TYPES, CONSENSUS_PLUGINS_FABRIC_V1, \ | ||
CONSENSUS_MODES, NETWORK_SIZE_FABRIC_PRE_V1 | ||
|
||
from ..cluster_base import ClusterBase | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(LOG_LEVEL) | ||
logger.addHandler(log_handler) | ||
|
||
|
||
class ClusterOnVsphere(ClusterBase): | ||
""" Main handler to operate the cluster in pool | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def create(self, cid, mapped_ports, host, config, user_id=""): | ||
""" Create a cluster based on given data. This will first select the VM | ||
then call compose_up | ||
""" | ||
return | ||
|
||
def delete(self, id, worker_api, config): | ||
""" Delete a fabric cluster. | ||
""" | ||
return | ||
|
||
def start(self, name, worker_api, mapped_ports, log_type, log_level, | ||
log_server, config): | ||
""" Star a fabric cluster | ||
need to identify the right vm and run compose_start on that vm | ||
""" | ||
return | ||
|
||
def restart(self, name, worker_api, mapped_ports, log_type, log_level, | ||
log_server, config): | ||
""" Restart a fabric cluster. Need to identify which VM this cluster lives on | ||
and then call compose_restart | ||
""" | ||
return | ||
|
||
def stop(self, name, worker_api, mapped_ports, log_type, log_level, | ||
log_server, config): | ||
""" Stop a Fabric cluster. First identify the VM then call compose_stop. | ||
""" | ||
return | ||
|
||
|
||
cluster_on_vsphere = ClusterOnVsphere() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2017 (c) VMware, Inc. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import datetime | ||
import logging | ||
import os | ||
import sys | ||
|
||
|
||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) | ||
from common import \ | ||
db, log_handler, \ | ||
LOG_LEVEL | ||
|
||
from ..host_base import HostBase | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(LOG_LEVEL) | ||
logger.addHandler(log_handler) | ||
|
||
|
||
class VsphereHost(HostBase): | ||
""" Main handler to operate the VMs in vSphere | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def create(self, worker_api): | ||
""" Create a new vSphere host node | ||
""" | ||
|
||
return | ||
|
||
def delete(self, worker_api): | ||
""" Delete a host instance | ||
:param id: id of the host to delete | ||
:return: | ||
""" | ||
return | ||
|
||
def reset(self, host_type, worker_api): | ||
""" | ||
Clean a host's free clusters. | ||
:param id: host id | ||
:return: True or False | ||
""" | ||
return | ||
|
||
|
||
vsphere_host = VsphereHost() |