No need for start_vm and stop_vm in the manager.

This commit is contained in:
Jeremy committed 2015-01-21 17:41:35 -07:00
1 parent beb27b3f69
commit f231b06833
6 files changed
+28 -33

No files matched your search

+4 -15
View File
@@ -126,20 +126,9 @@ class BaseManager:
uuid = str(uuid4())
vm = self._VM_CLASS(name, uuid, project, self, *args, **kwargs)
future = vm.create()
if isinstance(future, asyncio.Future):
yield from future
if asyncio.iscoroutinefunction(vm.create):
yield from vm.create()
else:
vm.create()
self._vms[vm.uuid] = vm
return vm
@asyncio.coroutine
def start_vm(self, uuid):
vm = self.get_vm(uuid)
yield from vm.start()
@asyncio.coroutine
def stop_vm(self, uuid):
vm = self.get_vm(uuid)
yield from vm.stop()
+10 -9
View File
@@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
log = logging.getLogger(__name__)
@@ -29,9 +28,9 @@ class BaseVM:
self._project = project
self._manager = manager
log.info("{module}: {name} [{uuid}] has been created".format(module=self.manager.module_name,
name=self.name,
uuid=self.uuid))
log.debug("{module}: {name} [{uuid}] initialized".format(module=self.manager.module_name,
name=self.name,
uuid=self.uuid))
# TODO: When delete release console ports
@@ -63,10 +62,10 @@ class BaseVM:
:param new_name: name
"""
log.info("{module}: {name} [{uuid}]: renamed to {new_name}".format(module=self.manager.module_name,
name=self.name,
uuid=self.uuid,
new_name=new_name))
log.info("{module}: {name} [{uuid}] renamed to {new_name}".format(module=self.manager.module_name,
name=self.name,
uuid=self.uuid,
new_name=new_name))
self._name = new_name
@property
@@ -102,7 +101,9 @@ class BaseVM:
Creates the VM.
"""
return
log.info("{module}: {name} [{uuid}] created".format(module=self.manager.module_name,
name=self.name,
uuid=self.uuid))
def start(self):
"""
+1
View File
@@ -27,6 +27,7 @@ class ProjectManager:
"""
def __init__(self):
self._projects = {}
@classmethod