~serge-hallyn/ubuntu/raring/libvirt/libvirt-hugepages

« back to all changes in this revision

Viewing changes to src/conf/netdev_vport_profile_conf.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-13 15:44:12 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20120513154412-fgmn5sxqdzgnzlx3
Tags: 0.9.12-0ubuntu1
* New upstream version:
  * Synchronize with debian packaging:
    - debian/control: Update build depends.
    - debian/libvirt-bin.postrm: Cleanup /var/log/libvirt
      on purge.
    - Bump standards verson (no changes).
    - debian/patches/Don-t-fail-if-we-can-t-setup-avahi.patch: Added
  * Dropped patches:
    - debian/patches/Debianize-libvirt-guests.patch
    - debian/patches/rewrite-lxc-controller-eof-handling-yet-again
    - debian/patches/ubuntu/libnl13.patch
    - debian/patches/ubuntu/fix-lxc-startup-error.patch
    - debian/patches/ubuntu/fix-bridge-fd.patch
    - debian/patches/ubuntu/skip-labelling-network-disks.patch
    - debian/patches/ubuntu/xen-xend-shutdown-detection.patch
    - debian/patches/ubuntu/xen-config-no-vfb-for-hvm.patch
    - debian/patches/debian/Disable-daemon-start-test.patch
    - debian/patches/debian/Disable-gnulib-s-test-nonplocking-pipe.sh.patch
    - debian/patches/ubuntu/9006-default-config-test-case.patch
    - debian/patches/fix-block-migration.patch
    - debian/patches/ubuntu/9022-qemu-unescape-HMP-commands-before-converting-them-to.patch
    - debian/patches/ubuntu/9023-qemu-change-rbd-auth_supported-separation-character-.patch
    - debian/patches/ubuntu/9024-qemu-allow-snapshotting-of-sheepdog-and-rbd-disks.patch
    - debian/patches/9025-qemu-change-rbd-auth_supported-separation-character-.patch
    - debian/patches/ubuntu/arm-gcc-workaround.patch
  * Rediffed:
    - debian/patches/Allow-libvirt-group-to-access-the-socket.patch
    - debian/patches/Disable-failing-virnetsockettest.patch
    - debian/patches/dnsmasq-as-priv-user
    - debian/patches/9002-better_default_uri_virsh.patch
  * debian/control: Add libnl-route-3-dev ass a build depends.
  * debian/patches/libnl3-build-fix.patch: Fix build with libnl3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
VIR_ENUM_IMPL(virNetDevVPort, VIR_NETDEV_VPORT_PROFILE_LAST,
36
36
              "none",
37
37
              "802.1Qbg",
38
 
              "802.1Qbh")
 
38
              "802.1Qbh",
 
39
              "openvswitch")
39
40
 
40
41
 
41
42
virNetDevVPortProfilePtr
47
48
    char *virtPortTypeIDVersion = NULL;
48
49
    char *virtPortInstanceID = NULL;
49
50
    char *virtPortProfileID = NULL;
 
51
    char *virtPortInterfaceID = NULL;
50
52
    virNetDevVPortProfilePtr virtPort = NULL;
51
53
    xmlNodePtr cur = node->children;
52
54
 
76
78
            virtPortTypeIDVersion = virXMLPropString(cur, "typeidversion");
77
79
            virtPortInstanceID = virXMLPropString(cur, "instanceid");
78
80
            virtPortProfileID = virXMLPropString(cur, "profileid");
79
 
 
 
81
            virtPortInterfaceID = virXMLPropString(cur, "interfaceid");
80
82
            break;
81
83
        }
82
84
 
171
173
            goto error;
172
174
        }
173
175
        break;
 
176
    case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
 
177
        if (virtPortInterfaceID != NULL) {
 
178
            if (virUUIDParse(virtPortInterfaceID,
 
179
                             virtPort->u.openvswitch.interfaceID)) {
 
180
                virNetDevError(VIR_ERR_XML_ERROR, "%s",
 
181
                               _("cannot parse interfaceid parameter as a uuid"));
 
182
                goto error;
 
183
            }
 
184
        } else {
 
185
            if (virUUIDGenerate(virtPort->u.openvswitch.interfaceID)) {
 
186
                virNetDevError(VIR_ERR_XML_ERROR, "%s",
 
187
                               _("cannot generate a random uuid for interfaceid"));
 
188
                goto error;
 
189
            }
 
190
        }
 
191
        /* profileid is not mandatory for Open vSwitch */
 
192
        if (virtPortProfileID != NULL) {
 
193
            if (virStrcpyStatic(virtPort->u.openvswitch.profileID,
 
194
                                virtPortProfileID) == NULL) {
 
195
                virNetDevError(VIR_ERR_XML_ERROR, "%s",
 
196
                               _("profileid parameter too long"));
 
197
                goto error;
 
198
            }
 
199
        } else {
 
200
            virtPort->u.openvswitch.profileID[0] = '\0';
 
201
        }
 
202
        break;
174
203
 
175
204
    default:
176
205
        virNetDevError(VIR_ERR_XML_ERROR,
225
254
                          virtPort->u.virtPort8021Qbh.profileID);
226
255
        break;
227
256
 
 
257
    case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
 
258
        virUUIDFormat(virtPort->u.openvswitch.interfaceID,
 
259
                      uuidstr);
 
260
        if (virtPort->u.openvswitch.profileID[0] == '\0') {
 
261
            virBufferAsprintf(buf, "  <parameters interfaceid='%s'/>\n",
 
262
                              uuidstr);
 
263
        } else {
 
264
            virBufferAsprintf(buf, "  <parameters interfaceid='%s' "
 
265
                              "profileid='%s'/>\n", uuidstr,
 
266
                              virtPort->u.openvswitch.profileID);
 
267
        }
 
268
 
 
269
        break;
 
270
 
228
271
    default:
229
272
        virNetDevError(VIR_ERR_XML_ERROR,
230
273
                       _("unexpected virtualport type %d"), virtPort->virtPortType);