Skip to content

Commit

Permalink
Merge "[CE-135] Initialize the vSphere agent"
Browse files Browse the repository at this point in the history
  • Loading branch information
hightall authored and Gerrit Code Review committed Sep 12, 2017
2 parents 97a6ff8 + 4abb486 commit ac545cb
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 ac545cb

Please sign in to comment.