
This is a multi-part message in MIME format. --------------080508040005020804000700 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 09/23/2014 10:15 AM, PaulCheung wrote:
Dear David:
This problem have been solve!!!!!!!!! Using the vm ID to find the spice port!
/#!/bin/bash/ /curl -k -v -u 'admin@internal:password!' -H "Content-type: application/xml" -X GET https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1 > ./vm.info/ /p1=$(cat ./vm.info|grep '<port>')/ /p2=$(cat ./vm.info|grep '<secure_port>')/ /port1=${p1:0-11:4}/ /port2=${p2:0-18:4}/ /spicy -h 172.16.1.115 -w 123456 -p $port1 -s $port2 -f --spice-ca-file=/home/cubie/ca.crt >/dev/null 2>&1 &/
You could try POST with content type: application/json /https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1//start Hope that helps. :-)
It is awesome! * But dou you know what command can start the VM if the VM stop/power off ?*
Sincerely yours, PaulCheung
tel: 180-8882-7173
Subject: Re: [ovirt-users] Bug: Spice port changed!!!!! From: djasa@redhat.com To: eq2008@msn.com CC: users@ovirt.org Date: Mon, 22 Sep 2014 14:44:03 +0200
Paul,
Short answer: your approach will not work. I mentioned the custom hooks and engine-config/UserDefinedVMProperties for a reason. Please follow my advice first before asking further advice.
Longer answer: your changes to the libvirt domains would apply on next domain cold start but that will never happen because vdsm always creates libvirt domains as transient ones so the libvirt domain will disappear on guest OS shutdown. On next start of the same oVirt VM, vdsm will creates a new domain XML that will be used to start a new libvirt transient domain.
In order to make this new libvirt domain use your desired parameters, you have to edit the XML before it is used to start the libvirt domain and because we humans are too slow to do that and too annoyed to do that on every VM start, vdsm hooks mechanism was devised and a script in before_vm_start can do that changes for you (with input variables defined in engine-config and set in VM's custom properties).
So back to my original suggestion: do you still think that it is wise to try method that is more complicated and less secure than the custom launcher method?
Regards,
David
On Po, 2014-09-22 at 11:11 +0800, PaulCheung wrote:
Dear David:
I am trying figure it out using my way. So I used "virsh edit vm", I change the port the 5980 & 5981, but still not work!!!
I found after virsh edit, there is a xml file here /etc/libvirt/qemu which I edit using "virsh edit vm".
And I also run this command : "virsh define vm.xml"
also not work. Can you tell me where is the file I can fixed the spice port.
Sincerely yours, PaulCheung
tel: 180-8882-7173
Subject: Re: [ovirt-users] Bug: Spice port changed!!!!! From: djasa@redhat.com To: eq2008@msn.com CC: users@ovirt.org Date: Thu, 18 Sep 2014 15:27:50 +0200
Hi,
2) is not a file, it's a key in engine-config 3) is a VDSM custom hook that needs to be in all the hypervisors in DC/Cluster
Follow vdsm custom hook documentation (I don't have a link from top of my head but web or ML archives will surely help).
David
Dear David,
Thank you for your help . Your answer is very professional.
I still can't not find a way to stick with static port assignments For I don't understand you telling me , 2&3, where I can find the file to modify?
However, if you _really_ want to stick with static port assignments, do the following: 1) designate the port range so that it doesn't collide with other ranges in use (e.g. RHEV uses 5900-6023, so 5800-5899 could be safe) 2) add a custom VM properties to the engine for setting of port and tls-port 3) add a vdsm hook to before_vm_start directory on each host
add "port" and "tlsPort" parameters to the graphics element of
will libvirt
domain xml
Sincerely yours, PaulCheung
tel: 180-8882-7173
Subject: Re: [ovirt-users] Bug: Spice port changed!!!!! From: djasa@redhat.com To: eq2008@msn.com CC: users@ovirt.org Date: Wed, 17 Sep 2014 10:40:42 +0200
Hi Paul,
This behaviour is by design. It is a bad idea to override it. A good approach to your problem would be to write a launcher script
On Thu, 2014-09-18 at 14:51 +0800, PaulCheung wrote: that that
1) connect to the REST API 2) get the VM connection details 3) get new VM ticket 4) write this info down to a temporary .vv file [3] 5) launch remote-viewer
Some info how to use REST API is described here [1] and .vv file
would: format
is documented in virt-viewer sources [2]. Please note that [1] is a bit outdated: * you can use HTTP header "filter: true" to be able to log in as non-admin * you only have to use password login once when you use "prefer: persistent-auth" HTTP header and you send the cookie you got in a response to first request. In the future, the steps 2-4 will become a one step of getting a ready-to-use .vv file from the API [3] but we aren't there yet.
[1]
http://www.ovirt.org/How_to_Connect_to_SPICE_Console_Without_Portal
[2]
https://git.fedorahosted.org/cgit/virt-viewer.git/tree/src/virt-viewer-file....
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1128763
However, if you _really_ want to stick with static port assignments, do the following: 1) designate the port range so that it doesn't collide with other ranges in use (e.g. RHEV uses 5900-6023, so 5800-5899 could be safe) 2) add a custom VM properties to the engine for setting of port and tls-port 3) add a vdsm hook to before_vm_start directory on each host that will add "port" and "tlsPort" parameters to the graphics element of libvirt domain xml
Best regards,
David
On St, 2014-09-17 at 10:41 +0800, PaulCheung wrote: > Dear all, > > > After shutdown the VM, then restart the VM the Vm's spice port is > changed! > > > > > > > > Because I have 10 terminal ARM-Box running spice client connected to > the vm, but after the VM shutdown and start again, the vm not the one > whice the one before. > > > I wish you can let us have a option, to let the VM with a fixed spice > port, like: > vm1: spice port : 5900 tls:5901 > vm2: 5902 5903 > > > And I have another recommond: have a fuction to do that : > > > if the vm shutdown by user, it will start the VM automatic. That > means the VM can not be shutdown! > > > > > > > I hope you can have this two fuction! That means a lot to those who > are using Terminal box user like me. > > > > > I am sorry for my poor English. But I hope you all can understand > what I am saying. > > > > > > > > > > > > Sincerely yours, > PaulCheung > > > tel: 180-8882-7173 > > _______________________________________________ > Users mailing list > Users@ovirt.org > http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Regards, Vinzenz Feenstra | Senior Software Engineer RedHat Engineering Virtualization R & D Phone: +420 532 294 625 IRC: vfeenstr or evilissimo Better technology. Faster innovation. Powered by community collaboration. See how it works at redhat.com --------------080508040005020804000700 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body text="#000000" bgcolor="#FFFFFF"> <div class="moz-cite-prefix">On 09/23/2014 10:15 AM, PaulCheung wrote:<br> </div> <blockquote cite="mid:BLU180-W4990C8A3CD41765BBA153BDBB00@phx.gbl" type="cite"> <style><!-- .hmmessage P { margin:0px; padding:0px } body.hmmessage { font-size: 12pt; font-family:微软雅黑 } --></style> <div dir="ltr">Dear David: <div><br> </div> <div>This problem have been solve!!!!!!!!! Using the vm ID to find the spice port!</div> <div><br> </div> <div><br> </div> <div> <div><i>#!/bin/bash</i></div> <div><span style="font-size: 12pt;"><i>curl -k -v -u 'admin@internal:password!' -H "Content-type: application/xml" -X GET <a class="moz-txt-link-freetext" href="https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1">https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1</a> > ./vm.info</i></span></div> <div><i>p1=$(cat ./vm.info|grep '<port>')</i></div> <div><i>p2=$(cat ./vm.info|grep '<secure_port>')</i></div> <div><span style="font-size: 12pt;"><i>port1=${p1:0-11:4}</i></span></div> <div><i>port2=${p2:0-18:4}</i></div> <div><span style="font-size: 12pt;"><i>spicy -h 172.16.1.115 -w 123456 -p $port1 -s $port2 -f --spice-ca-file=/home/cubie/ca.crt >/dev/null 2>&1 &</i></span></div> </div> </div> </blockquote> <br> You could try POST with content type: application/json <span style="font-size: 12pt;"><i><a class="moz-txt-link-freetext" href="https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1">https://172.16.1.115/api/vms/ea273653-b083-4114-9ed4-bbb0bb5d38c1</a></i></span>/start <br> <br> Hope that helps. :-)<br> <blockquote cite="mid:BLU180-W4990C8A3CD41765BBA153BDBB00@phx.gbl" type="cite"> <div dir="ltr"> <div> <div><br> </div> <div><br> </div> </div> <div><br> </div> <div>It is awesome! <b> But dou you know what command can start the VM if the VM stop/power off ?</b></div> <div><br> <br> <div> <br> <br> Sincerely yours,<br> PaulCheung<br> <br> <br> tel: 180-8882-7173<br> </div> <br> <br> <div>> Subject: Re: [ovirt-users] Bug: Spice port changed!!!!!<br> > From: <a class="moz-txt-link-abbreviated" href="mailto:djasa@redhat.com">djasa@redhat.com</a><br> > To: <a class="moz-txt-link-abbreviated" href="mailto:eq2008@msn.com">eq2008@msn.com</a><br> > CC: <a class="moz-txt-link-abbreviated" href="mailto:users@ovirt.org">users@ovirt.org</a><br> > Date: Mon, 22 Sep 2014 14:44:03 +0200<br> > <br> > Paul,<br> > <br> > Short answer: your approach will not work. I mentioned the custom hooks<br> > and engine-config/UserDefinedVMProperties for a reason. Please follow my<br> > advice first before asking further advice.<br> > <br> > <br> > Longer answer: your changes to the libvirt domains would apply on next<br> > domain cold start but that will never happen because vdsm always creates<br> > libvirt domains as transient ones so the libvirt domain will disappear<br> > on guest OS shutdown. On next start of the same oVirt VM, vdsm will<br> > creates a new domain XML that will be used to start a new libvirt<br> > transient domain.<br> > <br> > In order to make this new libvirt domain use your desired parameters,<br> > you have to edit the XML before it is used to start the libvirt domain<br> > and because we humans are too slow to do that and too annoyed to do that<br> > on every VM start, vdsm hooks mechanism was devised and a script in<br> > before_vm_start can do that changes for you (with input variables<br> > defined in engine-config and set in VM's custom properties).<br> > <br> > <br> > So back to my original suggestion: do you still think that it is wise to<br> > try method that is more complicated and less secure than the custom<br> > launcher method?<br> > <br> > <br> > Regards,<br> > <br> > David<br> > <br> > On Po, 2014-09-22 at 11:11 +0800, PaulCheung wrote:<br> > > Dear David:<br> > > <br> > > <br> > > I am trying figure it out using my way. So I used "virsh edit vm",<br> > > I change the port the 5980 & 5981, but still not work!!!<br> > > <br> > > <br> > > <br> > > <br> > > <br> > > <br> > > <br> > > <br> > > <br> > > I found after virsh edit, there is a xml file here /etc/libvirt/qemu<br> > > which I edit using "virsh edit vm".<br> > > <br> > > <br> > > And I also run this command : "virsh define vm.xml" <br> > > <br> > > <br> > > also not work. Can you tell me where is the file I can fixed the<br> > > spice port.<br> > > <br> > > <br> > > <br> > > <br> > > Sincerely yours,<br> > > PaulCheung<br> > > <br> > > <br> > > tel: 180-8882-7173<br> > > <br> > > <br> > > <br> > > > Subject: Re: [ovirt-users] Bug: Spice port changed!!!!!<br> > > > From: <a class="moz-txt-link-abbreviated" href="mailto:djasa@redhat.com">djasa@redhat.com</a><br> > > > To: <a class="moz-txt-link-abbreviated" href="mailto:eq2008@msn.com">eq2008@msn.com</a><br> > > > CC: <a class="moz-txt-link-abbreviated" href="mailto:users@ovirt.org">users@ovirt.org</a><br> > > > Date: Thu, 18 Sep 2014 15:27:50 +0200<br> > > > <br> > > > Hi,<br> > > > <br> > > > 2) is not a file, it's a key in engine-config<br> > > > 3) is a VDSM custom hook that needs to be in all the hypervisors in<br> > > DC/Cluster<br> > > > <br> > > > Follow vdsm custom hook documentation (I don't have a link from top<br> > > of my head but web or ML archives will surely help).<br> > > > <br> > > > David<br> > > > <br> > > > On Thu, 2014-09-18 at 14:51 +0800, PaulCheung wrote:<br> > > > > Dear David,<br> > > > > <br> > > > > <br> > > > > Thank you for your help . Your answer is very professional.<br> > > > > <br> > > > > <br> > > > > I still can't not find a way to stick with static port assignments<br> > > > > For I don't understand you telling me , 2&3, where I can find the<br> > > > > file to modify?<br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > > However, if you _really_ want to stick with static port<br> > > assignments,<br> > > > > do<br> > > > > > the following:<br> > > > > > 1) designate the port range so that it doesn't collide with<br> > > other<br> > > > > ranges<br> > > > > > in use (e.g. RHEV uses 5900-6023, so 5800-5899 could be safe)<br> > > > > > 2) add a custom VM properties to the engine for setting of port<br> > > and<br> > > > > > tls-port<br> > > > > > 3) add a vdsm hook to before_vm_start directory on each host<br> > > that<br> > > > > will<br> > > > > > add "port" and "tlsPort" parameters to the graphics element of<br> > > > > libvirt<br> > > > > > domain xml<br> > > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > <br> > > > > Sincerely yours,<br> > > > > PaulCheung<br> > > > > <br> > > > > <br> > > > > tel: 180-8882-7173<br> > > > > <br> > > > > <br> > > > > <br> > > > > > Subject: Re: [ovirt-users] Bug: Spice port changed!!!!!<br> > > > > > From: <a class="moz-txt-link-abbreviated" href="mailto:djasa@redhat.com">djasa@redhat.com</a><br> > > > > > To: <a class="moz-txt-link-abbreviated" href="mailto:eq2008@msn.com">eq2008@msn.com</a><br> > > > > > CC: <a class="moz-txt-link-abbreviated" href="mailto:users@ovirt.org">users@ovirt.org</a><br> > > > > > Date: Wed, 17 Sep 2014 10:40:42 +0200<br> > > > > > <br> > > > > > Hi Paul,<br> > > > > > <br> > > > > > This behaviour is by design. It is a bad idea to override it. A<br> > > good<br> > > > > > approach to your problem would be to write a launcher script<br> > > that<br> > > > > would:<br> > > > > > 1) connect to the REST API<br> > > > > > 2) get the VM connection details<br> > > > > > 3) get new VM ticket<br> > > > > > 4) write this info down to a temporary .vv file [3]<br> > > > > > 5) launch remote-viewer<br> > > > > > <br> > > > > > Some info how to use REST API is described here [1] and .vv file<br> > > > > format<br> > > > > > is documented in virt-viewer sources [2]. Please note that [1]<br> > > is a<br> > > > > bit<br> > > > > > outdated:<br> > > > > > * you can use HTTP header "filter: true" to be able to log in as<br> > > > > non-admin<br> > > > > > * you only have to use password login once when you use<br> > > > > > "prefer: persistent-auth" HTTP header and you send the cookie<br> > > you<br> > > > > got<br> > > > > > in a response to first request.<br> > > > > > In the future, the steps 2-4 will become a one step of getting a<br> > > > > > ready-to-use .vv file from the API [3] but we aren't there yet.<br> > > > > > <br> > > > > > [1]<br> > > > ><br> > > <a class="moz-txt-link-freetext" href="http://www.ovirt.org/How_to_Connect_to_SPICE_Console_Without_Portal">http://www.ovirt.org/How_to_Connect_to_SPICE_Console_Without_Portal</a><br> > > > > > [2]<br> > > > ><br> > > <a class="moz-txt-link-freetext" href="https://git.fedorahosted.org/cgit/virt-viewer.git/tree/src/virt-viewer-file.c#n30">https://git.fedorahosted.org/cgit/virt-viewer.git/tree/src/virt-viewer-file.c#n30</a><br> > > > > > [3] <a class="moz-txt-link-freetext" href="https://bugzilla.redhat.com/show_bug.cgi?id=1128763">https://bugzilla.redhat.com/show_bug.cgi?id=1128763</a><br> > > > > > <br> > > > > > <br> > > > > > However, if you _really_ want to stick with static port<br> > > assignments,<br> > > > > do<br> > > > > > the following:<br> > > > > > 1) designate the port range so that it doesn't collide with<br> > > other<br> > > > > ranges<br> > > > > > in use (e.g. RHEV uses 5900-6023, so 5800-5899 could be safe)<br> > > > > > 2) add a custom VM properties to the engine for setting of port<br> > > and<br> > > > > > tls-port<br> > > > > > 3) add a vdsm hook to before_vm_start directory on each host<br> > > that<br> > > > > will<br> > > > > > add "port" and "tlsPort" parameters to the graphics element of<br> > > > > libvirt<br> > > > > > domain xml<br> > > > > > <br> > > > > > <br> > > > > > Best regards,<br> > > > > > <br> > > > > > David<br> > > > > > <br> > > > > > On St, 2014-09-17 at 10:41 +0800, PaulCheung wrote:<br> > > > > > > Dear all,<br> > > > > > > <br> > > > > > > <br> > > > > > > After shutdown the VM, then restart the VM the Vm's spice port<br> > > is<br> > > > > > > changed!<br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > Because I have 10 terminal ARM-Box running spice client<br> > > connected<br> > > > > to<br> > > > > > > the vm, but after the VM shutdown and start again, the vm not<br> > > the<br> > > > > one<br> > > > > > > whice the one before.<br> > > > > > > <br> > > > > > > <br> > > > > > > I wish you can let us have a option, to let the VM with a<br> > > fixed<br> > > > > spice<br> > > > > > > port, like:<br> > > > > > > vm1: spice port : 5900 tls:5901<br> > > > > > > vm2: 5902 5903<br> > > > > > > <br> > > > > > > <br> > > > > > > And I have another recommond: have a fuction to do that :<br> > > > > > > <br> > > > > > > <br> > > > > > > if the vm shutdown by user, it will start the VM automatic.<br> > > That<br> > > > > > > means the VM can not be shutdown!<br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > I hope you can have this two fuction! That means a lot to<br> > > those<br> > > > > who<br> > > > > > > are using Terminal box user like me.<br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > I am sorry for my poor English. But I hope you all can<br> > > understand<br> > > > > > > what I am saying.<br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > <br> > > > > > > Sincerely yours,<br> > > > > > > PaulCheung<br> > > > > > > <br> > > > > > > <br> > > > > > > tel: 180-8882-7173<br> > > > > > > <br> > > > > > > _______________________________________________<br> > > > > > > Users mailing list<br> > > > > > > <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a><br> > > > > > > <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a><br> > > > > > <br> > > > > > <br> > > > > <br> > > > > _______________________________________________<br> > > > > Users mailing list<br> > > > > <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a><br> > > > > <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a><br> > > > <br> > > > <br> > > <br> > > _______________________________________________<br> > > Users mailing list<br> > > <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a><br> > > <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a><br> > <br> > <br> </div> </div> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ Users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Users@ovirt.org">Users@ovirt.org</a> <a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/users">http://lists.ovirt.org/mailman/listinfo/users</a> </pre> </blockquote> <br> <br> <pre class="moz-signature" cols="72">-- Regards, Vinzenz Feenstra | Senior Software Engineer RedHat Engineering Virtualization R & D Phone: +420 532 294 625 IRC: vfeenstr or evilissimo Better technology. Faster innovation. Powered by community collaboration. See how it works at redhat.com</pre> </body> </html> --------------080508040005020804000700--