opennebula-5.2.1-vncautoportforce.diff
| opennebula-5.2.1-vncautoportforce/src/rm/RequestManagerVirtualMachine.cc 2017-04-23 09:32:58.972512837 -0500 | ||
|---|---|---|
| 695 | 695 | |
| 696 | 696 | /* -------------------------------------------------------------------------- */ | 
| 697 | 697 | |
| 698 | #if 0 | |
| 698 | 699 | int set_vnc_port(VirtualMachine *vm, int cluster_id, RequestAttributes& att) | 
| 699 | 700 | { | 
| 700 | 701 | ClusterPool * cpool = Nebula::instance().get_clpool(); | 
| ... | ... | |
| 719 | 720 | } | 
| 720 | 721 | else | 
| 721 | 722 |     { | 
| 722 |         rc = cpool->get_vnc_port(cluster_id, vm->get_oid(), port); | |
| 723 |         graphics->replace("PORT", "auto"); | |
| 723 | 724 | |
| 724 | if ( rc == 0 ) | |
| 725 |         { | |
| 726 |             graphics->replace("PORT", port); | |
| 727 | ||
| 728 | Nebula::instance().get_vmpool()->update(vm); | |
| 729 | } | |
| 730 | else | |
| 731 |         { | |
| 732 | att.resp_msg = "No free VNC ports available in the cluster"; | |
| 733 | } | |
| 725 | Nebula::instance().get_vmpool()->update(vm); | |
| 734 | 726 | } | 
| 735 | 727 | |
| 736 | 728 | return rc; | 
| 737 | 729 | } | 
| 730 | #else | |
| 731 | int set_vnc_port(VirtualMachine *vm, int cluster_id, RequestAttributes& att) | |
| 732 | { | |
| 733 | ClusterPool * cpool = Nebula::instance().get_clpool(); | |
| 734 | ||
| 735 |     VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS"); | |
| 736 | ||
| 737 | if (graphics == 0) | |
| 738 |     { | |
| 739 | return 0; | |
| 740 | } | |
| 741 | ||
| 742 |     graphics->replace("PORT", "auto"); | |
| 743 | ||
| 744 | Nebula::instance().get_vmpool()->update(vm); | |
| 745 | ||
| 746 | return 0; | |
| 747 | } | |
| 748 | #endif | |
| 738 | 749 | |
| 739 | 750 | /* -------------------------------------------------------------------------- */ | 
| 740 | 751 | /* -------------------------------------------------------------------------- */ |