virt-manager launcher action to directly start and open a specific VM
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I use virt-manager for my Qemu/KVM virtual machines. Booting a VM currently means launching virt-manager, selecting a VM to open it in the VM viewer and then finally turning the VM on.
I would like to add a launcher context menu option for it that directly opens the VM viewer window and launches the VM.
Copying and editing the virt-manager.desktop file to add the context menu action is no problem, but I don't know a suitable command to make virt-manager behave as I desire. How can I achieve this?
launcher kvm virt-manager
add a comment |
I use virt-manager for my Qemu/KVM virtual machines. Booting a VM currently means launching virt-manager, selecting a VM to open it in the VM viewer and then finally turning the VM on.
I would like to add a launcher context menu option for it that directly opens the VM viewer window and launches the VM.
Copying and editing the virt-manager.desktop file to add the context menu action is no problem, but I don't know a suitable command to make virt-manager behave as I desire. How can I achieve this?
launcher kvm virt-manager
add a comment |
I use virt-manager for my Qemu/KVM virtual machines. Booting a VM currently means launching virt-manager, selecting a VM to open it in the VM viewer and then finally turning the VM on.
I would like to add a launcher context menu option for it that directly opens the VM viewer window and launches the VM.
Copying and editing the virt-manager.desktop file to add the context menu action is no problem, but I don't know a suitable command to make virt-manager behave as I desire. How can I achieve this?
launcher kvm virt-manager
I use virt-manager for my Qemu/KVM virtual machines. Booting a VM currently means launching virt-manager, selecting a VM to open it in the VM viewer and then finally turning the VM on.
I would like to add a launcher context menu option for it that directly opens the VM viewer window and launches the VM.
Copying and editing the virt-manager.desktop file to add the context menu action is no problem, but I don't know a suitable command to make virt-manager behave as I desire. How can I achieve this?
launcher kvm virt-manager
launcher kvm virt-manager
asked Jul 28 '16 at 7:37
Byte CommanderByte Commander
66.7k27181310
66.7k27181310
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Use the virt-manager to find the "Libvirt URI" (select the VM, Edit -> Connection Details), then the name of the VM (select the VM, Edit -> Virtual Machine Details - if you have the machine open, you will have to make sure it is not maximized, then View -> Details, and go back to the Console when you're done.)
Then use (don't type the leading $)
$ virt-manager --connect <<URI>> --show-domain-console <<NAME>>
Where URI and name are where you got them from above. For example, mine looks like:
$ virt-manager --connect qemu:///system --show-domain-console win7
Run that from the command line. If that works, you should be able to put it in a simple script
$ cat > ~/bin/run-vm
#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console win7
^D
(Where ^D is control + D).
$ chmod u+x ~/bin/run-vm
And, then you should be able to add this command to your menu - see for example Answer on Unix and Linux Stackoverflow site.
You can also add the command directly to the menu with the parameters, but often it is easier for debugging problems to get the command running in the command line as a script.
add a comment |
I wrote a small script "~/scripts/StartVirtDomain.sh"
#!/bin/sh
# call this script with domainname as parameter
# to start domain and open viewer
/usr/bin/virsh start $1 # domain must be known to virsh
/usr/bin/virt-viewer -w $1 # -w to wait until domain is running.
virt-viewer should be installed with virt-manager; if not, sudo apt-get install virt-viewer.
You may call it with the name of the domain as parameter. It will start the domain (if not already started), then start virt-viewer to connect with this domain.
A sample desktop file (W7Pro.desktop)
[Desktop Entry]
Version=1.0
Type=Application
Name=W7Pro
Comment=Start Windows VM
Exec=~/scripts/StartVirtDomain.sh Win7Pro
Icon=
Path=~/scripts
Terminal=false
StartupNotify=false
did the job (domain name is Win7Pro). There is no error handling in the script; you may add some if necessary. Especially, if the domain is not known to virsh or fails to start, virt-viewer will probably wait forever.
Edit:
If you really need the console window of virt-manager, just call it like
virt-manager --connect=<URI> --show-domain-console <domain>
e.g. in my script this would be
/usr/bin/virt-manager --connect=qemu:///system --show-domain-console $1
The connection URI may be found in the virt-manager main window by selecting the respective connection (e.g. QEMU/KVM) and then using "Details" in the context menu.
You may even delete the line calling virsh, as the domain may be started from the virt-manager console.
I'm sorry, butvirt-vieweris not behaving as I want. I want the viewer window ofvirt-managerwith its tool bar including power button and its customized host keyboard shortcut.
– Byte Commander
Aug 5 '16 at 16:29
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f803888%2fvirt-manager-launcher-action-to-directly-start-and-open-a-specific-vm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use the virt-manager to find the "Libvirt URI" (select the VM, Edit -> Connection Details), then the name of the VM (select the VM, Edit -> Virtual Machine Details - if you have the machine open, you will have to make sure it is not maximized, then View -> Details, and go back to the Console when you're done.)
Then use (don't type the leading $)
$ virt-manager --connect <<URI>> --show-domain-console <<NAME>>
Where URI and name are where you got them from above. For example, mine looks like:
$ virt-manager --connect qemu:///system --show-domain-console win7
Run that from the command line. If that works, you should be able to put it in a simple script
$ cat > ~/bin/run-vm
#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console win7
^D
(Where ^D is control + D).
$ chmod u+x ~/bin/run-vm
And, then you should be able to add this command to your menu - see for example Answer on Unix and Linux Stackoverflow site.
You can also add the command directly to the menu with the parameters, but often it is easier for debugging problems to get the command running in the command line as a script.
add a comment |
Use the virt-manager to find the "Libvirt URI" (select the VM, Edit -> Connection Details), then the name of the VM (select the VM, Edit -> Virtual Machine Details - if you have the machine open, you will have to make sure it is not maximized, then View -> Details, and go back to the Console when you're done.)
Then use (don't type the leading $)
$ virt-manager --connect <<URI>> --show-domain-console <<NAME>>
Where URI and name are where you got them from above. For example, mine looks like:
$ virt-manager --connect qemu:///system --show-domain-console win7
Run that from the command line. If that works, you should be able to put it in a simple script
$ cat > ~/bin/run-vm
#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console win7
^D
(Where ^D is control + D).
$ chmod u+x ~/bin/run-vm
And, then you should be able to add this command to your menu - see for example Answer on Unix and Linux Stackoverflow site.
You can also add the command directly to the menu with the parameters, but often it is easier for debugging problems to get the command running in the command line as a script.
add a comment |
Use the virt-manager to find the "Libvirt URI" (select the VM, Edit -> Connection Details), then the name of the VM (select the VM, Edit -> Virtual Machine Details - if you have the machine open, you will have to make sure it is not maximized, then View -> Details, and go back to the Console when you're done.)
Then use (don't type the leading $)
$ virt-manager --connect <<URI>> --show-domain-console <<NAME>>
Where URI and name are where you got them from above. For example, mine looks like:
$ virt-manager --connect qemu:///system --show-domain-console win7
Run that from the command line. If that works, you should be able to put it in a simple script
$ cat > ~/bin/run-vm
#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console win7
^D
(Where ^D is control + D).
$ chmod u+x ~/bin/run-vm
And, then you should be able to add this command to your menu - see for example Answer on Unix and Linux Stackoverflow site.
You can also add the command directly to the menu with the parameters, but often it is easier for debugging problems to get the command running in the command line as a script.
Use the virt-manager to find the "Libvirt URI" (select the VM, Edit -> Connection Details), then the name of the VM (select the VM, Edit -> Virtual Machine Details - if you have the machine open, you will have to make sure it is not maximized, then View -> Details, and go back to the Console when you're done.)
Then use (don't type the leading $)
$ virt-manager --connect <<URI>> --show-domain-console <<NAME>>
Where URI and name are where you got them from above. For example, mine looks like:
$ virt-manager --connect qemu:///system --show-domain-console win7
Run that from the command line. If that works, you should be able to put it in a simple script
$ cat > ~/bin/run-vm
#!/bin/bash
virt-manager --connect qemu:///system --show-domain-console win7
^D
(Where ^D is control + D).
$ chmod u+x ~/bin/run-vm
And, then you should be able to add this command to your menu - see for example Answer on Unix and Linux Stackoverflow site.
You can also add the command directly to the menu with the parameters, but often it is easier for debugging problems to get the command running in the command line as a script.
answered Feb 15 at 4:13
PeterPeter
1413
1413
add a comment |
add a comment |
I wrote a small script "~/scripts/StartVirtDomain.sh"
#!/bin/sh
# call this script with domainname as parameter
# to start domain and open viewer
/usr/bin/virsh start $1 # domain must be known to virsh
/usr/bin/virt-viewer -w $1 # -w to wait until domain is running.
virt-viewer should be installed with virt-manager; if not, sudo apt-get install virt-viewer.
You may call it with the name of the domain as parameter. It will start the domain (if not already started), then start virt-viewer to connect with this domain.
A sample desktop file (W7Pro.desktop)
[Desktop Entry]
Version=1.0
Type=Application
Name=W7Pro
Comment=Start Windows VM
Exec=~/scripts/StartVirtDomain.sh Win7Pro
Icon=
Path=~/scripts
Terminal=false
StartupNotify=false
did the job (domain name is Win7Pro). There is no error handling in the script; you may add some if necessary. Especially, if the domain is not known to virsh or fails to start, virt-viewer will probably wait forever.
Edit:
If you really need the console window of virt-manager, just call it like
virt-manager --connect=<URI> --show-domain-console <domain>
e.g. in my script this would be
/usr/bin/virt-manager --connect=qemu:///system --show-domain-console $1
The connection URI may be found in the virt-manager main window by selecting the respective connection (e.g. QEMU/KVM) and then using "Details" in the context menu.
You may even delete the line calling virsh, as the domain may be started from the virt-manager console.
I'm sorry, butvirt-vieweris not behaving as I want. I want the viewer window ofvirt-managerwith its tool bar including power button and its customized host keyboard shortcut.
– Byte Commander
Aug 5 '16 at 16:29
add a comment |
I wrote a small script "~/scripts/StartVirtDomain.sh"
#!/bin/sh
# call this script with domainname as parameter
# to start domain and open viewer
/usr/bin/virsh start $1 # domain must be known to virsh
/usr/bin/virt-viewer -w $1 # -w to wait until domain is running.
virt-viewer should be installed with virt-manager; if not, sudo apt-get install virt-viewer.
You may call it with the name of the domain as parameter. It will start the domain (if not already started), then start virt-viewer to connect with this domain.
A sample desktop file (W7Pro.desktop)
[Desktop Entry]
Version=1.0
Type=Application
Name=W7Pro
Comment=Start Windows VM
Exec=~/scripts/StartVirtDomain.sh Win7Pro
Icon=
Path=~/scripts
Terminal=false
StartupNotify=false
did the job (domain name is Win7Pro). There is no error handling in the script; you may add some if necessary. Especially, if the domain is not known to virsh or fails to start, virt-viewer will probably wait forever.
Edit:
If you really need the console window of virt-manager, just call it like
virt-manager --connect=<URI> --show-domain-console <domain>
e.g. in my script this would be
/usr/bin/virt-manager --connect=qemu:///system --show-domain-console $1
The connection URI may be found in the virt-manager main window by selecting the respective connection (e.g. QEMU/KVM) and then using "Details" in the context menu.
You may even delete the line calling virsh, as the domain may be started from the virt-manager console.
I'm sorry, butvirt-vieweris not behaving as I want. I want the viewer window ofvirt-managerwith its tool bar including power button and its customized host keyboard shortcut.
– Byte Commander
Aug 5 '16 at 16:29
add a comment |
I wrote a small script "~/scripts/StartVirtDomain.sh"
#!/bin/sh
# call this script with domainname as parameter
# to start domain and open viewer
/usr/bin/virsh start $1 # domain must be known to virsh
/usr/bin/virt-viewer -w $1 # -w to wait until domain is running.
virt-viewer should be installed with virt-manager; if not, sudo apt-get install virt-viewer.
You may call it with the name of the domain as parameter. It will start the domain (if not already started), then start virt-viewer to connect with this domain.
A sample desktop file (W7Pro.desktop)
[Desktop Entry]
Version=1.0
Type=Application
Name=W7Pro
Comment=Start Windows VM
Exec=~/scripts/StartVirtDomain.sh Win7Pro
Icon=
Path=~/scripts
Terminal=false
StartupNotify=false
did the job (domain name is Win7Pro). There is no error handling in the script; you may add some if necessary. Especially, if the domain is not known to virsh or fails to start, virt-viewer will probably wait forever.
Edit:
If you really need the console window of virt-manager, just call it like
virt-manager --connect=<URI> --show-domain-console <domain>
e.g. in my script this would be
/usr/bin/virt-manager --connect=qemu:///system --show-domain-console $1
The connection URI may be found in the virt-manager main window by selecting the respective connection (e.g. QEMU/KVM) and then using "Details" in the context menu.
You may even delete the line calling virsh, as the domain may be started from the virt-manager console.
I wrote a small script "~/scripts/StartVirtDomain.sh"
#!/bin/sh
# call this script with domainname as parameter
# to start domain and open viewer
/usr/bin/virsh start $1 # domain must be known to virsh
/usr/bin/virt-viewer -w $1 # -w to wait until domain is running.
virt-viewer should be installed with virt-manager; if not, sudo apt-get install virt-viewer.
You may call it with the name of the domain as parameter. It will start the domain (if not already started), then start virt-viewer to connect with this domain.
A sample desktop file (W7Pro.desktop)
[Desktop Entry]
Version=1.0
Type=Application
Name=W7Pro
Comment=Start Windows VM
Exec=~/scripts/StartVirtDomain.sh Win7Pro
Icon=
Path=~/scripts
Terminal=false
StartupNotify=false
did the job (domain name is Win7Pro). There is no error handling in the script; you may add some if necessary. Especially, if the domain is not known to virsh or fails to start, virt-viewer will probably wait forever.
Edit:
If you really need the console window of virt-manager, just call it like
virt-manager --connect=<URI> --show-domain-console <domain>
e.g. in my script this would be
/usr/bin/virt-manager --connect=qemu:///system --show-domain-console $1
The connection URI may be found in the virt-manager main window by selecting the respective connection (e.g. QEMU/KVM) and then using "Details" in the context menu.
You may even delete the line calling virsh, as the domain may be started from the virt-manager console.
edited Aug 7 '16 at 10:14
answered Aug 5 '16 at 15:15
ridgyridgy
1,448159
1,448159
I'm sorry, butvirt-vieweris not behaving as I want. I want the viewer window ofvirt-managerwith its tool bar including power button and its customized host keyboard shortcut.
– Byte Commander
Aug 5 '16 at 16:29
add a comment |
I'm sorry, butvirt-vieweris not behaving as I want. I want the viewer window ofvirt-managerwith its tool bar including power button and its customized host keyboard shortcut.
– Byte Commander
Aug 5 '16 at 16:29
I'm sorry, but
virt-viewer is not behaving as I want. I want the viewer window of virt-manager with its tool bar including power button and its customized host keyboard shortcut.– Byte Commander
Aug 5 '16 at 16:29
I'm sorry, but
virt-viewer is not behaving as I want. I want the viewer window of virt-manager with its tool bar including power button and its customized host keyboard shortcut.– Byte Commander
Aug 5 '16 at 16:29
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f803888%2fvirt-manager-launcher-action-to-directly-start-and-open-a-specific-vm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown