diff --git a/qubes/storage/lvm.py b/qubes/storage/lvm.py index 5aad339a..794ded7e 100644 --- a/qubes/storage/lvm.py +++ b/qubes/storage/lvm.py @@ -43,7 +43,7 @@ class ThinPool(qubes.storage.Pool): self.log = logging.getLogger('qube.storage.lvm.%s' % self._pool_id) def clone(self, source, target): - cmd = ['clone', source.vid, target.vid] + cmd = ['clone', str(source), str(target)] qubes_lvm(cmd, self.log) return target @@ -217,8 +217,10 @@ class ThinPool(qubes.storage.Pool): def stop(self, volume): if volume.save_on_stop: self._commit(volume) - - if volume._is_volatile: + if volume._is_snapshot: + cmd = ['remove', volume._vid_snap] + qubes_lvm(cmd, self.log) + elif volume._is_volatile: cmd = ['remove', volume.vid] qubes_lvm(cmd, self.log) else: @@ -227,6 +229,12 @@ class ThinPool(qubes.storage.Pool): return volume def _snapshot(self, volume): + try: + cmd = ['remove', volume._vid_snap] + qubes_lvm(cmd, self.log) + except: # pylint: disable=bare-except + pass + if volume.source is None: cmd = ['clone', volume.vid, volume._vid_snap] else: @@ -342,7 +350,7 @@ def qubes_lvm(cmd, log=logging.getLogger('qube.storage.lvm')): out, err = p.communicate() return_code = p.returncode if out: - log.info(out) + log.debug(out) if return_code == 0 and err: log.warning(err) elif return_code != 0: diff --git a/qubes/tools/qvm_block.py b/qubes/tools/qvm_block.py index dd324056..02bef967 100644 --- a/qubes/tools/qvm_block.py +++ b/qubes/tools/qvm_block.py @@ -229,8 +229,13 @@ def get_parser(): def main(args=None): '''Main routine of :program:`qvm-block`.''' - args = get_parser().parse_args(args) - args.func(args) + parser = get_parser() + try: + args = parser.parse_args(args) + args.func(args) + except qubes.exc.QubesException as e: + parser.print_error(e.message) + return 1 if __name__ == '__main__': diff --git a/qubes/tools/qvm_pool.py b/qubes/tools/qvm_pool.py index 0444d56d..ca289f6d 100644 --- a/qubes/tools/qvm_pool.py +++ b/qubes/tools/qvm_pool.py @@ -187,7 +187,12 @@ def main(args=None): command line. ''' parser = get_parser() - args = parser.parse_args(args) + try: + args = parser.parse_args(args) + except qubes.exc.QubesException as e: + parser.print_error(e.message) + return 1 + if args.command is None or args.command == 'list': list_pools(args.app) elif args.command == 'add': diff --git a/qubes/tools/qvm_start.py b/qubes/tools/qvm_start.py index 4054265a..ab3106f3 100644 --- a/qubes/tools/qvm_start.py +++ b/qubes/tools/qvm_start.py @@ -133,13 +133,17 @@ def main(args=None): if args.debug: vm.debug = args.debug - try: + if args.debug: vm.start( preparing_dvm=args.preparing_dvm, start_guid=args.start_guid) - except qubes.exc.QubesException as e: - parser.error_runtime('Qubes error: {!r}'.format(e)) - + else: + try: + vm.start( + preparing_dvm=args.preparing_dvm, + start_guid=args.start_guid) + except qubes.exc.QubesException as e: + parser.error_runtime('Qubes error: {!r}'.format(e)) return 0 diff --git a/qubes/vm/mix/net.py b/qubes/vm/mix/net.py index 03b4b13e..a2a318df 100644 --- a/qubes/vm/mix/net.py +++ b/qubes/vm/mix/net.py @@ -164,7 +164,7 @@ class NetVMMixin(qubes.events.Emitter): pass try: - vm.attach_network(wait=False) + vm.attach_network() except qubes.exc.QubesException: vm.log.warning('Cannot attach network', exc_info=1)