示例#1
0
    def on_merge(self, effective_changes):
        self.logger.debug("Saving remote storage page")
        changes = Changeset(self.pending_changes(False))
        effective_model = Changeset(self.model())
        effective_model.update(effective_changes)

        self.logger.debug("Changes: %s" % changes)
        self.logger.debug("Effective Model: %s" % effective_model)

        txs = utils.Transaction("Updating remote storage configuration")

        iscsi_keys = ["iscsi.initiator_name"]
        if changes.contains_any(iscsi_keys):
            model = defaults.iSCSI()
            args = effective_model.values_for(iscsi_keys)
            args += [None, None, None]  # No target config
            model.update(*args)
            txs += model.transaction()

        nfsv4_keys = ["nfsv4.domain"]
        if changes.contains_any(nfsv4_keys):
            model = defaults.NFSv4()
            args = effective_model.values_for(nfsv4_keys)
            model.update(*args)
            txs += model.transaction()

        progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
        progress_dialog.run()
示例#2
0
 def model(self):
     icfg = defaults.iSCSI().retrieve()
     ncfg = defaults.NFSv4().retrieve()
     model = {}
     model["iscsi.initiator_name"] = icfg["name"] or \
         storage.iSCSI().initiator_name()
     model["nfsv4.domain"] = ncfg["domain"]
     return model
 def commit(self):
     try:
         model = defaults.NFSv4()
         model.update(domain=OVIRT_VARS["OVIRT_NFSV4_DOMAIN"])
         tx = model.transaction()
         tx()
     except:
         logger.warning("Unknown NFSv4 domain: %s" % \
                        OVIRT_VARS["OVIRT_NFSV4_DOMAIN"])
 def model(self):
     icfg = defaults.iSCSI().retrieve()
     ncfg = defaults.NFSv4().retrieve()
     boot = defaults.SCSIDhAlua().retrieve()
     model = {}
     model["iscsi.initiator_name"] = icfg["name"] or \
         self.dry_or(lambda: storage.iSCSI().initiator_name())
     model["scsi.dh_alua"] = boot["enabled"] or False
     model["nfsv4.domain"] = ncfg["domain"]
     return model