PyvMomi create new virtual machine - python

I have a connection to a vsphere instance using pyvmomi. I can list virtual machines. However, I am looking for documentation about how to perform other tasks (e.g. copy a virtual machine, create a new virtual machine). Is there example code for tasks like this or API documentation that is relevant?

Have you taken a look at this github project? https://github.com/vmware/pyvmomi-community-samples
Lots of samples are provided here, if you are looking for something not already provided by the project please open an issue on github and maybe someone from the community will provide it for you.

Related

Hosting Jupyter Notebook Python App on a Webpage

I've made a simple python GUI application using ipywidgets, ipycanvas, and numpy. I made the program on Jupyter notebook as an ipynb file. I would now like to take my application and put it on a webpage. What is the best way to take this Jupyter notebook app and host it on the web?
I've looked a bit into Binder and Django, but I can't seem to find enough resources or documentation on the net to help me learn how to do this.
If you already have it working as a Jupyter notebook (.ipynb file), I'd suggest that sticking with that as the core item for now. I'd suggest getting running via MyBinder.org based on either this example repo or this one. Or a combination of the two.
This video is recent and a good reference for many of the steps of setting up a repo with your content.
You essentially make a copy of the Binder templates under your control and then edit them to have your content. You adapt the URLs that trigger launches so that when you share the link, they launch a session via MyBInder.org with your content. Most often the steps can be performed right in the Github browser-based interface without you needing to use git or work locally. If you have something fancier you need, you may have to move to using more complex configuration file set-ups and those may necessitate some use of git and local editing.
If you hit some technical road blocks, post your questions here using the 'questions' category as suggested in this post about 'Debugging your Binder'.
Maybe once the basics of sharing the notebook or appmode version are working with your own content, you may want to check out Voila or some of the other ways you can share a jupyter notebook-based app discussed here.
Jupyter itself is made with Tornado web framework.
There are many bindings to another popular web frameworks.
I once tried on it, and I found that pyramid-notebook is easy to use.
For a quick build I recommend Binder. This is how you can quickly set up Binder with voila:
Checkout this Git Repo: https://github.com/lschmiddey/book_recommender_voila
In combination with this blogpost: https://lschmiddey.github.io/fastpages_/2020/09/28/Build-binder-app-Part4.html

Create a Django patch which update several instances

I'm asking a question about my Django application updates.
I'm working on my Django Development server and I would like to know How I could create a patch which will update my different Django Project installed on different servers.
For example :
In my Dev' server, I add a new Query in my script. Then I would like to add this new Query to my all virtual instances by updating my script and not just copy/past modifications. It could work for one query, but if I have 200 rows, copy/paste will be too long.
I launch a patch which will make all updates without manually copy/paste rows.
How it's possible to do that ?
Thank you so much
You should probably consider migrating your project to a version control system.
Then every time you are changing something to your local copy of the code and push the changes on the repository, you can fetch/rebase/pull your changes wherever you want (be it your server or another computer of yours), and your patches will be applied without copy/pasting!
Some version control systems to consider:
Git Lab allowing the creation of free private repositories
Github the "old reliable", but no free private repositories
Bit Bucket (don't use it myself but it is widely used!)
Good luck :)

Simplest Way to Serve Jupyter Incubator Dashboards Locally

I've been exploring steps one and two from the Jupyter Incubator Dashboards project (more information here: https://github.com/jupyter-incubator/dashboards/wiki). Its simple to turn my notebooks into usable dashboards, which is just great.
My problem is that I'm unsure about step three, which is sharing/hosting the dashboards. I'm in an enterprise environment with a local server. I need to be able to share the dashboards on the local server and then have people access them over the web. Essentially, I need the "deploy as a local dashboard" option from step two (dashboards_bundlers). It seems that this functionality is now deprecated, however.
My question is this, is there a simple way to share dashboards locally here? I've been looking at the dashboards_server application, but it looks a little over my head right now. The functionality here looks powerful, but is probably more than what we need for the time being.
If this is the only option then I will proceed there, but I wanted to see if anyone has a simpler solution first.
As I see you have posted the similar question on the Github Issues section of Jupyter
You have received the answer too but is not satisfactory I guess. As the person have mentioned that there isn't any way right now for achieving what you are expecting.
But if you want that others should access the local copy of your system Jupyter Dashboard then it is better you make your system as server itself. Then you can grant access to the people for viewing your server/local machine. Others can be a child like systems for your local system.
Just like a Parent-child or Say Master-slave would allow others to have access to your Jupyter DashBoard Copy.
It might be a bit confusing but this is way you can achieve whaht you have mentioned in your question.
This might be a too simplistic answer. Our company uses Windows 7 enterprise. I have Jupyter Notebook running on a desktop which I access by running the command:
jupyter.exe notebook --ip=10.106.166.180 --no-browser
I just use the IP address of my host computer.
Then I just send people the ipynb url
example http://10.106.166.180:8888/notebooks/Notebooks/sample.ipynb
As long as you don't mind people tinkering, using or snooping around your notebooks. Also if the time comes, you can always restart the server then add a password so that people can't access it anymore.

looking for some script in PyVmomi

I need to write python scripts to get all of the IDs of Virtual Machines running on a ESX/ESXi host(including CPU ID, Hard ID, Chipset ID etc.).i need to find them and i want to change them all.i have to move a virtual machine from one ESXi host to another ESXi host but when i move it the license of virtual machine get lost, i did some researches and i find the license get lost because of changing hardware fingerprint during the movement process. Could anyone please help me to solve this problem??
Lots of pyvmomi examples can be found here, on VMWare's own GitHub. Also, if you open an issue on the project in GitHub and request something specific, others in the community may be willing to provide it.
Amir you can get examples here
https://github.com/rreubenur/vmware-python-examples
And losing the license is a common problem for windows VM. Though there is a hack for winxp/win2k3 but later versions doesn't support the hack. I believe you shouldn't face any problem with linux guest OS.

Easiest way to share work between backend and front end

Hey everyone,
I am expanding my team and I have recently added an additional front end engineer on my site. I am currently using django to run my site but my site is using a lot of plugins, namely: django-celery, django-mailer, django-notification, and django-socialregistration.
Let me describe my situation:
He is using Mac OS X, and I have no experience in installing stuff on mac os X or configuration on that platform
I believe that getting my backend to run on his computer might be somewhat troublesome, i.e. I have to install a bunch of plugins (which are not available on pip or easy_install as they are the latest version) and I have also made heavy modification to django-socialregistration which I am currently using by symlinking to the modified code in my repos in my python path
I tried to look into solutions like pip and easy_install but I have not been able to get them to install code from github
I think the easiest way is to get my backend working on his computer and then he just commiting to the repos. Any ideas how I can make this easy?
Another, free option, is to use VirtualBox. I would recommend installing the same OS on it as your production server. Then, he's developing in the same environment as the live site, and can just check into the repo the same as you. Hey, you may want to do the same on your end--then both of your environments are the same and also the same as the live site.
Get him to set up a virtual machine on his Mac, using VMWare Fusion or Parallels, running the same operating system that you currently use for your back end. If he prefers developing using Mac tools he can do still that by sharing his local changes to the virtual machine via a shared directory.
An alternative, if that's possible, would be to set up a testing/development environment on a machine with an OS you're familiar with, then install something like Dropbox on his local machine where he can develop the frontend code, and install Dropbox on that other environment with the backend components. Dropbox would sync his local changes to that testing environment for him to run the code on.
That way, he would be able to use that environment to test his code, you wouldn't need to set up a backend on his machine (or keep it up to date) and you'd still be getting the same functionality.
Again, if that's an option.

Categories