mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-manager: Allow domain name or ID for cli options
This commit is contained in:
parent
8a544fa316
commit
ea1b6ae819
@ -62,20 +62,20 @@ The following C<DIALOG-WINDOW> options are currently available:
|
|||||||
|
|
||||||
Display the wizard for creating new virtual machines
|
Display the wizard for creating new virtual machines
|
||||||
|
|
||||||
=item --show-domain-editor=UUID
|
=item --show-domain-editor=NAME|ID|UUID
|
||||||
|
|
||||||
Display the dialog for editing properties of the virtual machine with
|
Display the dialog for editing properties of the virtual machine with
|
||||||
unique ID matching C<UUID>
|
unique ID matching either the domain name, ID, or UUID
|
||||||
|
|
||||||
=item --show-domain-performance=UUID
|
=item --show-domain-performance=NAME|ID|UUID
|
||||||
|
|
||||||
Display the dialog for monitoring performance of the virtual machine with
|
Display the dialog for monitoring performance of the virtual machine with
|
||||||
unique ID matching C<UUID>
|
unique ID matching either the domain name, ID, or UUID
|
||||||
|
|
||||||
=item --show-domain-console=UUID
|
=item --show-domain-console=NAME|ID|UUID
|
||||||
|
|
||||||
Display the virtual console of the virtual machine with
|
Display the virtual console of the virtual machine with
|
||||||
unique ID matching C<UUID>
|
unique ID matching either the domain name, ID, or UUID
|
||||||
|
|
||||||
=item --show-host-summary
|
=item --show-host-summary
|
||||||
|
|
||||||
|
@ -112,11 +112,11 @@ def parse_commandline():
|
|||||||
|
|
||||||
parser.add_argument("--show-domain-creator", action="store_true",
|
parser.add_argument("--show-domain-creator", action="store_true",
|
||||||
help="Show 'New VM' wizard")
|
help="Show 'New VM' wizard")
|
||||||
parser.add_argument("--show-domain-editor", metavar="UUID",
|
parser.add_argument("--show-domain-editor", metavar="NAME|ID|UUID",
|
||||||
help="Show domain details window")
|
help="Show domain details window")
|
||||||
parser.add_argument("--show-domain-performance", metavar="UUID",
|
parser.add_argument("--show-domain-performance", metavar="NAME|ID|UUID",
|
||||||
help="Show domain performance window")
|
help="Show domain performance window")
|
||||||
parser.add_argument("--show-domain-console", metavar="UUID",
|
parser.add_argument("--show-domain-console", metavar="NAME|ID|UUID",
|
||||||
help="Show domain graphical console window")
|
help="Show domain graphical console window")
|
||||||
parser.add_argument("--show-host-summary", action="store_true",
|
parser.add_argument("--show-host-summary", action="store_true",
|
||||||
help="Show connection details window")
|
help="Show connection details window")
|
||||||
|
@ -731,15 +731,27 @@ class vmmEngine(vmmGObject):
|
|||||||
self.conns[uri]["windowDetails"][uuid] = obj
|
self.conns[uri]["windowDetails"][uuid] = obj
|
||||||
return self.conns[uri]["windowDetails"][uuid]
|
return self.conns[uri]["windowDetails"][uuid]
|
||||||
|
|
||||||
def _show_vm_helper(self, src, uri, uuid, page=None, forcepage=False):
|
def _find_vm_by_id(self, uri, domstr):
|
||||||
|
vms = self.conns[uri]["conn"].vms
|
||||||
|
if domstr in vms:
|
||||||
|
return domstr
|
||||||
|
for vm in vms.values():
|
||||||
|
if domstr.isdigit():
|
||||||
|
if int(domstr) == vm.get_id():
|
||||||
|
return vm.get_uuid()
|
||||||
|
elif domstr == vm.get_name():
|
||||||
|
return vm.get_uuid()
|
||||||
|
|
||||||
|
def _show_vm_helper(self, src, uri, domstr, page=None, forcepage=False):
|
||||||
try:
|
try:
|
||||||
if uuid not in self.conns[uri]["conn"].vms:
|
uuid = self._find_vm_by_id(uri, domstr)
|
||||||
|
if not uuid:
|
||||||
# This will only happen if --show-* option was used during
|
# This will only happen if --show-* option was used during
|
||||||
# virt-manager launch and an invalid UUID is passed.
|
# virt-manager launch and an invalid UUID is passed.
|
||||||
# The error message must be sync otherwise the user will not
|
# The error message must be sync otherwise the user will not
|
||||||
# know why the application ended.
|
# know why the application ended.
|
||||||
self.err.show_err("%s does not have VM with UUID %s" %
|
self.err.show_err("%s does not have VM '%s'" %
|
||||||
(uri, uuid), modal=True)
|
(uri, domstr), modal=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
details = self._get_details_dialog(uri, uuid)
|
details = self._get_details_dialog(uri, uuid)
|
||||||
|
Loading…
Reference in New Issue
Block a user