Archive for November, 2010

Open Source VMware PHP API experiment

I think this post is not useful anymore, now that VMware release their first PHP API for vCloud, anyway I’ve this little code I wrote as an experiment a few months ago that maybe could be used by someone having an old vCloud (the code you’ll see is wrote to work with VMware’s vCloud 2.5) or maybe who needs a simpler implementation.

I only wrote a few methods:

  • login to the VMware server
  • get info about all VMs
  • get info about a single VM
  • create a new VM setting the RAM amount, CPUs number, disk capacity
  • a useful methods that waits till a task (like a VM creation) is completed

The code you’ll download uses the old nusoap library and directly sends the raw XML to the server ’cause no other SOAP libraries/implementations were working at that time and for the time the experiment lived (I never used vCloud systems and I worked on this project less than a couple of days so…).

Here you have a set of sample calls to the library:

require “vim25.php”;
$vim25 = new vim25(“ip-address-of-the-vcloud-server”, “username”, “password”);

$service_content = $vim25->retrieveServiceContent();
$all_vm_info = $vim25->getAllVMInfo($service_content["rootFolder"], VIM25_SUB_INFO_ALL);
$vm_info = $vim25->getVMInfo(“vm-16″, VIM25_SUB_INFO_GUEST);

$debug = $vim25->createVM(
“vm name”,
“group-id”,
“guest-id”,
“resgroup-id”,
“host-id”,
2, // num CPU
512, // RAM
10485760 // disk capacity in kB (10GB)
);

print_r($debug);

If you want to give a try to the code:

  • download the library code
  • rename to vim25.php
  • download and install nusoap in the “nusoap” folder (at the same level of the vim25.php file)
  • use the code above to script the vim25 class
  • extend it and use it :-)

This work is public domain thus do whatever you want with it and enjoy.

Share/bookmark:
Digg StumbleUpon Facebook Reddit Mixx del.icio.us Google Live NewsVine

UCK 2.4.0 is out!

It was a long awaited release, and we’ve a huge changelog too! The most visible thing we worked on is the complete maverick support but there are a lot of changes under the hood to give a better user experience to every user.

Our great developer Wolf introduced an experimental feature (disabled by default) to use unionfs mounts instead of extracting the full ISO/squashfs, it’s a great new approach and really speeds up the first phases of a remastering operation (the squashfs/iso packing is still the same and can’t be optimized anymore). The point is that we DO NOT suggest to use this feature because it relies on some experimental versions of unionfs that are still a bit buggy and not completely released at the moment.

We also implemented a few methods to allow the installation of particular software in the remaster ISO, like MySQL and deamons requiring the deamon itself to start right after the installation.

Here you’ve the complete changelog

