Loading cloudcontrol/server/clients/cli.py +62 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ from cloudcontrol.common.tql.db.tag import StaticTag MIGRATION_TYPES = {'cold': ColdMigrationJob, 'hot': HotMigrationJob,} RESCUE_SCRIPT = 'rescue' class CliHandler(RegisteredCCHandler): Loading Loading @@ -342,6 +341,68 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() @listed def install(self, query): """ Enable install mode on selected virtual machines. :param query: the tql query to select objects. """ objects = self.client.list(query, show=('r', 'p', 'h', 'n', 'status'), method='install') errs = Reporter() for obj in objects: if obj['r'] != 'vm': errs.error(obj['id'], 'bad role') continue try: hvcon = self.server.get_client(obj['p']) except KeyError: errs.error(obj['id'], 'hypervisor not connected') else: try: hvcon.proxy.vm_install(obj['h']) except Exception as err: errs.error(obj['id'], 'Unexpected exception: %s' % str(err)) else: if obj['status'] == 'stopped': errs.success(obj['id'], 'vm now in install mode') else: errs.success(obj['id'], 'vm will be in install mode after a restart') return errs.get_dict() @listed def uninstall(self, query): """ Disable install mode on selected virtual machines. :param query: the tql query to select objects. """ objects = self.client.list(query, show=('r', 'p', 'h', 'n', 'status'), method='install') errs = Reporter() for obj in objects: if obj['r'] != 'vm': errs.error(obj['id'], 'bad role') continue try: hvcon = self.server.get_client(obj['p']) except KeyError: errs.error(obj['id'], 'hypervisor not connected') else: try: hvcon.proxy.vm_uninstall(obj['h']) except Exception as err: errs.error(obj['id'], 'Unexpected exception: %s' % str(err)) else: if obj['status'] == 'stopped': errs.success(obj['id'], 'vm now in normal mode') else: errs.success(obj['id'], 'vm will be in normal mode after a restart') return errs.get_dict() @listed def title(self, query, new_title): """ Edit the title of a VM. Loading Loading
cloudcontrol/server/clients/cli.py +62 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ from cloudcontrol.common.tql.db.tag import StaticTag MIGRATION_TYPES = {'cold': ColdMigrationJob, 'hot': HotMigrationJob,} RESCUE_SCRIPT = 'rescue' class CliHandler(RegisteredCCHandler): Loading Loading @@ -342,6 +341,68 @@ class CliHandler(RegisteredCCHandler): return errs.get_dict() @listed def install(self, query): """ Enable install mode on selected virtual machines. :param query: the tql query to select objects. """ objects = self.client.list(query, show=('r', 'p', 'h', 'n', 'status'), method='install') errs = Reporter() for obj in objects: if obj['r'] != 'vm': errs.error(obj['id'], 'bad role') continue try: hvcon = self.server.get_client(obj['p']) except KeyError: errs.error(obj['id'], 'hypervisor not connected') else: try: hvcon.proxy.vm_install(obj['h']) except Exception as err: errs.error(obj['id'], 'Unexpected exception: %s' % str(err)) else: if obj['status'] == 'stopped': errs.success(obj['id'], 'vm now in install mode') else: errs.success(obj['id'], 'vm will be in install mode after a restart') return errs.get_dict() @listed def uninstall(self, query): """ Disable install mode on selected virtual machines. :param query: the tql query to select objects. """ objects = self.client.list(query, show=('r', 'p', 'h', 'n', 'status'), method='install') errs = Reporter() for obj in objects: if obj['r'] != 'vm': errs.error(obj['id'], 'bad role') continue try: hvcon = self.server.get_client(obj['p']) except KeyError: errs.error(obj['id'], 'hypervisor not connected') else: try: hvcon.proxy.vm_uninstall(obj['h']) except Exception as err: errs.error(obj['id'], 'Unexpected exception: %s' % str(err)) else: if obj['status'] == 'stopped': errs.success(obj['id'], 'vm now in normal mode') else: errs.success(obj['id'], 'vm will be in normal mode after a restart') return errs.get_dict() @listed def title(self, query, new_title): """ Edit the title of a VM. Loading