Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d62b2f7
Merge pull request #195 from QualiSystems/master
alexazarh Feb 22, 2017
8c9f259
fixing descriptions and error messages
Feb 22, 2017
c13b391
Merge pull request #196 from QualiSystems/feature/alex_fixing_descrip…
alexazarh Feb 22, 2017
b69ed2a
refactored instance rollback
Feb 22, 2017
f5eef9b
Merge pull request #197 from QualiSystems/feature/alex_191_instance_r…
alexazarh Feb 22, 2017
aa9f5df
#75 Fix
gabhijit-izel Feb 23, 2017
304a3f1
#75 - Added more unit tests for algorithm verification
gabhijit-izel Feb 23, 2017
3497bfe
Merge pull request #199 from QualiSystems/feature/gabhijit-izel_75_su…
alexazarh Feb 23, 2017
7f56455
#201 Fix
gabhijit-izel Feb 26, 2017
5fe9777
Merge pull request #203 from QualiSystems/feature/gabhijit-izel_201_f…
alexazarh Feb 26, 2017
cc3a72f
installation-removal
EvgenyKhaliper Feb 27, 2017
cda476b
Merge pull request #204 from QualiSystems/installation-removal
EvgenyKhaliper Feb 27, 2017
c1818f6
#159 reopen - fix
gabhijit-izel Feb 27, 2017
ef73028
updated version to 1.0.0
Feb 27, 2017
3de0a1c
updated version
Feb 27, 2017
17977e2
fixing requirements
Feb 27, 2017
979b98b
Merge pull request #205 from QualiSystems/feature/alex_bump_ver
alexazarh Feb 27, 2017
e70d732
adding logs
Feb 28, 2017
8c08038
#159 Fix
gabhijit-izel Feb 28, 2017
f699b95
Merge branch 'develop' into feature/gabhijit-izel_159_udev_rules
gabhijit-izel Feb 28, 2017
9a3b1bc
Merge pull request #206 from QualiSystems/feature/gabhijit-izel_159_u…
alexazarh Feb 28, 2017
595c720
added more logs
Feb 28, 2017
d9f3acd
Merge branch 'develop' into feature/alex_202_add_logs
alexazarh Feb 28, 2017
2a5764d
fix tests
Feb 28, 2017
41e78ae
Merge branch 'feature/alex_202_add_logs' of https://github.com/QualiS…
Feb 28, 2017
ffd37a8
Merge pull request #207 from QualiSystems/feature/alex_202_add_logs
alexazarh Feb 28, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def Deploy(self, context, Name=None):
with LoggingSessionContext(context) as logger:
with ErrorHandlingContext(logger):
with CloudShellSessionContext(context) as session:
logger.debug("Deploy Called for Reservation: {0}".format(context.reservation.reservation_id))
logger.info("Deploy Called for Reservation: {0}".format(context.reservation.reservation_id))
# Get CS Session we are going to make an API call using this session
logger.debug("creating session: {0}, {1}, {2}".format(context.connectivity.server_address,
logger.info("creating session: {0}, {1}, {2}".format(context.connectivity.server_address,
context.connectivity.admin_auth_token,
context.reservation.domain))

Expand All @@ -48,17 +48,17 @@ def Deploy(self, context, Name=None):
app_name = context_json_decoded['name']
cloud_provider_name = context_json_decoded["deploymentService"].get("cloudProviderName")

logger.debug("cloud_provider_name from context = {0}".format(cloud_provider_name))
logger.info("cloud_provider_name from context = {0}".format(cloud_provider_name))

if cloud_provider_name:
deploy_service_res_model.cloud_provider = str(cloud_provider_name)

deploy_req = DeployDataHolder({self.APP_NAME: app_name,
self.IMAGE_PARAM: deploy_service_res_model})

logger.debug("Calling the Shell Driver's Deploy method for app: {0}".format(app_name))
logger.info("Calling the Shell Driver's Deploy method for app: {0}".format(app_name))

logger.debug("cloud_provider = {0}".format(deploy_service_res_model.cloud_provider))
logger.info("cloud_provider = {0}".format(deploy_service_res_model.cloud_provider))
# Calls command on the OpenStack cloud provider
result = session.ExecuteCommand(context.reservation.reservation_id,
deploy_service_res_model.cloud_provider,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Driver Description="Deploy From Glance Image" MainClass="driver.DeployOSNovaImageInstanceDriver" Name="Deploy From Glance Image" Version="0.0.16">
<Driver Description="Deploy From Glance Image" MainClass="driver.DeployOSNovaImageInstanceDriver" Name="Deploy From Glance Image" Version="1.0.0">
<Layout>
<Category Name="App Management">
<Command Description="" DisplayName="Deploy" Name="Deploy" Tags="allow_shared" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cloudshell-shell-core>=2.2.0,<2.3.0
cloudshell-cp-openstack<0.1.0
cloudshell-cp-openstack>=1.0.0,<1.1.0
jsonpickle==0.9.3
2 changes: 1 addition & 1 deletion drivers/openstack_shell/src/drivermetadata.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Driver Description="This driver orchestrate all the command that will be executed on OpenStack" MainClass="driver.OpenStackShellDriver" Name="OpenStack Shell Driver" Version="0.0.16">
<Driver Description="This driver orchestrate all the command that will be executed on OpenStack" MainClass="driver.OpenStackShellDriver" Name="OpenStack Shell Driver" Version="1.0.0">
<Layout>
<Category Name="Deployment">
<Command Description="" DisplayName="Deploy From Image" EnableCancellation="true" Name="deploy_from_image" Tags="allow_unreserved" />
Expand Down
2 changes: 1 addition & 1 deletion drivers/openstack_shell/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cloudshell-shell-core>=2.2.0,<2.3.0
cloudshell-cp-openstack<0.1.0
cloudshell-cp-openstack>=1.0.0,<1.1.0
jsonpickle==0.9.3
27 changes: 2 additions & 25 deletions drivers/openstack_shellPackage/DataModel/datamodel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<AttributeInfo DefaultValue="" Description="The physical interface mapping name to use when configuring OpenStack connectivity. The physical interface can be found under the connectivity provider configuration. For example, for OpenStack deployments that use the Linux-Bridge plugin, the physical interface name is located in the linuxbridge_agent.ini file under the “physical_interface_mappings” attribute." IsReadOnly="false" Name="OpenStack Physical Interface Name" Type="String">
<AttributeInfo DefaultValue="" Description="The physical interface mapping name to use when configuring OpenStack connectivity. The physical interface can be found under the connectivity provider configuration. If VXLAN is set as the 'VLAN Type' this attribute is not required. For example, for OpenStack deployments that use the Linux-Bridge plugin, the physical interface name is located in the linuxbridge_agent.ini file under the “physical_interface_mappings” attribute." IsReadOnly="false" Name="OpenStack Physical Interface Name" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand Down Expand Up @@ -95,7 +95,7 @@
</Rules>
</AttributeInfo>

<AttributeInfo DefaultValue="true" Description="Configure Linux udev rules to allow new interfaces to be recognized by the OS automatically. When using Windows machines this attribute should be set to false." IsReadOnly="false" Name="Auto udev" Type="Boolean">
<AttributeInfo DefaultValue="true" Description="Enable Linux udev rules to allow new interfaces to be recognized by the OS automatically. When using Windows machines this attribute should be set to false." IsReadOnly="false" Name="Auto udev" Type="Boolean">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand Down Expand Up @@ -215,29 +215,6 @@
</Models>
<Categories />
</ResourceFamily>
<ResourceFamily Description="" IsService="true" Name="Installation Options" ServiceType="Installation">
<AttachedAttributes />
<AttributeValues />
<Models>
<ResourceModel Description="" Name="Generic Installation Option" SupportsConcurrentCommands="false">
<AttachedAttributes>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Generic Input" UserInput="true">
<AllowedValues />
</AttachedAttribute>
</AttachedAttributes>
<AttributeValues>
<AttributeValue Name="Generic Input" Value="" />
</AttributeValues>
<ParentModels />
<Drivers>
<DriverName>Generic Driver</DriverName>
</Drivers>
<Scripts />
</ResourceModel>
</Models>
<Categories>
</Categories>
</ResourceFamily>
<ResourceFamily Description="" IsService="true" Name="Deployment Options" ServiceType="Deployment">
<AttachedAttributes />
<AttributeValues />
Expand Down
2 changes: 1 addition & 1 deletion drivers/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.16
1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def apply_connectivity(self, openstack_session, cp_resource_model, conn_request,
:param keystoneauth1.session.Session openstack_session:
:param OpenStackResourceModel cp_resource_model:
:param str conn_request: Connectivty Request JSON
:param LoggingSessionContext logger:
:param logging.Logger logger:
:return DriverResponseRoot:
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ def deploy(self, os_session, name, reservation, cp_resource_model, deploy_req_mo
:param DeployDataHolder deploy_req_model:
:param OpenStackResourceModel cp_resource_model:
:param cloudshell.shell.core.context.CancellationContext cancellation_context:
:param LoggingSessionContext logger:
:param logging.Logger logger:
:rtype DeployResultModel:
"""
logger.info("Inside Deploy Operation.")
# First create instance
instance = None
floating_ip_dict = None
floating_ip_str = ''
try:
# Look for right at the beginning -- ???
# Check for cancellation right at the beginning
self.cancellation_service.check_if_cancelled(cancellation_context=cancellation_context)

instance = self.instance_service.create_instance(openstack_session=os_session,
Expand Down Expand Up @@ -74,9 +73,10 @@ def deploy(self, os_session, name, reservation, cp_resource_model, deploy_req_mo
else:
floating_ip_subnet_uuid = cp_resource_model.floating_ip_subnet_uuid

floating_ip_dict = self.network_service.create_floating_ip(floating_ip_subnet_id=floating_ip_subnet_uuid,
openstack_session=os_session,
logger=logger)
floating_ip_dict = self.network_service.create_floating_ip(
floating_ip_subnet_id=floating_ip_subnet_uuid,
openstack_session=os_session,
logger=logger)
if floating_ip_dict:
floating_ip_str = floating_ip_dict['floating_ip_address']
if floating_ip_str:
Expand Down Expand Up @@ -105,18 +105,40 @@ def deploy(self, os_session, name, reservation, cp_resource_model, deploy_req_mo
# If any Exception is raised during deploy or assign floating IP - clean up OpenStack side and re-raise
except Exception as e:
logger.error(traceback.format_exc())
if instance:
instance_id = instance.id
# This calls detach and delete floating IP and instance terminate (handles empty floating IP)
self.instance_service.detach_floating_ip(openstack_session=os_session,
instance=instance,
floating_ip=floating_ip_str,
logger=logger)
self.network_service.delete_floating_ip(openstack_session=os_session,
floating_ip=floating_ip_str,
logger=logger)
self.instance_service.terminate_instance(openstack_session=os_session,
instance_id=instance_id,
logger=logger)

self._rollback_failed_instance(logger=logger,
os_session=os_session,
floating_ip=floating_ip_str,
instance=instance)

# Re-raise for the UI
raise

def _rollback_failed_instance(self, logger, os_session, floating_ip, instance):
"""

:param logging.Logger logger:
:param keystoneauth1.session.Session os_session:
:param str floating_ip:
:param novaclient.Client.servers.Server instance:
:return:
"""
if not instance:
return
instance_id = instance.id

# This calls detach and delete floating IP and instance terminate (handles empty floating IP)
try:
self.instance_service.detach_floating_ip(openstack_session=os_session,
instance=instance,
floating_ip=floating_ip,
logger=logger)
self.network_service.delete_floating_ip(openstack_session=os_session,
floating_ip=floating_ip,
logger=logger)
except Exception:
logger.exception("Failed to remove floating ip {}. ".format(floating_ip))

self.instance_service.terminate_instance(openstack_session=os_session,
instance_id=instance_id,
logger=logger)
Loading