* GUI:
* GUI now uses kdialog, zenity, dialog or builtin (in that order) if
available. (#577197)
* Updated uck-gui to accept parameters for loopback/unionfs mounting
and added the possibility to specify a directory different from ~/tmp
for remaster-dir. Change is backward compatible to uck-2.2.0.
(Question/Answer 110374)
* Backend:
* Sequence of actions in uck-remaster changed so that initrd is
unpacked/customized/packed after the changes to the root file system
and the ISO have been done. This avoids problems when customize_iso
installs a new Live-CD kernel and initrd (which would previously be
overwritten by the contents of the old initrd, causing a mismatch
between the kernel (new) and the initrd (old)).
* Extended remaster-live-cd.sh by two procedures to perform
loopback+union mounts. (#72727)
* Added a -m option to uck-gui, uck-remaster, uck-remaster-unpack-iso
and uck-remaster-unpack-rootfs that uses a combination of loopback
and unionfs mounts instead of copying. This is an experimental
feature as of now and not activated by default. It also depends on
the packages fuse-utils and unionfs-fuse or aufs-tools, which are not
(yet?) pre-requisites for UCK. Documentation for these commands
updated accordingly. (#72727)
At least unionfs-fuse 0.25~hg.20100315-1 is required (Currently
only available from https://launchpad.net/~aakef/+archive/ppa )!
Thanks to Bernd Schubert for the superb support in fixing the
problems encountered.
* Added two new commands (uck-remaster-mount and uck-remaster-umount)
and documentation. These commands are used to do the loopback/
unionfs mounts/umounts required by the -m option described above.
(#72727)
* Added code to library for union_umount to kill processes still using
files in the mount. This happens when updates start daemons in the
root fs.
* Updated all manual pages to reference the source / bug reporting URLs.
* initctl is disabled (replaced with /bin/true) during chroot sessions.
With this change is now possible to install mysql/apache and other
services in the guest system.
* update-grub is disabled (replaced with /bin/true) during chroot sessions.
With this change is now possible to upgrade kernel in maverick too.
* host’s fstab/mtab are copied to the guest so that chrooted “df” can work.
* Backend now checks for kpackagekit as packaging tool, too.
Note: This requires that packagekit ist installed on the hosting
system – otherwise the dbus queries to packagekitd will fail.
FIXME: Running packagekitd on the host will give wrong results!!!
–> We need to change the strategy here! Upstart has similar issues
–> need to start “private” dbus system bus instance?!?
* Added error checking for arguments to uck-remaster-mount.
* improved error checking and handling for union mounts: either all or
nothing now; imply -m if tell-tale directory (-cache) is found;
made reentrant for use by uck-flow; pointless check for
uck-remaster-mount removed; fallback to copy if union mount not
possible; do not remove target when using mounts.
* uck-remaster-remove-win32-files now removes usb-creator.exe which
was added in maverick
* Fixed immediate umount in uck-remaster-unpack-{iso,rootfs} by trap
EXIT handling when using -m.
* unmount strategy (after chroot) was rewritten to unmount every mountpoint
found inside remaster-root.
* Package:
* gfxboot-dev dep added for maverick
* Internal:
* New target updman in Makefile to update manual page version numbers.
* Updated localbuild.sh procedure to patch the debian/changelog file
so that a local unsigned test version can be generated correctly.

Download UCK 2.4.0 or use our new PPA.

Share/bookmark:
Digg StumbleUpon Facebook Reddit Mixx del.icio.us Google Live NewsVine

P4A 3.8.0 is out!

It took me a couple of month to work on this release, we’ve a pretty long changelog you’ve to be sure to check out because we’ve a lot of important changes that may impact your upgrades.

One of the most important things is that now P4A supports MS SQL, it was quite easy but surely we need a stronger user base to test out every possible scenario. The next big thing is that MySQL connections are now UTF-8 safe, it could hurt your existing applications so please check out the notes in the changelog before upgrating.

- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- P4A_DB’s connection charset is now set to UTF 8
This could lead to possible data corruption, if you’re upgrading from a
previous release and you’re using MySQL or PostgreSQL (Oracle and SQLite
should not be involved in this change) you’ve to be sure to convert the DB
charset to UTF-8 before editing data in your P4A applications.

ALWAYS DO BACKUPS BEFORE ANYTHING ELSE!!!

For MySQL we used this procedure to migrate our DBs:
mysqldump –default-character-set=latin1 DBNAME > dump.sql
open dump.sql and replace this line
/*!40101 SET NAMES latin1 */;
with
/*!40101 SET NAMES utf8 */;
mysql NEWDBNAME < dump.sql
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- Support For MS SQL was added, check out the README file
- AJAX STACK REVERTED TO XML (instead of JSON) due to the bugs with jQuery::form
- README file was updated
- CKEditor was updated to 3.4.1
- a new strategy to avoid CKEDITOR loading problems was implemented
- P4A_Data_Fields::getSchemaTableField now correctly handles calculated fields
- a bug with P4A_I18N::format and time fields was fixed
- P4A::__construct() now has a "cache" param, simply pass a Zend_Cache object
to override all Zend_Cache configurations inside P4A
- P4A::getCache() method was added
- P4A_I18N now uses P4A::getCache() to pass an overridden Zend_Cache object to
Zend_Locale_Data
- a bug with "onreturnpress" and IE was fixed
- a bug with multicple CKEditor instances (loaded via AJAX call) and IE
was solved
- CKEditor's forcePasteAsPlainText option was enabled again
- jQuery::form was updated to 2.49
- jQuery was updated to 1.4.3
- file upload percentage and speed is shown while uploading
(if PECL uploadprogress is available, APC not implemented beacuse it does
not work with PHP CGI)
- a bug with autocomplete and HTML tags (in the value) was fixed
- a bug with autocomplete loading was fixed (thank to Lorenzo Valori)
- a bug with CKEDITOR and AJAX was fixed

Download P4A 3.8.0

Share/bookmark:
Digg StumbleUpon Facebook Reddit Mixx del.icio.us Google Live NewsVine