Skip to content

Commit

Permalink
[CE-135] Initialize the vSphere agent
Browse files Browse the repository at this point in the history
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
hainingzhang committed Sep 8, 2017
1 parent da4f998 commit 4abb486
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/agent/vsphere/__init__.py
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
64 changes: 64 additions & 0 deletions src/agent/vsphere/cluster.py
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()
53 changes: 53 additions & 0 deletions src/agent/vsphere/host.py
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()

0 comments on commit 4abb486

Please sign in to comment.