Change in vdsm[master]: supervdsm: log actual error in ProxyCaller
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: supervdsm: log actual error in ProxyCaller
......................................................................
supervdsm: log actual error in ProxyCaller
Change-Id: Id8a1c83d2a963002d3c793398bb62679b77f5f47
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/supervdsm.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/35475/1
diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index d6b0209..46247f2 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -37,6 +37,7 @@
class ProxyCaller(object):
+ log = logging.getLogger("supervdsm.ProxyCaller")
def __init__(self, supervdsmProxy, funcName):
self._funcName = funcName
@@ -50,6 +51,7 @@
return callMethod()
except RemoteError:
self._supervdsmProxy._connect()
+ self.log.exception("Could not call method")
raise RuntimeError(
"Broken communication with supervdsm. Failed call to %s"
% self._funcName)
--
To view, visit http://gerrit.ovirt.org/35475
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8a1c83d2a963002d3c793398bb62679b77f5f47
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: [WIP]Java Bindings: Proton support in Java Bindings
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP]Java Bindings: Proton support in Java Bindings
......................................................................
[WIP]Java Bindings: Proton support in Java Bindings
Change-Id: I94c52e118cb63d7df84b89a9b93da7b9e477be91
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
A client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonAuthenticator.java
A client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonClient.java
A client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonListener.java
A client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonReactor.java
A client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/AmqpReactorTestHelper.java
A client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/TestJsonRpcClientAMQP.java
6 files changed, 844 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/15428/1
diff --git a/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonAuthenticator.java b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonAuthenticator.java
new file mode 100644
index 0000000..35c9099
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonAuthenticator.java
@@ -0,0 +1,98 @@
+package org.ovirt.vdsm.reactors;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.qpid.proton.driver.Connector;
+import org.apache.qpid.proton.engine.Sasl;
+import org.apache.qpid.proton.engine.Sasl.SaslOutcome;
+import org.apache.qpid.proton.engine.Sasl.SaslState;
+import org.ovirt.vdsm.reactors.ProtonAuthenticator.AuthenticatorType;
+
+public final class ProtonAuthenticator {
+
+ public enum AuthenticatorType {
+
+ SERVER, CLIENT
+ }
+
+ public enum ConnectionState {
+
+ AUTHENTICATING, CONNECTED, FAILED
+ }
+ private ConnectionState _state;
+ final private AuthenticatorType _authType;
+ final private Connector<?> _connector;
+
+ public ProtonAuthenticator(Connector<?> connector,
+ AuthenticatorType authType) {
+ _authType = authType;
+ setState(ConnectionState.AUTHENTICATING);
+ _connector = connector;
+ final Sasl sasl = _connector.sasl();
+ if (authType == AuthenticatorType.CLIENT) {
+ sasl.setMechanisms(new String[]{"ANONYMOUS"});
+ sasl.client();
+ }
+ }
+
+ private void setState(ConnectionState state) {
+ _state = state;
+ }
+
+ public ConnectionState getState() {
+ return _state;
+ }
+
+ public void authenticate() {
+ final Sasl sasl = _connector.sasl();
+
+ while (true) {
+ try {
+ this._connector.process();
+ } catch (IOException ex) {
+ return;
+ }
+ final SaslState state = sasl.getState();
+ switch (state) {
+ case PN_SASL_CONF:
+ if (_authType == AuthenticatorType.SERVER) {
+ sasl.setMechanisms(new String[]{"ANONYMOUS"});
+ sasl.server();
+ }
+ break;
+ case PN_SASL_STEP:
+ if (_authType == AuthenticatorType.SERVER) {
+ final String[] mechs = sasl.getRemoteMechanisms();
+ if (mechs.length < 1) {
+ sasl.done(SaslOutcome.PN_SASL_AUTH);
+ break;
+ }
+
+ final String mech = mechs[0];
+ if (mech.equals("ANONYMOUS")) {
+ sasl.done(SaslOutcome.PN_SASL_OK);
+ } else {
+ sasl.done(SaslOutcome.PN_SASL_AUTH);
+ }
+ }
+ return;
+ case PN_SASL_PASS:
+ this.setState(ConnectionState.CONNECTED);
+ return;
+ case PN_SASL_FAIL:
+ this.setState(ConnectionState.FAILED);
+ return;
+ case PN_SASL_IDLE:
+
+ break;
+ default:
+ return;
+ }
+ }
+ }
+
+ public AuthenticatorType getAuthType() {
+ return _authType;
+ }
+}
diff --git a/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonClient.java b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonClient.java
new file mode 100644
index 0000000..4baffbf
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonClient.java
@@ -0,0 +1,224 @@
+package org.ovirt.vdsm.reactors;
+
+import java.nio.ByteBuffer;
+import java.util.Calendar;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.Future;
+
+import javax.swing.event.EventListenerList;
+
+import org.apache.qpid.proton.amqp.Binary;
+import org.apache.qpid.proton.amqp.messaging.Data;
+import org.apache.qpid.proton.amqp.messaging.Section;
+import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Receiver;
+import org.apache.qpid.proton.engine.Sender;
+import org.apache.qpid.proton.engine.Session;
+import org.apache.qpid.proton.message.Message;
+import org.apache.qpid.proton.message.MessageFactory;
+import org.apache.qpid.proton.message.impl.MessageFactoryImpl;
+
+public final class ProtonClient implements ReactorClient {
+ private final ProtonReactor _reactor;
+ final private Session _ssn;
+
+ private Sender _sender;
+ private Receiver _receiver;
+
+ private final int _CREDIT = 10;
+ private final ConcurrentLinkedQueue<ByteBuffer> _outbox;
+ private final EventListenerList _eventListeners;
+ private final int _deliveryTimeoutSec;
+ private final MessageFactory _msgFactory;
+
+ public ProtonClient(ProtonReactor reactor, Session session) {
+ _ssn = session;
+ _sender = null;
+ _receiver = null;
+ _outbox = new ConcurrentLinkedQueue<>();
+ _eventListeners = new EventListenerList();
+ _deliveryTimeoutSec = 60 * 3;
+ _reactor = reactor;
+ _msgFactory = new MessageFactoryImpl();
+ }
+
+ @Override
+ public void addEventListener(EventListener el) {
+ synchronized (_eventListeners) {
+ _eventListeners.add(EventListener.class, el);
+ }
+ }
+
+ @Override
+ public void removeEventListener(EventListener el) {
+ synchronized (_eventListeners) {
+ _eventListeners.remove(EventListener.class, el);
+ }
+ }
+
+ private void emitOnMessageReceived(ByteBuffer message) {
+ synchronized (_eventListeners) {
+ final Class<EventListener> cls = EventListener.class;
+ final EventListener[] els = _eventListeners.getListeners(cls);
+ for (EventListener el : els) {
+ el.onMessageReceived(this, message);
+ }
+ }
+ }
+
+ @Override
+ public void sendMessage(ByteBuffer message) {
+ _outbox.add(message);
+ _reactor.wakeup();
+ }
+
+ public void addLink(Link link) {
+ assert (link.getSession().equals(_ssn));
+
+ if (link instanceof Sender) {
+ if (_sender != null) {
+ // already have a sender
+ link.close();
+ return;
+ }
+
+ _sender = (Sender) link;
+ } else {
+ assert (link instanceof Receiver);
+ if (_receiver != null) {
+ // already have a receiver
+ link.close();
+ return;
+ }
+
+ _receiver = (Receiver) link;
+ _receiver.flow(_CREDIT);
+ }
+ link.open();
+ }
+
+ private Message _popOutgoingMessage() {
+ final ByteBuffer data = _outbox.poll();
+ if (data == null) {
+ return null;
+ }
+
+ final Section body = new Data(Binary.create(data));
+ final Message msg = _msgFactory.createMessage();
+ msg.setBody(body);
+ msg.setAddress(_sender.getTarget().toString());
+ return msg;
+ }
+
+ public void queueDeliveries() {
+ if (_sender == null) {
+ final String uuid = UUID.randomUUID().toString();
+ _sender = _ssn.sender("Sender-" + uuid);
+ }
+
+ while (_sender.getCredit() > 0) {
+ final Message m = _popOutgoingMessage();
+ if (m == null) {
+ return;
+ }
+
+ final String uuid = UUID.randomUUID().toString();
+ final Delivery d = _sender
+ .delivery(("outgoing-" + uuid).getBytes());
+ d.setContext(m);
+ }
+ }
+
+ public void processDelivery(Delivery delivery) {
+ assert (_ssn.equals(delivery.getLink().getSession()));
+
+ if (delivery.isReadable()) {
+ _processIncomingDelivery(delivery);
+ } else {
+ assert (delivery.isWritable());
+ _processOutgoingDelivery(delivery);
+ }
+ }
+
+ private void _processOutgoingDelivery(Delivery delivery) {
+ final Sender link = (Sender) delivery.getLink();
+ assert (link.equals(_sender));
+
+ final Message msg = (Message) delivery.getContext();
+ // TBD: Buffer can be reused forever. Change in case of
+ // performance issues.
+ ByteBuffer buff;
+ int i = 1;
+ int written = 0;
+ do {
+ buff = ByteBuffer.allocate(i * 4096);
+ written = msg.encode(buff.array(), 0, buff.capacity());
+ i++;
+ } while (written == buff.capacity());
+
+ link.send(buff.array(), 0, written);
+ if (link.advance()) {
+ // Attach timeout to the delivery
+ final Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.SECOND, _deliveryTimeoutSec);
+ delivery.setContext(calendar);
+ }
+ }
+
+ private void _processIncomingDelivery(Delivery delivery) {
+ int total = 0;
+ int read = 0;
+ ByteBuffer buff = ByteBuffer.allocate(4096);
+
+ while (read >= 0) {
+ total += read;
+ if (total >= buff.capacity()) {
+ final ByteBuffer buff2 = ByteBuffer
+ .allocate(buff.capacity() * 2);
+ buff2.put(buff);
+ buff = buff2;
+ }
+ read = _receiver.recv(buff.array(), total, buff.capacity() - total);
+ }
+
+ final Message msg = _msgFactory.createMessage();
+ msg.decode(buff.array(), 0, total);
+
+ assert (msg.getBody() instanceof Data);
+ final Data body = (Data) msg.getBody();
+ final ByteBuffer bb = body.getValue().asByteBuffer();
+ delivery.settle();
+ emitOnMessageReceived(bb);
+ }
+
+ @Override
+ public Future<Void> close() {
+ final Session ssn = _ssn;
+ return _reactor.queueOperation(new Callable<Void>() {
+ @Override
+ public Void call() {
+ ssn.close();
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public boolean closed() {
+ return _ssn.getLocalState().equals(EndpointState.CLOSED);
+ }
+
+ public void removeLink(Link link) {
+ if (link.equals(_sender)) {
+ _sender = null;
+ } else {
+ assert (link.equals(_receiver));
+ _receiver = null;
+ }
+ link.close();
+ }
+}
diff --git a/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonListener.java b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonListener.java
new file mode 100644
index 0000000..35896f4
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonListener.java
@@ -0,0 +1,42 @@
+package org.ovirt.vdsm.reactors;
+
+import java.io.IOException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+
+import org.apache.qpid.proton.driver.Listener;
+
+public final class ProtonListener implements ReactorListener {
+ private final EventListener _eventListener;
+ private Listener<ProtonListener> _listener;
+ private final ProtonReactor _reactor;
+
+ public ProtonListener(ProtonReactor reactor, EventListener eventListener) {
+ _eventListener = eventListener;
+ _reactor = reactor;
+ }
+
+ public void setListener(Listener<ProtonListener> l) {
+ _listener = l;
+ }
+
+ public void accept(ReactorClient client) {
+ _eventListener.onAcccept(this, client);
+ }
+
+ @Override
+ public Future<Void> close() {
+ final Listener<ProtonListener> l = _listener;
+ return _reactor.queueOperation(new Callable<Void>() {
+ @Override
+ public Void call() {
+ try {
+ l.close();
+ } catch (IOException e) {
+ // already closed
+ }
+ return null;
+ }
+ });
+ }
+}
diff --git a/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonReactor.java b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonReactor.java
new file mode 100644
index 0000000..b5a38b4
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/main/java/org/ovirt/vdsm/reactors/ProtonReactor.java
@@ -0,0 +1,452 @@
+package org.ovirt.vdsm.reactors;
+
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
+import org.apache.qpid.proton.driver.Connector;
+import org.apache.qpid.proton.driver.Driver;
+import org.apache.qpid.proton.driver.Listener;
+import org.apache.qpid.proton.driver.impl.DriverFactoryImpl;
+import org.apache.qpid.proton.engine.Connection;
+import org.apache.qpid.proton.engine.Delivery;
+import org.apache.qpid.proton.engine.EndpointState;
+import org.apache.qpid.proton.engine.EngineFactory;
+import org.apache.qpid.proton.engine.Link;
+import org.apache.qpid.proton.engine.Receiver;
+import org.apache.qpid.proton.engine.Session;
+import org.apache.qpid.proton.engine.impl.EngineFactoryImpl;
+import org.ovirt.vdsm.reactors.ProtonAuthenticator.AuthenticatorType;
+import org.ovirt.vdsm.reactors.ProtonAuthenticator.ConnectionState;
+import org.ovirt.vdsm.util.ChainedOperation;
+import org.ovirt.vdsm.util.ReactorScheduler;
+
+public final class ProtonReactor implements Reactor {
+
+ private final Driver _driver;
+ private final ReactorScheduler _scheduler;
+ private boolean _isRunning;
+ final Object _syncRoot = new Object();
+ final ProtonReactor reactor = this;
+ private EngineFactory _engineFactory;
+
+ public boolean isRunning() {
+ return _isRunning;
+ }
+
+ public ProtonReactor() throws IOException {
+ _engineFactory = new EngineFactoryImpl();
+ _driver = new DriverFactoryImpl().createDriver();
+ _isRunning = false;
+ _scheduler = new ReactorScheduler();
+ }
+
+ @Override
+ public void finalize() throws Throwable {
+ try {
+ _driver.destroy();
+ } finally {
+ super.finalize();
+ }
+ }
+
+ // Creates a listener, returns null if failed to bind or reactor is not
+ // running;
+ @Override
+ public Future<ReactorListener> createListener(final String host,
+ final int port,
+ final ReactorListener.EventListener eventListener) {
+
+ return queueOperation(new Callable<ReactorListener>() {
+ @Override
+ public ProtonListener call() {
+
+ final ProtonListener listener = new ProtonListener(reactor, eventListener);
+ final Listener<ProtonListener> l = _driver.createListener(host,
+ port, listener);
+
+ listener.setListener(l);
+
+ if (l == null) {
+ return null;
+ }
+
+ return listener;
+ }
+ });
+ }
+
+ @Override
+ public Future<ReactorClient> createClient(final String host, final int port) {
+ final Driver driver = _driver;
+ final EngineFactory engineFactory = _engineFactory;
+
+ return queueOperation(new ChainedOperation.Operation<ReactorClient>() {
+ final private int _INIT = 1;
+ final private int _AUTHENTICATE = 2;
+ final private int _DONE = 3;
+ private int _state;
+ final private Driver _driver;
+ final private ProtonReactor _reactor;
+ private Connector<ProtonAuthenticator> _connector;
+ private ProtonAuthenticator _auth;
+ private boolean _done;
+ private boolean _cancelled;
+ private ReactorClient _result;
+ private EngineFactory _engineFactory;
+
+ {
+ _driver = driver;
+ _reactor = reactor;
+ _state = _INIT;
+ _done = false;
+ _cancelled = false;
+ _engineFactory = engineFactory;
+ }
+
+ @Override
+ public void call(final boolean cancelled) {
+ switch (_state) {
+ case _INIT:
+ if (cancelled) {
+ _cancelled = true;
+ _done = true;
+ return;
+ }
+
+ _connector = this._driver.createConnector(host, port, null);
+
+ final Connection connection = engineFactory.createConnection();
+ _connector.setConnection(connection);
+ _auth = new ProtonAuthenticator(_connector,
+ AuthenticatorType.CLIENT);
+ _connector.setContext(_auth);
+ connection.open();
+ _state = _AUTHENTICATE;
+ case _AUTHENTICATE:
+ if (cancelled) {
+ _cancelled = true;
+ _close();
+ return;
+ }
+
+ switch (_auth.getState()) {
+ case AUTHENTICATING:
+ _auth.authenticate();
+ try {
+ _connector.process();
+ } catch (IOException e) {
+ // ignore
+ }
+ return;
+ case FAILED:
+ _close();
+ return;
+ case CONNECTED:
+ // Success !
+ break;
+ }
+
+ Session ssn = _connector.getConnection().session();
+ ssn.open();
+ _result = new ProtonClient(_reactor, ssn);
+ ssn.setContext(_result);
+ _done = true;
+ _state = _DONE;
+ }
+ }
+
+ private void _close() {
+ _connector.getConnection().close();
+ _connector.close();
+ _done = true;
+ _result = null;
+ }
+
+ @Override
+ public boolean isDone() {
+ return _done;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return _cancelled;
+ }
+
+ @Override
+ public ReactorClient getResult() {
+ return _result;
+ }
+ });
+ }
+
+ // Queues operation to be run in the serving loop.
+ public <T> Future<T> queueOperation(Callable<T> cb) {
+ final FutureTask<T> task = new FutureTask<>(cb);
+ _queueFuture(task);
+ return task;
+ }
+
+ public <T> Future<T> queueOperation(ChainedOperation.Operation<T> op) {
+ final ChainedOperation<T> task = new ChainedOperation<>(op);
+ _queueFuture(task);
+ return task;
+ }
+
+ private void _queueFuture(Future<?> op) {
+ synchronized (_scheduler) {
+ _scheduler.queueFuture(op);
+ wakeup();
+ }
+ }
+
+ private void _waitEvents() {
+ _driver.doWait(0);
+ }
+
+ public void wakeup() {
+ _driver.wakeup();
+ }
+
+ @Override
+ public void serve() {
+ synchronized (_syncRoot) {
+ _isRunning = true;
+ }
+
+ while (_isRunning) {
+ //_waitEvents();
+ synchronized (_scheduler) {
+ _scheduler.performPendingOperations();
+ }
+ _acceptConnectionRequests();
+ _processConnectors();
+ }
+ }
+
+ private void _processConnectors() {
+ for (Connector<?> connector = _driver.connector(); connector != null; connector = _driver
+ .connector()) {
+ if (connector.isClosed()) {
+ connector.destroy();
+ continue;
+ }
+
+ try {
+ connector.process();
+ } catch (IOException e) {
+ continue;
+ }
+
+ final Object ctx = connector.getContext();
+ assert (ctx instanceof ProtonAuthenticator);
+
+ if (ctx instanceof ProtonAuthenticator) {
+ final ProtonAuthenticator auth = (ProtonAuthenticator) ctx;
+ ConnectionState cs = auth.getState();
+ if (cs.equals(ConnectionState.AUTHENTICATING)) {
+ auth.authenticate();
+ cs = auth.getState();
+ }
+
+ if (cs.equals(ConnectionState.CONNECTED)) {
+ if (connector.getConnection() == null) {
+ connector.setConnection(_engineFactory.createConnection());
+ }
+ _processConnector(connector);
+ }
+ }
+
+ try {
+ connector.process();
+ } catch (IOException e) {
+ continue;
+ }
+ }
+ }
+
+ private void _processConnector(Connector<?> connector) {
+ _initConnection(connector);
+ _openPendingSessions(connector);
+ _openLinks(connector);
+ _queueOutgoingDeliveries(connector);
+ _processDeliveries(connector);
+ _cleanDeliveries(connector);
+ _cleanLinks(connector);
+ _cleanSessions(connector);
+ }
+
+ private void _cleanSessions(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.ACTIVE);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .of(EndpointState.CLOSED);
+
+ for (Session ssn = conn.sessionHead(localState, remoteState); ssn != null; ssn
+ .next(localState, remoteState)) {
+
+ ssn.close();
+ }
+ }
+
+ private void _cleanLinks(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.ACTIVE);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .of(EndpointState.CLOSED);
+
+ for (Link link = conn.linkHead(localState, remoteState); link != null; link = link
+ .next(localState, remoteState)) {
+
+ final ProtonClient ssn = _getClient(link.getSession());
+ ssn.removeLink(link);
+ }
+ }
+
+ private void _cleanDeliveries(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.ACTIVE);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .allOf(EndpointState.class);
+ for (Link link = conn.linkHead(localState, remoteState); link != null; link = link
+ .next(localState, remoteState)) {
+
+ if (link instanceof Receiver) {
+ // We settle all incoming deliveries upon receive
+ continue;
+ }
+
+ Delivery d;
+ final Calendar now = Calendar.getInstance();
+ for (Iterator<Delivery> iter = link.unsettled(); iter.hasNext();) {
+ d = iter.next();
+ Object ctx = d.getContext();
+ if (!(ctx instanceof Calendar)) {
+ // Has not been sent yet
+ continue;
+ }
+
+ final Calendar timeout = (Calendar) ctx;
+ boolean remoteClosed = link.getRemoteState().equals(
+ EndpointState.CLOSED);
+ boolean timedOut = now.after(timeout);
+ if (d.remotelySettled() || timedOut || remoteClosed) {
+ d.settle();
+ d.free();
+ }
+ }
+
+ }
+
+ }
+
+ private void _processDeliveries(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ for (Delivery delivery = conn.getWorkHead(); delivery != null; delivery = delivery
+ .getWorkNext()) {
+
+ final ProtonClient client = _getClient(delivery.getLink()
+ .getSession());
+ client.processDelivery(delivery);
+ }
+ }
+
+ private void _queueOutgoingDeliveries(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.ACTIVE);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .allOf(EndpointState.class);
+
+ for (Session ssn = conn.sessionHead(localState, remoteState); ssn != null; ssn = ssn
+ .next(localState, remoteState)) {
+
+ final ProtonClient client = _getClient(ssn);
+ client.queueDeliveries();
+ }
+ }
+
+ private void _openLinks(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.UNINITIALIZED);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .allOf(EndpointState.class);
+ for (Link link = conn.linkHead(localState, remoteState); link != null; link = link
+ .next(localState, remoteState)) {
+
+ // configure the link
+ link.setSource(link.getRemoteSource());
+ link.setTarget(link.getRemoteTarget());
+
+ final ProtonClient client = _getClient(link.getSession());
+ client.addLink(link);
+ }
+ }
+
+ private ProtonClient _getClient(Session ssn) {
+ return (ProtonClient) ssn.getContext();
+ }
+
+ private void _openPendingSessions(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ final EnumSet<EndpointState> localState = EnumSet
+ .of(EndpointState.UNINITIALIZED);
+ final EnumSet<EndpointState> remoteState = EnumSet
+ .allOf(EndpointState.class);
+
+ for (Session ssn = conn.sessionHead(localState, remoteState); ssn != null; ssn = ssn
+ .next(localState, remoteState)) {
+
+ final ProtonClient client = new ProtonClient(this, ssn);
+ ssn.setContext(client);
+ final Object ctx = connector.getContext();
+ assert (ctx instanceof ProtonAuthenticator);
+ ProtonAuthenticator auth = (ProtonAuthenticator) ctx;
+ if (auth.getAuthType() == AuthenticatorType.SERVER) {
+ ssn.open();
+ final ProtonListener l = (ProtonListener) ctx;
+ l.accept(client);
+ } else {
+ ssn.close();
+ }
+ }
+ }
+
+ private void _initConnection(Connector<?> connector) {
+ final Connection conn = connector.getConnection();
+ if (conn.getLocalState().equals(EndpointState.UNINITIALIZED)) {
+ conn.open();
+ }
+ }
+
+ private void _acceptConnectionRequests() {
+ for (final Listener<?> l : _driver.listeners()) {
+
+ @SuppressWarnings("unchecked")
+ final Connector<ProtonAuthenticator> connector = (Connector<ProtonAuthenticator>) l
+ .accept();
+ if (connector == null) {
+ continue;
+ }
+ connector.setContext(new ProtonAuthenticator(connector,
+ AuthenticatorType.SERVER));
+ }
+ }
+
+ public void stop() {
+ synchronized (_syncRoot) {
+ _isRunning = false;
+ }
+
+ wakeup();
+ }
+}
\ No newline at end of file
diff --git a/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/AmqpReactorTestHelper.java b/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/AmqpReactorTestHelper.java
new file mode 100644
index 0000000..46d9cc3
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/AmqpReactorTestHelper.java
@@ -0,0 +1,18 @@
+package org.ovirt.vdsm.jsonrpc;
+
+import java.io.IOException;
+import org.ovirt.vdsm.reactors.ProtonReactor;
+import org.ovirt.vdsm.reactors.Reactor;
+
+public class AmqpReactorTestHelper implements ReactorTestHelper {
+ @Override
+ public Reactor createReactor() throws IOException {
+ return new ProtonReactor();
+ }
+
+ @Override
+ public String getUriScheme() {
+ return "amqp";
+ }
+
+}
diff --git a/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/TestJsonRpcClientAMQP.java b/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/TestJsonRpcClientAMQP.java
new file mode 100644
index 0000000..9e0c24c
--- /dev/null
+++ b/client/java/vdsm-json-rpc/src/test/java/org/ovirt/vdsm/jsonrpc/TestJsonRpcClientAMQP.java
@@ -0,0 +1,10 @@
+package org.ovirt.vdsm.jsonrpc;
+
+public class TestJsonRpcClientAMQP extends TestJsonRpcClient {
+
+ @Override
+ protected ReactorTestHelper getHelper() {
+ return new AmqpReactorTestHelper();
+ }
+
+}
--
To view, visit http://gerrit.ovirt.org/15428
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I94c52e118cb63d7df84b89a9b93da7b9e477be91
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: functional tests: virt: fix devices verification
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: functional tests: virt: fix devices verification
......................................................................
functional tests: virt: fix devices verification
Change-Id: I774dfdb3f0bde3822df383c54060b41ba7a2cda6
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M tests/functional/virtTests.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/43600/1
diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py
index abe9297..72c8a76 100644
--- a/tests/functional/virtTests.py
+++ b/tests/functional/virtTests.py
@@ -220,10 +220,11 @@
timeout=10)
def _verifyDevices(self, vmId):
- status, msg, stats = self.vdsm.getVmList(vmId)
+ status, msg, stats = self.vdsm.getVmStats(vmId)
self.assertEqual(status, SUCCESS, msg)
- self.verifyDevicesConf(conf=stats['devices'])
+ if 'devices' in stats:
+ self.verifyDevicesConf(conf=stats['devices'])
@expandPermutations
--
To view, visit https://gerrit.ovirt.org/43600
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I774dfdb3f0bde3822df383c54060b41ba7a2cda6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 7 months
Change in vdsm[ovirt-3.6]: volume: fix failing metadata parsing
by ishaby@redhat.com
Hello Allon Mureinik,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/45761
to review the following change.
Change subject: volume: fix failing metadata parsing
......................................................................
volume: fix failing metadata parsing
The call to "split" in file and block volumes expects only one "=" per
line. This is not a good behavior since there might be fields that
contain some more "=" (like Description).
This patch limits the number of splits to 1, so that the fields values
can contains some other "=".
Change-Id: Ie84bf5e42d2c4949944a5f348615d6fe80f72fa2
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1258835
Signed-off-by: Idan Shaby <ishaby(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/45585
Reviewed-by: Nir Soffer <nsoffer(a)redhat.com>
Reviewed-by: Allon Mureinik <amureini(a)redhat.com>
Continuous-Integration: Jenkins CI
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/45761/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 9ab5ca4..ac29f40 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -595,7 +595,7 @@
return out
if l.find("=") < 0:
continue
- key, value = l.split("=")
+ key, value = l.split("=", 1)
out[key.strip()] = value.strip()
except Exception as e:
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 20573bd..1259472 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -300,7 +300,7 @@
return out
if l.find("=") < 0:
continue
- key, value = l.split("=")
+ key, value = l.split("=", 1)
out[key.strip()] = value.strip()
except Exception as e:
--
To view, visit https://gerrit.ovirt.org/45761
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie84bf5e42d2c4949944a5f348615d6fe80f72fa2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Idan Shaby <ishaby(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: vdsm: changed description for Image.download method
by cshereme@redhat.com
Candace Sheremeta has uploaded a new change for review.
Change subject: vdsm: changed description for Image.download method
......................................................................
vdsm: changed description for Image.download method
changed the description for Image.download method in
vdsmapi-schema.json in order to more accurately reflect
the nature of the method's methodArgs parameter
Change-Id: I8f355e2328bd307adda54a45bd45899baa363cfa
Signed-off-by: Candace Sheremeta <cshereme(a)redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/38439/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 1d919e8..0b7e2a1 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -4658,7 +4658,7 @@
# Download an image to a remote endpoint using the specified method
# and methodArgs.
#
-# @methodArgs: Download method and map of arguments
+# @methodArgs: An ImageSharingMethodArgs record specifying the download method.
#
# @storagepoolID: The UUID of the Storage Pool associated with the Image
#
--
To view, visit https://gerrit.ovirt.org/38439
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f355e2328bd307adda54a45bd45899baa363cfa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Candace Sheremeta <cshereme(a)redhat.com>
8 years, 7 months
Change in vdsm[ovirt-3.6]: network.api: EL7's dhclient doesn't support -df so stop usin...
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: network.api: EL7's dhclient doesn't support -df so stop using it there
......................................................................
network.api: EL7's dhclient doesn't support -df so stop using it there
This is a quick fix only. A proper solution for the affected bug will
have to fall back to -lf (a copy of a lease file).
Change-Id: Ia096d42d24b00e7ef075f1a2dde7e3a951c0b81c
Bug-Url: https://bugzilla.redhat.com/1219429
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/45713
Reviewed-by: Francesco Romani <fromani(a)redhat.com>
Tested-by: Martin Sivák <msivak(a)redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/network/api.py
M vdsm/network/configurators/__init__.py
M vdsm/network/configurators/dhclient.py
3 files changed, 26 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/45754/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 5b3a905..5bd675a 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -36,7 +36,7 @@
from vdsm import utils
from vdsm import ipwrapper
-from .configurators import libvirt
+from .configurators import dhclient, libvirt
from .errors import ConfigNetworkError
from . import errors as ne
from .models import Bond, Bridge, IPv4, IPv6, Nic, Vlan
@@ -608,6 +608,14 @@
If there is dhclient already running on a bridge's port we have to use the
same DHCP unique identifier (DUID) in order to get the same IP address.
"""
+ # On EL7 dhclient doesn't have a -df option (to read DUID from the port's
+ # lease file). We must detect if the option is available, by running
+ # dhclient manually. To unbreak a beta4 release we just won't use the -df
+ # option in that case. A proper fix is probably to fall back to -lf,
+ # passing to it a modified NIC lease file.
+ if not dhclient.supports_duid_file():
+ return
+
for devices in (_netinfo.nics, _netinfo.bondings, _netinfo.vlans):
port = devices.get(bridge.port.name)
if port and port['dhcpv4']:
diff --git a/vdsm/network/configurators/__init__.py b/vdsm/network/configurators/__init__.py
index bca3eba..86e17a1 100644
--- a/vdsm/network/configurators/__init__.py
+++ b/vdsm/network/configurators/__init__.py
@@ -176,7 +176,7 @@
def runDhclient(iface, family=4, default_route=False):
dhclient = DhcpClient(iface.name, family, default_route, iface.duid_source)
- rc = dhclient.start(iface.blockingdhcp)
+ rc, _, _ = dhclient.start(iface.blockingdhcp)
if iface.blockingdhcp and rc:
raise ConfigNetworkError(ERR_FAILED_IFUP, 'dhclient%s failed' % family)
diff --git a/vdsm/network/configurators/dhclient.py b/vdsm/network/configurators/dhclient.py
index 181c302..783126b 100644
--- a/vdsm/network/configurators/dhclient.py
+++ b/vdsm/network/configurators/dhclient.py
@@ -28,10 +28,7 @@
from vdsm import cmdutils
from vdsm import ipwrapper
from vdsm import netinfo
-from vdsm.utils import CommandPath
-from vdsm.utils import execCmd
-from vdsm.utils import pgrep
-from vdsm.utils import rmFile
+from vdsm.utils import CommandPath, execCmd, memoized, pgrep, rmFile
DHCLIENT_CGROUP = 'vdsm-dhclient'
LEASE_DIR = '/var/lib/dhclient'
@@ -68,13 +65,11 @@
if self.duid_source_file:
cmd += ['-df', self.duid_source_file]
cmd = cmdutils.systemd_run(cmd, scope=True, slice=self._cgroup)
- rc, out, err = execCmd(cmd)
- return rc, out, err
+ return execCmd(cmd)
def start(self, blocking):
if blocking:
- rc, _, _ = self._dhclient()
- return rc
+ return self._dhclient()
else:
t = threading.Thread(target=self._dhclient, name='vdsm-dhclient-%s'
% self.iface)
@@ -137,3 +132,16 @@
raise
if pid_file is not None:
rmFile(pid_file)
+
+
+@memoized
+def supports_duid_file():
+ probe = DhcpClient('-invalid-option') # dhclient doesn't have -h/--help
+ rc, out, err = probe.start(blocking=True)
+ if rc: # -invalid-option should always fail, unlike --help if implemented
+ for line in err:
+ if '-df' in line:
+ return True
+ return False
+ else:
+ raise AssertionError("dhclient shouldn't succeed with invalid options")
--
To view, visit https://gerrit.ovirt.org/45754
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia096d42d24b00e7ef075f1a2dde7e3a951c0b81c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: hsm: Support testPvCreate param in getDeviceList
by frolland@redhat.com
Hello Fred Rolland,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/45093
to review the following change.
Change subject: hsm: Support testPvCreate param in getDeviceList
......................................................................
hsm: Support testPvCreate param in getDeviceList
Add optional 'testPvCreate' boolean parameter to getDeviceList.
By default it will be True to keep same behavior as before.
If specified as False, the PV create test will be skipped and the
'status' field will not be populated.
Examples:
getDeviceList
return all devices
getDeviceList FCP
return only FCP devices
getDeviceList FCP True
return only FCP devices and perform PV create test
getDeviceList ISCSI False guid1 guid2
return info for guid1 and guid2, assuming ISCSI type
without performing PV create test
Change-Id: Ic28954708f2fd7c7b721aa7f9a0fb6e1a6019597
Bug-Url: https://bugzilla.redhat.com/1217401
Signed-off-by: Fred Rolland <frolland(a)redhat.com>
---
M client/vdsClient.py
M vdsm/API.py
M vdsm/rpc/bindingxmlrpc.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/storage/hsm.py
5 files changed, 46 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/45093/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index ce40974..c62321d 100755
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -732,8 +732,11 @@
def getDeviceList(self, args):
if len(args) == 0:
res = self.s.getDeviceList()
+ elif len(args) == 1:
+ res = self.s.getDeviceList(args[0])
else:
- res = self.s.getDeviceList(args[0], args[1:])
+ res = self.s.getDeviceList(args[0],
+ utils.tobool(args[1]), args[2:])
if res['status']['code']:
return res['status']['code'], res['status']['message']
@@ -2277,16 +2280,22 @@
)),
'getDeviceList': (serv.getDeviceList,
('[storageType]',
+ '[testPvCreate]',
'[<devlist>]',
'List of all block devices (optionally - matching '
- 'storageType, optionally - of each device listed).',
+ 'storageType, optionally - perform PV create test '
+ 'optionally - of each device listed).',
' getDeviceList',
' return all devices',
' getDeviceList FCP',
' return only FCP devices',
- ' getDeviceList ISCSI guid1 guid2',
+ ' getDeviceList FCP True',
+ ' return only FCP devices and perform ',
+ ' PV creation test',
+ ' getDeviceList ISCSI False guid1 guid2',
' return info for guid1 and guid2',
- ' , assuming ISCSI type'
+ ' , assuming ISCSI type and skip PV ',
+ ' creation test'
)),
'getDevicesVisibility': (serv.getDevicesVisibility,
('<devlist>',
diff --git a/vdsm/API.py b/vdsm/API.py
index 66822a5..bbc3f03 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1679,8 +1679,8 @@
def getLVMVolumeGroups(self, storageType=None):
return self._irs.getVGList(storageType)
- def getDeviceList(self, storageType=None, guids=()):
- return self._irs.getDeviceList(storageType, guids)
+ def getDeviceList(self, storageType=None, testPvCreate=True, guids=()):
+ return self._irs.getDeviceList(storageType, testPvCreate, guids)
def getDevicesVisibility(self, guidList):
return self._irs.getDevicesVisibility(guidList)
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index 7f1da4f..b23643b 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -1029,9 +1029,10 @@
api = API.Global()
return api.getLVMVolumeGroups(storageType)
- def devicesGetList(self, storageType=None, guids=(), options=None):
+ def devicesGetList(self, storageType=None, testPvCreate=True,
+ guids=(), options=None):
api = API.Global()
- res = api.getDeviceList(storageType, guids)
+ res = api.getDeviceList(storageType, testPvCreate, guids)
return unprotect_passwords(res)
def devicesGetVisibility(self, guids, options=None):
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 4cac5ae..42b9c91 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1477,6 +1477,9 @@
#
# @storageType: #optional Only return devices of this type
#
+# @testPvCreate: #optional Indicates if PV creation test should be performed
+# (new in version 4.17)
+#
# @guids: #optional Only return info on specific list of block device
# GUIDs (new in version 4.17)
#
@@ -1487,6 +1490,7 @@
##
{'command': {'class': 'Host', 'name': 'getDeviceList'},
'data': {'*storageType': 'BlockDeviceType',
+ '*testPvCreate': 'bool',
'*guids': ['str']},
'returns': ['BlockDeviceInfo']}
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 0806abb..b5e2b7f 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1957,12 +1957,15 @@
masterVersion, leaseParams)
@public
- def getDeviceList(self, storageType=None, guids=(), options={}):
+ def getDeviceList(self, storageType=None, testPvCreate=True,
+ guids=(), options={}):
"""
List all Block Devices.
:param storageType: Filter by storage type.
:type storageType: Some enum?
+ :param testPvCreate: Test PV creation.
+ :type bool: if true PV creation will be tested for the given devices
:param guids: List of device GUIDs to retrieve info.
:type guids: list
:param options: ?
@@ -1972,10 +1975,11 @@
:rtype: dict
"""
vars.task.setDefaultException(se.BlockDeviceActionError())
- devices = self._getDeviceList(storageType=storageType, guids=guids)
+ devices = self._getDeviceList(storageType=storageType,
+ testPvCreate=testPvCreate, guids=guids)
return dict(devList=devices)
- def _getDeviceList(self, storageType=None, guids=()):
+ def _getDeviceList(self, storageType=None, testPvCreate=True, guids=()):
sdCache.refreshStorage()
typeFilter = lambda dev: True
if storageType:
@@ -2030,22 +2034,23 @@
'physicalblocksize': dev.get("physicalblocksize", "")}
devices.append(devInfo)
- # Look for devices that will probably fail if pvcreated.
- devNamesToPVTest = tuple(dev["GUID"] for dev in devices)
- unusedDevs, usedDevs = lvm.testPVCreate(
- devNamesToPVTest, metadataSize=blockSD.VG_METADATASIZE)
- # Assuming that unusables v unusables = None
- free = tuple(os.path.basename(d) for d in unusedDevs)
- used = tuple(os.path.basename(d) for d in usedDevs)
- for dev in devices:
- guid = dev['GUID']
- if guid in free:
- dev['status'] = "free"
- elif guid in used:
- dev['status'] = "used"
- else:
- raise KeyError("pvcreate response foresight is "
- "can not be determined for %s", dev)
+ if testPvCreate:
+ # Look for devices that will probably fail if pvcreated.
+ devNamesToPVTest = tuple(dev["GUID"] for dev in devices)
+ unusedDevs, usedDevs = lvm.testPVCreate(
+ devNamesToPVTest, metadataSize=blockSD.VG_METADATASIZE)
+ # Assuming that unusables v unusables = None
+ free = tuple(os.path.basename(d) for d in unusedDevs)
+ used = tuple(os.path.basename(d) for d in usedDevs)
+ for dev in devices:
+ guid = dev['GUID']
+ if guid in free:
+ dev['status'] = "free"
+ elif guid in used:
+ dev['status'] = "used"
+ else:
+ raise KeyError("pvcreate response foresight is "
+ "can not be determined for %s", dev)
return devices
--
To view, visit https://gerrit.ovirt.org/45093
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic28954708f2fd7c7b721aa7f9a0fb6e1a6019597
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Freddy Rolland <frolland(a)redhat.com>
Gerrit-Reviewer: Fred Rolland <frolland(a)redhat.com>
8 years, 8 months
Change in vdsm[master]: hostdev: add udev rules for USB devices
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: hostdev: add udev rules for USB devices
......................................................................
Patch Set 10: Code-Review-1
--
To view, visit https://gerrit.ovirt.org/44679
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1f72f63186187254cd4aded0a2e6c396001ca28b
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 8 months
Change in vdsm[master]: hostdev: add udev rules for USB devices
by Nir Soffer
Nir Soffer has posted comments on this change.
Change subject: hostdev: add udev rules for USB devices
......................................................................
Patch Set 8:
(1 comment)
https://gerrit.ovirt.org/#/c/44679/8/vdsm/supervdsmServer
File vdsm/supervdsmServer:
Line 398:
Line 399: self.udevTriggerUSB(bus, device)
Line 400:
Line 401: @logDecorator
Line 402: def releaseAppropriateUSBDevice(self, bus, device):
> Addressed in https://gerrit.ovirt.org/#/c/45420/
I explained why we don't need this function in a previous comment in one of the patches that included it.
Please explain why we need this function which is not needed for other udev rules (we have appropriateXXXDevice and rmAppropriateXXXDevice).
Line 403: rule_file = _UDEV_RULE_FILE_NAME_USB % (bus, device)
Line 404:
Line 405: rule = ('SUBSYSTEM=="usb", ATTRS{{busnum}}=="{}", '
Line 406: 'ATTRS{{devnum}}=="{}", '
--
To view, visit https://gerrit.ovirt.org/44679
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1f72f63186187254cd4aded0a2e6c396001ca28b
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
8 years, 8 months
Change in vdsm[master]: Fix string in diskunmap hook README file
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: Fix string in diskunmap hook README file
......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found
* Set MODIFIED::IGNORE, no Bug-Url found.
--
To view, visit https://gerrit.ovirt.org/45665
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I33a872a4b05451f235167c99e4ec01da80d0f557
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Javier Coscia <ciudavitacos(a)gmail.com>
Gerrit-Reviewer: Amador Pahim <apahim(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Javier Coscia <ciudavitacos(a)gmail.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 8 months