Implement handle_<action>_cancel for SoftwareDeployment

This implements handle_<action>_cancel for SoftwareDeployment
to update the deployment to failed, when the resource fails due
to scheduler timeout or some other external reason.

Change-Id: Ibaa551d35e96f34cf950811a5b5a05e1cda6c364
Closes-Bug: #1585815
diff --git a/common/test.py b/common/test.py
index 9944bd1..0eedbe3 100644
--- a/common/test.py
+++ b/common/test.py
@@ -551,12 +551,13 @@
                      parameters=None, environment=None, tags=None,
                      expected_status='CREATE_COMPLETE',
                      disable_rollback=True, enable_cleanup=True,
-                     environment_files=None):
+                     environment_files=None, timeout=None):
         name = stack_name or self._stack_rand_name()
         templ = template or self.template
         templ_files = files or {}
         params = parameters or {}
         env = environment or {}
+        timeout_mins = timeout or self.conf.build_timeout
         self.client.stacks.create(
             stack_name=name,
             template=templ,
@@ -565,7 +566,8 @@
             parameters=params,
             environment=env,
             tags=tags,
-            environment_files=environment_files
+            environment_files=environment_files,
+            timeout_mins=timeout_mins
         )
         if expected_status not in ['ROLLBACK_COMPLETE'] and enable_cleanup:
             self.addCleanup(self._stack_delete, name)