[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] Creating VM using the Xen API


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: Rafał Borowiec <mezza9@xxxxx>
  • Date: Fri, 19 Jun 2009 15:25:32 +0200
  • Delivery-date: Fri, 19 Jun 2009 08:41:24 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=c1W3tFIOnMvPjSW36M4rXAAa2EdFZvo7jk9nAkp56E61sBBWdNXtN2qoefYdEvJez/ zfTE1OGTaOoSrDv4ck9+sZOtaiIv+hK/8qdKyJb3Af3kmKO+Eq+sf3jwNLSKbmXgMVLf IulJMWVmz7MgCMihVDCatpxI4dloQp3f7gzY4=
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

Dear All,

I spent some time trying to create new VM using the Xen API with a
Java API binding. I read all the posts related to that, and I could
not resolve the issue.

When I run the following code:

        VM.Record rec = new VM.Record();
        rec.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
        rec.actionsAfterReboot = Types.OnNormalExit.RESTART;
        rec.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
        rec.affinity = null;

        Set<Types.VmOperations> ops = new HashSet<Types.VmOperations>();
        ops.add(Types.VmOperations.DESTROY);
        ops.add(Types.VmOperations.PAUSE);
        ops.add(Types.VmOperations.RESUME);
        ops.add(Types.VmOperations.START);
        ops.add(Types.VmOperations.UNPAUSE);
        rec.allowedOperations = ops;
        
        rec.domid = new Long(-1);       
        rec.nameLabel = "my-vm-1";
        rec.isATemplate = false;
        rec.isControlDomain = false;
        rec.memoryDynamicMax = new Long(128 * 1024 * 1024);
        rec.memoryStaticMax = new Long(128 * 1024 * 1024);
        rec.PVKernel = "/boot/vmlinuz-2.6.26-2-xen-686";
        rec.PVRamdisk = "/boot/initrd.img-2.6.26-2-xen-686";
        rec.PVArgs = "clocksource=jiffies console=hvc0 xencons=tty";
        rec.VCPUsAtStartup = new Long(1);
        rec.VCPUsMax = new Long(1);

I get the error The server failed to handle your request, due to an
internal error.

Then I checked the xend.log file and what I see is: XendConfigError:
Invalid Configuration: Invalid event handling mode: shutdown

Below is the XML-RPC message generated by the API (formatting applied):

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
  <methodName>VM.create</methodName>
  <params>
    <param>
      <value>3a48b11a-b5de-1135-3d43-c40d80124108
      </value>
    </param>
    <param>
      <value>
        <struct>
          <member>
            <name>PV_bootloader_args</name>
            <value></value>
          </member>
          <member>
            <name>user_version</name>
            <value>0</value>
          </member>
          <member>
            <name>VIFs</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>memory_dynamic_min</name>
            <value>0</value>
          </member>
          <member>
            <name>xenstore_data</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>ha_always_run</name>
            <value>
              <boolean>0</boolean>
            </value>
          </member>
          <member>
            <name>actions_after_crash</name>
            <value>DESTROY</value>
          </member>
          <member>
            <name>PV_ramdisk</name>
            <value>/boot/initrd.img-2.6.26-2-xen-686
            </value>
          </member>
          <member>
            <name>allowed_operations</name>
            <value>
              <array>
                <data>
                  <value>RESUME</value>
                  <value>START</value>
                  <value>UNPAUSE</value>
                  <value>DESTROY</value>
                  <value>PAUSE</value>
                </data>
              </array>
            </value>
          </member>
          <member>
            <name>metrics</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>ha_restart_priority</name>
            <value></value>
          </member>
          <member>
            <name>PCI_bus</name>
            <value></value>
          </member>
          <member>
            <name>is_a_template</name>
            <value>
              <boolean>1</boolean>
            </value>
          </member>
          <member>
            <name>VCPUs_params</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>snapshot_time</name>
            <value>
              <dateTime.iso8601>19700101T01:00:00
              </dateTime.iso8601>
            </value>
          </member>
          <member>
            <name>platform</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>VTPMs</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>actions_after_shutdown</name>
            <value>DESTROY</value>
          </member>
          <member>
            <name>transportable_snapshot_id
            </name>
            <value></value>
          </member>
          <member>
            <name>resident_on</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>PV_legacy_args</name>
            <value></value>
          </member>
          <member>
            <name>consoles</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>memory_static_max</name>
            <value>134217728</value>
          </member>
          <member>
            <name>memory_dynamic_max</name>
            <value>134217728</value>
          </member>
          <member>
            <name>PV_kernel</name>
            <value>/boot/vmlinuz-2.6.26-2-xen-686
            </value>
          </member>
          <member>
            <name>name_label</name>
            <value>my-vm-1</value>
          </member>
          <member>
            <name>recommendations</name>
            <value></value>
          </member>
          <member>
            <name>uuid</name>
            <value></value>
          </member>
          <member>
            <name>current_operations</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>blobs</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>snapshot_of</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>memory_target</name>
            <value>0</value>
          </member>
          <member>
            <name>name_description</name>
            <value></value>
          </member>
          <member>
            <name>VBDs</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>other_config</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>is_a_snapshot</name>
            <value>
              <boolean>0</boolean>
            </value>
          </member>
          <member>
            <name>last_boot_CPU_flags</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>blocked_operations</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>actions_after_reboot</name>
            <value>RESTART</value>
          </member>
          <member>
            <name>VCPUs_at_startup</name>
            <value>1</value>
          </member>
          <member>
            <name>memory_static_min</name>
            <value>0</value>
          </member>
          <member>
            <name>HVM_shadow_multiplier</name>
            <value>
              <double>0.0</double>
            </value>
          </member>
          <member>
            <name>suspend_VDI</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>last_booted_record</name>
            <value></value>
          </member>
          <member>
            <name>domid</name>
            <value>-1</value>
          </member>
          <member>
            <name>snapshots</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>tags</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>guest_metrics</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>HVM_boot_policy</name>
            <value></value>
          </member>
          <member>
            <name>PV_args</name>
            <value>clocksource=jiffies console=hvc0
              xencons=tty</value>
          </member>
          <member>
            <name>power_state</name>
            <value>UNRECOGNIZED</value>
          </member>
          <member>
            <name>is_control_domain</name>
            <value>
              <boolean>0</boolean>
            </value>
          </member>
          <member>
            <name>VCPUs_max</name>
            <value>1</value>
          </member>
          <member>
            <name>crash_dumps</name>
            <value>
              <array>
                <data />
              </array>
            </value>
          </member>
          <member>
            <name>affinity</name>
            <value>OpaqueRef:NULL</value>
          </member>
          <member>
            <name>HVM_boot_params</name>
            <value>
              <struct />
            </value>
          </member>
          <member>
            <name>PV_bootloader</name>
            <value></value>
          </member>
          <member>
            <name>domarch</name>
            <value></value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>

And the XML-RPC response:

<?xml version='1.0'?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>Status</name>
            <value>
              <string>Failure</string>
            </value>
          </member>
          <member>
            <name>ErrorDescription</name>
            <value>
              <array>
                <data>
                  <value>
                    <string>INTERNAL_ERROR</string>
                  </value>
                  <value>
                    <string>Invalid Configuration: Invalid event
                      handling mode: shutdown</string>
                  </value>
                </data>
              </array>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>

Any ideas?

Regards,

Rafal.

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.