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

[Xen-API] issue with passing mtu field in "network record" while creating network using Perl(RPC::XML) xen-api


  • To: "xen-api@xxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxx>
  • From: "Rawat, Vishwanath" <Vishwanath.Rawat@xxxxxxxxxx>
  • Date: Thu, 15 Nov 2012 11:29:06 +0000
  • Accept-language: en-US
  • Delivery-date: Thu, 15 Nov 2012 11:29:25 +0000
  • Importance: high
  • List-id: User and development list for XCP and XAPI <xen-api.lists.xen.org>
  • Thread-index: Ac3DCBjomqPtAlvaQay30QKoLC0eLg==
  • Thread-topic: issue with passing mtu field in "network record" while creating network using Perl(RPC::XML) xen-api

Hi,

                I was trying to create a new network on a Xen server using RPC::XML calls.

To create network, network_record need to be passed to RPC::XML::Client::simple_request. I didn’t want to manually create network record so I used a method call to get network_record and then used this record to create new network.

 

Here is the script which does the above

 

use Data::Dumper;

use RPC::XML;

use RPC::XML::Client;

use RPC::XML::Server;

my $xenhost = "xen_host";

my $user = "user";

my $passwd = "passwd";

my $xen = RPC::XML::Client->new("http://$xenhost:80");

print "Coming here\n";

my $s = $xen->simple_request("session.login_with_password",$user,$passwd);

if (! $s) {

    print "error is $@ \n";

}

 

my $session = extractvalue($xen->simple_request("session.login_with_password",

              $user,$passwd));

if (! $session){

    print "connection failure : $xenhost\n";

    exit;

}

 

$net_ref = extractvalue($xen->simple_request("network.get_by_uuid", $session, "086e19b2-fe6a-69ed-47df-4c91bd5c5a15"));

 

$rec_ref = extractvalue($xen->simple_request("network.get_record", $session, $net_ref));

 

$net = extractvalue($xen->simple_request("network.create", $session, $rec_ref));

 

This is the error I got

 

$VAR1 = {

         'ErrorDescription' => [

                                'FIELD_TYPE_ERROR',

                                'mTU'

                              ],

          'Status' => 'Failure'

        };

 

This is how network record looks like

 

$VAR1 = {

          'Value' => {

                     'other_config' => {

                                       'automatic' => 'false'

                                     },

                     'blobs' => {},

                     'uuid' => '086e19b2-fe6a-69ed-47df-4c91bd5c5a15',

                     'bridge' => 'xenbr0',

                     'tags' => [],

                     'MTU' => '1500',

                     'VIFs' => [

                               'OpaqueRef:ad959f71-550f-f901-323a-f79b81e763f5',

                               'OpaqueRef:7e30f00a-66ee-1cc7-e68f-de3bccab2bea',

                               'OpaqueRef:502ca96f-ccbf-780d-8978-8c76be41c838'

                             ],

                     'PIFs' => [

                               'OpaqueRef:d88b32e6-6005-631b-c843-3281a45db361',

                               'OpaqueRef:35a95e44-7839-4546-8b02-02132fbfe9ad'

                             ],

                     'name_label' => 'Pool-wide network associated with eth0',

                     'name_description' => '',

                     'allowed_operations' => [],

                     'current_operations' => {}

                   },

          'Status' => 'Success'

        };

 


So I changed MTU to mTU in network record. It worked fine.

 

$rec_ref->{mTU} = 1500;

delete($rec_ref->{MTU};

$net = extractvalue($xen->simple_request("network.create", $session, $rec_ref));

 

And this is the output

 

$VAR1 = {

          'Value' => 'OpaqueRef:a53e5a07-dcc8-b5d5-196d-5e894b44ea7a',

          'Status' => 'Success'

        };

 

So field accepted by "network.create" is ‘mTU’ and not ‘MTU’ which is I think wrong because field return by “network.get_record” is ‘MTU’.

 

Problem 2.

                I was trying to create a VIF the way I created network. This is the code that I used

 

$vif_ref = extractvalue($xen->simple_request("VIF.get_by_uuid", $session, "086e19b2-fe6a-69ed-47df-4c91bd5c5a15"));

 

$rec_ref = extractvalue($xen->simple_request("VIF.get_record", $session, $vif_ref));

 

$vif = extractvalue($xen->simple_request("VIF.create", $session, $rec_ref));

 

This is how VIF record looks like

 

$VAR1 = {

          'other_config' => {},

          'network' => 'OpaqueRef:c76e3a4d-ceb0-c66f-707d-a6fdd2e06839',

          'MAC_autogenerated' => 1,

          'VM' => 'OpaqueRef:76120c51-60d2-0ef6-dda6-99fb12d9ce27',

          'qos_algorithm_params' => {},

          'uuid' => '9e72c72e-6d23-b300-9a1d-a54e2d6a50ab',

          'qos_algorithm_type' => '',

          'metrics' => 'OpaqueRef:a343e74c-12b3-dd73-9f3e-ac0113fd17a3',

          'qos_supported_algorithms' => [],

          'status_code' => '0',

          'runtime_properties' => {},

          'mTU' => 1500,

          'MAC' => 'fe:13:d8:39:e5:6d',

          'device' => '',

          'MTU' => 1500,

          'currently_attached' => 1,

          'allowed_operations' => [

                                  'attach',

                                  'unplug'

                                ],

          'status_detail' => '',

          'current_operations' => {}

        };

 

When I ran above code this is the error I got

 

$VAR1 = {

          'ErrorDescription' => [

                                'FIELD_TYPE_ERROR',

                                'mTU'

                              ],

          'Status' => 'Failure'

        };

 

So I did the same thing that I did with “network.create”, but it didn’t work.

 

$VAR1 = {

          'ErrorDescription' => [

                                'INTERNAL_ERROR',

                                'Server_helpers.Dispatcher_FieldNotFound("MTU")'

                              ],

          'Status' => 'Failure'

        };

 

So I kept both mTU and MTU having the same value. Still didn’t work

 

$VAR1 = {

          'ErrorDescription' => [

                                'FIELD_TYPE_ERROR',

                                'mTU'

                              ],

          'Status' => 'Failure'

        };

 

It looks like xen-api issue to me. Can someone please help me with this.

 

Regards,

Rawat

 

_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

 


Rackspace

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