Can't assign IP and resources using API


reading the documentation and testing the API, i can't assign IP address and assign resources such as disk size, CPU, RAM and network speed when calling 'create-system' while on the web panel i can do so.

this make it difficult to integrate with the billing system i currently use. for example i can't provision a virtual system in one API call.



Sure, this is possible. If you are creating a KVM instance, you can use the API parameters kvm-disksize , kvm-memory and kvm-cpu . For Xen, the parameters have xen at the start (and there is a xen-rate param for the network speed).

can i get the complete list of option for the 'create-system' API command? because it seems that not all options is listed on the documentation and --help parameter

i'm using xen. in what unit does the xen-disksize and xen-memory? is it KB or MB? also xen-cpu

thank you

You can get the complete list by running a shell command like :

cloudmin create-system --type xen --help

The memory and disk size limits are in MB, and the CPU is in percentage of a core.

when running the command you give i get an error:

cloudmin create-system --type xen --help

Unknown flag --help

Creates a new virtual system of some type.

cloudmin create-system --host name [--unix-host name] --type xen [--desc "system description"] --ssh-key keyid | --ssh-pass password | --no-ssh [--webmin | --webmin-pass password] [--novirt] [--image id] [--no-update] [--serial number --key number] | [--same-serial] | [--allocate-serial] [--no-check-serial] [--id number] [--disk-directory dir] [--background] [--owner name] Undefined subroutine &server_manager::type_kvm_list_models called at /usr/libexec/webmin/server-manager/ line 1382.

Argh, that's a bug .. it should show the list of Xen-specific options. This will be fixed in the next release.

The output should be :

cloudmin create-system --host name
                      [--unix-host name]
                       --type xen|kvm|citrix|vserver|zones|openvz|lxc|ec2|gce
                      [--desc "system description"]
                       --ssh-key keyid | --ssh-pass password | --no-ssh
                      [--webmin | --webmin-pass password]
                      [--image id]
                      [--serial number --key number] |
                      [--same-serial] | [--allocate-serial]
                      [--id number]
                      [--disk-directory dir]
                      [--owner name]
                      --xen-host host-system
                      --xen-location name
                      [--xen-ip address[,address]]
                      [--xen-cidr number[,number]]
                      [--xen-netmask mask,[mask]]
                      [--xen-gw address[,address|*]]
                      [--xen-bridge name[,name]]
                      [--xen-disksize megabytes]
                      [--xen-memory megabytes]
                      [--xen-cpu percent]
                      [--xen-swap megabytes]
                      [--xen-rate bits/second]
                      [--xen-ip6 ipv6-address,[ipv6-address]]
                      [--xen-netmask6 mask,[mask]]
                      [--xen-gw6 ipv6-address,[ipv6-address]]
                      [--xen-allocate-ip6 true|false]
                      [--xen-mac ethernet-address]
                      [--xen-uuid instance-uuid]
                      [--xen-vif interface-name]
                      [--xen-on-reboot destroy|restart|preserve|rename-restart]
                      [--xen-on-shutdown destroy|restart|preserve|rename-restart]
                      [--xen-on-crash destroy|restart|preserve|rename-restart]
                      [--xen-on-poweroff destroy|restart|preserve|rename-restart]
                      [--xen-manual manual-config-entries]
                      [--xen-lvm true|false]
                      [--xen-pygrub true|false]
                      [--xen-model rtl8139|ne2k_pci|ne2k_isa|e1000|pcnet]
                      [--xen-start true|false]
                      [--xen-iscsi hostname]

is it possible to create 2 disks for the virtual-system on separate LVM volume group at creation? so 1 disk for the root image and the second one for swap.

i tested modify-limits to change disk size and i get this error:

cloudmin modify-limits --disk 5120 --host --type xen Use of uninitialized value in split at /usr/libexec/webmin/acl/ line 47. Setting disk limit on Xen system to 5 GB .. .. not supported

PS: i change the disk larger

No, you can't create disks on two different VGs are creation time. However, you can add a disk later that is on a different VG from the default.

Regarding the modify-limits command, the --disk flag is only used for virtualization types like OpenVZ that have only a single disk limit. For Xen you need to resize a specific disk, which can be done with a command like :

cloudmin modify-disk --host --virt /dev/sda1 --new-size 5120

say i add the second disk on different VG after creation, can i then assign that disk as swap automatically?

Yes - using the API this could be done with the command :

cloudmin create-disk --host --auto-virt --auto-real --size 512 --format swap --mount swap --storage lvm_XXX

where XXX is the VG name.