Compiled against library: libvirt 0.10.2
Using library: libvirt 0.10.2
Using API: QEMU 0.10.2
Running hypervisor: QEMU 0.12.1

$ virsh dumpxml i-VM-XXXX
output:

<domain type='kvm' id='143'>
  <name>i-2-123-VM</name>
  <uuid>7555205e-c18d-48c7-bfdf-3a7461e637ee</uuid>
  <description>CentOS 5.5 (64-bit)</description>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>500</shares>
  </cputune>
  <os>
    <type arch='x86_64' machine='rhel6.6.0'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
<source file='/mnt/dfbbd8a2-2c79-3183-8149-25899d9b1191/27473b1d-c29e-44af-b5d1-0452c1104870'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='02:00:42:f4:00:14'/>
      <source bridge='breth0-537'/>
      <bandwidth>
        <inbound average='25600' peak='25600'/>
        <outbound average='25600' peak='25600'/>
      </bandwidth>
      <target dev='vnet13'/>
      <model type='virtio'/>
      <alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/6'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/6'>
      <source path='/dev/pts/6'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5905' autoport='yes' listen='x.x.x.x'>
      <listen type='address' address='x.x.x.x'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='none'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
</domain>

Here is the censored version of my CURL URL request:
http://serverip:8080/client/api?account=bob&apikey=MYAPIKEY...&command=deployVirtualMachine&details[0].cpuNumber=1&details[0].cpuSpeed=500&details[0].memory=512&details[0].networkrate=1&displayname=testing&displayvm=true&domainid=a7f31400-9c32-11e4-82e0-50e549354a3e&expires=2015-03-27T12%3A18%3A49-0400&hypervisor=KVM&name=testing&networkids=a2353a3b-073e-47d6-8090-3032432e3077&response=json&rootdisksize=50&serviceofferingid=4cb3c5a5-cc02-4450-a026-f538dc575b5e&signatureVersion=3&templateid=a84da8b6-9c32-11e4-82e0-50e549354a3e&zoneid=8c95e4d9-c49e-4275-8c35-2af258a27898&signature=SIGNATURE...

On 03/26/2015 04:43 PM, Wido den Hollander wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 03/26/2015 06:12 PM, bob wrote:
Hello, I am using a PHP API to cloudstack 4.4.2 - When I make the
call to deployVirtualMachine and attempt to pass the parm
details[0].networkrate = 1 it does not rate limit the network to
1MB. What am I doing wrong?

Can you check the XML definition of the guest on the hypervisor?

$ virsh dumpxml i-VM-XXXX

In the network section you should see a network throttle setting.

If not, it might be that your Qemu or libvirt is to old. I'm not sure
what versions you need.

It is using the default value from Global Settings:
vm.network.throttling.rate and ignores my VM compute service
offering rate. How do I force it to use the rate defined by my api
call to deployVirtualMachine?

Here is my PHP code: //... $displayVM = "true"; // an optional
field, whether to the display the vm to the end user or not.
$hypervisor = "KVM"; //the hypervisor on which to deploy the
virtual machine

$vars = array( // Required by API call: 'serviceofferingid' =>
CUSTOM_COMPUTE_OFFERING, 'templateid'=>$templateId,
'zoneid'=>ZONE_ID, // Optional but useful:
'details[0].networkrate'=>1, // Network Throttling of 1MB/s not
working here... //            'networkrate'=>1,
'account'=>$account, 'displayname'=>$displayName,
'displayvm'=>$displayVM, 'domainid'=>$domainid, //ROOT_DOMAIN_ID,
'hypervisor'=>$hypervisor, 'name'=>$name,
'networkids'=>NETWORK_ID, ); //
https://github.com/jasonhancock/cloudstack-api-extension //...
$deploy = $cloudstack->deployVirtualMachine($vars); // does curl
request...

Note: It will create the VM and runs fine with no errors
generated... However, when I download a 10 MB test file it will get
10MB/s download, and does not limit it to 1MB/s. Also, when I use
the cloudstack interface to look at the Instance Details, I do not
see any rate limit set.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJVFG93AAoJEAGbWC3bPspCc5UP/2/JDa7PHsDoaoOCYQlOPYaT
tlJBpRviHkWl/IB5Dup86nDF6GjNYrwbRA0+YKn2E8UwgJ+lAz13Vkqg3eCLH3OK
Na++WFMNePlR/MOYKRic0XuW+8YflKwKfxTs2OU96y5t3DqBuZzVpBKEKvxprTqv
5uhJZLnyoA1AZotg+oMAgD07SBtnFEIqlIxiP/K7UROPMnE0D8pUOVD4Z2Tdrh5p
Rc7yNHU9XbLJjxuf1fpZkTmA6Htt+Qb4r3K4aOztmt6n7I1ov91HQSUQaYH3jQnJ
t06apLb8Ip4w85HpfqupfVQAVF26swawi7ghuJ/BVvG+/EaY4nyyhoUPoM6Q42fW
YusLbfCWaOM8yB0Hr0TjGBPAXzuIKcI1j4KxX13WONBMTNqn34TYanxXDD2UhYZE
6W8sfB3+cF0N4HF1EBTKDAYRcVolqZWILuvYIx1VmFEuJfSljg+X47ULI/keiuWX
vcdagoS2eJCsVreym5S6lbd3jFjJibpcu+MUsT0Rb9M8hvdZ3b/x3+mHaXaAhErQ
4xOoZhbD+rbeBfD+WP6HOJRLvGsdPfSMJXxxdWz+xgIn4Odbc/eoV/zuVPGuHBSE
e5JqqLuXRzQPmktrP0uxMPgyqUH/hjyW+6g4F5A3/siixjziI2NfvfEzJ1qGDtFw
d3H56NFlcAPmD5/+Ldew
=ii1N
-----END PGP SIGNATURE-----


Reply via email to