Exemplo n.º 1
0
    def _validate_name(self, name):
        util.validate_name(_("Network"), name)

        try:
            self.conn.networkLookupByName(name)
        except libvirt.libvirtError:
            return
        raise ValueError(_("Name '%s' already in use by another network." %
                         name))
Exemplo n.º 2
0
    def validate_name(conn, name, check_collision, validate=True):
        if validate:
            util.validate_name(_("Guest"), name)
        if not check_collision:
            return

        try:
            conn.lookupByName(name)
        except:
            return
        raise ValueError(_("Guest name '%s' is already in use.") % name)
Exemplo n.º 3
0
 def _validate_name(self, name):
     if name == self.name:
         return
     util.validate_name(_("Storage object"), name)
     self._check_name_collision(name)
     return name
Exemplo n.º 4
0
    def _set_name(self, val):
        util.validate_name(_("Interface name"), val)

        self._check_name_collision(val)
        self._name = val
Exemplo n.º 5
0
    def set_name(self, val):
        util.validate_name(_("Storage object"), val)

        # Check that name doesn't collide with other storage objects
        self._check_name_collision(val)
        self._name = val
Exemplo n.º 6
0
    def _set_name(self, val):
        util.validate_name(_("Interface name"), val)

        self._check_name_collision(val)
        self._name = val